6。最小系统启动信息
Linux version 2.6.26.5 (root@goldway) (gcc version 4.1.1 20061011 (Red Hat 4.1.1-30)) #12 Fri Jan 1 00:28:28 CST 2010
BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000000fff0000 (usable)
BIOS-e820: 000000000fff0000 - 000000000fff3000 (ACPI NVS)
BIOS-e820: 000000000fff3000 - 0000000010000000 (ACPI data)
BIOS-e820: 00000000fec00000 - 0000000100000000 (reserved)
0MB HIGHMEM available.
255MB LOWMEM available.
Entering add_active_range(0, 0, 65520) 0 entries of 256 used
Zone PFN ranges:
DMA 0 -> 4096
Normal 4096 -> 65520
HighMem 65520 -> 65520
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
0: 0 -> 65520
On node 0 totalpages: 65520
DMA zone: 32 pages used for memmap
DMA zone: 0 pages reserved
DMA zone: 4064 pages, LIFO batch:0
Normal zone: 480 pages used for memmap
Normal zone: 60944 pages, LIFO batch:15
HighMem zone: 0 pages used for memmap
Movable zone: 0 pages used for memmap
DMI 2.3 present.
Allocating PCI resources starting at 20000000 (gap: 10000000:eec00000)
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 65008
Kernel command line: ro root=/dev/hda9
Enabling fast FPU save and restore... done.
Enabling unmasked SIMD FPU exception support... done.
Initializing CPU#0
PID hash table entries: 1024 (order: 10, 4096 bytes)
Detected 2625.912 MHz processor.
Console: colour VGA+ 80x25
console [tty0] enabled
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 257764k/262080k available (912k kernel code, 3808k reserved, 300k data, 100k init, 0k highmem)
virtual kernel memory layout:
fixmap : 0xfffee000 - 0xfffff000 ( 68 kB)
pkmap : 0xff800000 - 0xffc00000 (4096 kB)
vmalloc : 0xd0800000 - 0xff7fe000 ( 751 MB)
lowmem : 0xc0000000 - 0xcfff0000 ( 255 MB)
.init : 0xc0232000 - 0xc024b000 ( 100 kB)
.data : 0xc01e4097 - 0xc022f42c ( 300 kB)
.text : 0xc0100000 - 0xc01e4097 ( 912 kB)
Checking if this processor honours the WP bit even in supervisor mode...Ok.
CPA: page pool initialized 1 of 1 pages preallocated
SLUB: Genslabs=12, HWalign=128, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Calibrating delay using timer specific routine.. 5257.16 BogoMIPS (lpj=10514322)
Mount-cache hash table entries: 512
CPU: Trace cache: 12K uops, L1 D cache: 8K
CPU: L2 cache: 128K
CPU: Intel(R) Celeron(R) CPU 2.60GHz stepping 09
Checking 'hlt' instruction... OK.
Freeing SMP alternatives: 0k freed
Setting up standard PCI resources
io scheduler noop registered (default)
Uniform Multi-Platform E-IDE driver
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
ide_generic: please use "probe_mask=0x3f" module parameter for probing all legacy ISA IDE ports
Probing IDE interface ide0...
hda: ST3160215A, ATA DISK drive
Probing IDE interface ide1...
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
hda: max request size: 512KiB
hda: 312581808 sectors (160041 MB) w/2048KiB Cache, CHS=19457/255/63
hda: cache flushes supported
hda: hda1 hda2 < hda5 hda6 hda7 hda8 hda9 hda10 hda11 >
serio: i8042 KBD port at 0x60,0x64 irq 1
serio: i8042 AUX port at 0x60,0x64 irq 12
mice: PS/2 mouse device common for all mice
Using IPI Shortcut mode
input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input0
kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
Freeing unused kernel memory: 100k freed
EXT3-fs warning: maximal mount count reached, running e2fsck is recommended
EXT3 FS on hda9, internal journal
7。详细构建过程
A. 构建rootfs.
[root@goldway ~]# pwd
/root
[root@goldway ~]# tar zxf download/busybox-1.15.3.tar.gz
[root@goldway ~]# cd busybox-1.15.3/
[root@goldway busybox-1.15.3]# make distclean
[root@goldway busybox-1.15.3]# make menuconfig
注意:
A. 选中Build BusyBox as a static binary (no shared libs)
B. 取消usleep。默认选择usleep,但是编译有问题。这里直接去掉该项命令。
C. 其他都使用默认选项.
退出时保存设置。
[root@goldway busybox-1.15.3]# make
[root@goldway busybox-1.15.3]# make install
[root@goldway busybox-1.15.3]# cd _install/
[root@goldway _install]# ll
总计 12
drwxr-xr-x 2 root root 4096 01-01 13:31 bin
lrwxrwxrwx 1 root root 11 01-01 13:31 linuxrc -> bin/busybox
drwxr-xr-x 2 root root 4096 01-01 13:31 sbin
drwxr-xr-x 4 root root 4096 01-01 13:31 usr
[root@goldway _install]# file bin/busybox
bin/busybox: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, statically linked, for GNU/Linux 2.6.9, stripped
[root@goldway _install]# rm -f linuxrc
[root@goldway _install]# cp -a ../examples/bootfloppy/etc .
修改etc中的部分内容,修改后如下
[root@goldway _install]# tree etc
etc
|-- fstab
|-- init.d
| `-- rcS
|-- inittab
`-- profile
1 directory, 4 files
[root@goldway _install]# cat etc/inittab
::sysinit:/etc/init.d/rcS
::respawn:-/bin/sh
tty2::askfirst:-/bin/sh ------要创建/dev/tty2
::ctrlaltdel:/bin/umount -a -r
[root@goldway _install]# cat etc/init.d/rcS
#! /bin/sh
/bin/mount -a
/bin/mount -o remount,rw / ------增加該行,使/可读写.
创建必要的文件夹及文件:
[root@goldway _install]# mkdir sys proc mnt dev
[root@goldway _install]# ls
bin dev etc mnt proc sbin sys usr
[root@goldway _install]# cp -a /dev/{console,tty,tty2} dev/
[root@goldway _install]# ls dev
console tty tty2
B. 内核编译
[root@goldway _install] cd
[root@goldway ~]# tar jxf download/linux-2.6.26.5.tar.bz2
[root@goldway ~]# cd linux-2.6.26.5/
[root@goldway linux-2.6.26.5]# make mrproper
[root@goldway linux-2.6.26.5]# make allnoconfig
[root@goldway linux-2.6.26.5]# make menuconfig
注意以下选项的选择:
A。选中Executable file formats/Emulations ---> Kernel support for ELF binaries -----加载运行rootfs中的程序.
B。选中Device Drivers --> ATA/ATAPI/MFM/RLL support --> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
-->Include IDE/ATA-2 DISK support 该项必选否则VFS错误:kernel panic. unkown block ....
-->legacy /proc/ide/ support --- 此项可不选
-->generic/default IDE chipset support. ---- 这里选择通用驱动. 也可选择与自己芯片组相同的驱动。
C。File systems --> Second extended fs support
--> Ext3 journalling file system support
退出保存设置
[root@goldway linux-2.6.26.5]# make bzImage ---------编译内核
[root@goldway linux-2.6.26.5]# cp arch/x86/boot/bzImage ../busybox-1.15.3/_install/
[root@goldway linux-2.6.26.5]# cd
[root@goldway ~]# mount /dev/hda9 /mnt/cdrom
[root@goldway ~]# rm -rf /mnt/cdrom/* -----清确定自己要做什么.
[root@goldway ~]# cp -a busybox-1.15.3/_install/* /mnt/cdrom/
引导设置参见第5节.
若无意外,重新启动后,即可启动我们制作出来的linux最小系统。
8。下一步工作
最小系统的功能有限,计划增加下面功能:
A。支持VFAT文件系统支持,以mount FAT32文件系统。
B。支持USB。
C。从USB启动?
D。支持网络功能。
E。X window ?
...
to be continued... |