使用Busybox-1.13.4制作cramfs文件系统详解

1、先准备好工具:
(1)Busybox-1.13.4下载地址:
http://busybox.net/downloads/busybox-1.13.4.tar.bz2
(2)cramfs-1.1工具下载地址: http://download.sunplusedu.com/download/cramfs-1.1.tar.gz 或则去官网http://sourceforge.net/projects/cramfs/

2、解压cramfs工具(这里我放在了根目录下):

2、编译cramfs;

3、cramfs工具制作好了,接下来我们解压Busybox。

4、对Busybox进行配置,运行make menuconfig命令

# make menuconfig

这里咱们只配置一下静态就可以了。

然后保存,退出。

5、然后执行命令:make install

注:编译“networking/interface.c”文件时可能会出现以下错误:
CC networking/interface.o
networking/interface.c:818: error: 'ARPHRD_INFINIBAND' undeclared here (not in a function)
make[1]: *** [networking/interface.o] Error 1
make: *** [networking] Error 2
通过查看内核源代码目录中的“include/linux/ifarp.h”文件可得知“ARPHRDINFINIBAND”的值为“32”,然后修改“networking/interface.c”文件,在其中添加:
#define ARPHRD_INFINIBAND 32 /* InfiniBand */

5、最后看到下面结果就Ok啦!

6、建立文件系统所需的目录和文件。

$ mkdir bin dev etc home lib mnt proc sbin sys tmp var usr

并且拷贝_install下面的四个文件到该目录下。

7、以root身份建立节点文件/dev/console, /dev/null

mknod -m 600 dev/console c 5 1

mknod -m 666 dev/null c 1 3

8. 建立配置文件如下:

[etc]# vi profile

#!/bin/sh

#/etc/profile:system-wide .profile file for the Bourne shells

echo

echo -n "Processing /etc/profile......"

# Set search library path

export LD_LIBRARY_PATH=/lib:/usr/lib

# set user path

export PATH=/bin:/sbin:/usr/bin:/usr/sbin

#Set PS1

USER = "`id -un`"

LOGNAME=$USER

PS1='[\u@\h\W]\$' //这里很好玩的你可以把\u换乘你的用户名比如,@后面也可以跟上计算机名

PATH=$PATH

echo "Done!"

[etc]# vi init.d/rcS

#!/bin/sh

# set hostname, needed host file in /etc directory

#./etc/host

#hostname `cat /etc/host`

# mount all filesystem defined in "fstab"

echo "#mount all......."

#/bin/mount -a

#/bin/chmod 0666 /dev/null

echo "# starting mdev...."

#/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug

mdev -s

/bin/sh

[etc]# ls

fstab host inittab passwd shadow

group init.d/ mdev.conf profile

[etc]# vi fstab

proc /proc proc defaults 0 0

none /tmp ramfs defaults 0 0

none /var ramfs defaults 0 0

mdev /dev ramfs defaults 0 0

sysfs /sys sysfs defaults 0 0

[etc]# vi inittab

::sysinit:/etc/init.d/rcS

::respawn:-/bin/sh

::ctrlaltdel:/bin/umount -a -r

::shutdown:/bin umount -a -r

::shutdown:/sbin/swapoff -a

[etc]# vi ../usr/etc/init

#!/bin/sh

ifconfig eth0 192.168.1.111 up

ifconfig lo 127.0.0.1

9.建立文件/etc/mdev.conf,内容为空

[etc]# vi mdev.conf

10.复制主机/etc/下面的文件passwd, group, shadow文件到etc目录(这一步也可以不做)

[etc]# cp /etc/group .

[etc]# cp /etc/passwd .

[etc]# cp /etc/shadow .

ok,所需要的文件都已经建立ok

[etc]# ls

fstab group host init.d inittab mdev.conf passwd profile shadow

启动后:

u-boot(armzone)=> bootm
## Booting image at 30008000 ...
Image Name: linux-2.6.25
Created: 2009-05-26 7:42:53 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1628180 Bytes = 1.6 MB
Load Address: 30008000
Entry Point: 30008040
Verifying Checksum ... OK
XIP Kernel Image ... OK
boot linux

Starting kernel ...

Uncompressing Linux.......................................................................................................... done, booting the kernel.
Linux version 2.6.25.8 (
root@localhost.localdomain) (gcc version 3.4.1) #8 Tue May 26 15:40:29 CST 2009
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=00007177
Machine: SMDK2410
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHz
S3C24XX Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0,115200 mem=64M
irq: clearing pending ext status 00000200
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001e4c
Console: colour dummy device 80x30
console [ttySAC0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 61440KB available (3004K code, 304K data, 140K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2410: Initialising architecture
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4800000, irq 33
DMA channel 1 at c4800040, irq 34
DMA channel 2 at c4800080, irq 35
DMA channel 3 at c48000c0, irq 36
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
yaffs May 25 2009 19:50:02 Installing.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
s3c2410-lcd s3c2410-lcd: no platform data for lcd, cannot attach
s3c2410-lcd: probe of s3c2410-lcd failed with error -22
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
s3c2410-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2410
s3c2410-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2410
s3c2410-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2410
brd: module loaded
loop: module loaded
dm9000 Ethernet Driver, V1.30
Uniform Multi-Platform E-IDE driver
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
BAST NOR-Flash Driver, (c) 2004 Simtec Electronics
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2410-nand s3c2410-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
NAND_ECC_NONE selected by board driver. This is not recommended !!
Scanning device for bad blocks
Bad eraseblock 2401 at 0x02584000
Creating 4 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00100000 : "Boot"
0x00100000-0x00300000 : "kernel"
0x00300000-0x02c00000 : "root"
0x02c00000-0x04000000 : "usr"
usbmon: debugfs is not available
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2410-i2c s3c2410-i2c: slave address 0x10
s3c2410-i2c s3c2410-i2c: bus frequency set to 99 KHz
s3c2410-i2c s3c2410-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
TCP cubic registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
VFS: Mounted root (cramfs filesystem) readonly.
Freeing init memory: 140K
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^ Welcome to CRAMFS root filesystem! ^
^ CWT ^
^^^^^^^^^^^^^^^^09-5-21^^^^^^^^^^^^^^^^^^^^
hostname: can't open '/etc/host': No such file or directory
ln: /dev/tty1: File exists
#mount all.......
mount: mounting none on /dev/pts failed: No such file or directory
mount: mounting tmpfs on /dev/shm failed: No such file or directory

Please press Enter to activate this console.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值