1. 用initrd方式构建根文件系统
操作步骤:
0) set enveniment
a) $ export PATH=$PATH:/usr/local/arm/arm-2009q3/bin
1) make busybox.
a) $ cd busybox-1.20.2
b) $ make menuconfig
Busybox Settings
--> Build Options
[*] select build busybox as a static binary
(arm-none-linux-gnueabi-) Cross Compiler Prefix
c) $ make
d) $ make install
e) $ cd ..
2) create necessary directory and files
a) $ mkdir initrd && cd initrd
b) $ mkdir -p etc/init.d proc sys dev
c) $ sudo cp -a /dev/{null,zero,console} dev/
d) $ cp -rf ../busybox-1.20.2/_install/* ./
e) $ rm -f linuxrc && ln -s bin/busybox init
f) edit etc/fstab, add followings:
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
g) edit etc/inittab
::sysinit:/etc/init.d/rcS
console::respawn:-/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
h) edit etc/init.d/rcS
#!/bin/sh
mount -a
i) $ chmod +x etc/init.d/rcS
j) $ cd ..
3) create rootfs image.
a) $ dd if=/dev/zero of=initrd.img bs=1k count=8192
b) $ sudo mke2fs -F -v -m0 initrd.img
c) $ sudo mount -o loop initrd.img /mnt/tmp/
mount: mount point /mnt/tmp/ does not exist 解决办法:sudo mount -o loop initrd.img /mnt/
d) $ sudo cp initrd/* /mnt/tmp/ -rf 替换为 sudo cp initrd/* /mnt/ -rf
e) $ sudo umount /mnt/tmp/ 替换为 sudo umount /mnt/
f) $ gzip -9 initrd.img
g) $ fastboot flash ramdisk initrd.img.gz
4) modify bootloader.
diff --git a/TC4_uboot/board/samsung/smdkc210/smdkc210.c b/TC4_uboot/board/samsung/smdkc210/smdkc210.c
index c5abd40..79d55db 100755
--- a/TC4_uboot/board/samsung/smdkc210/smdkc210.c
+++ b/TC4_uboot/board/samsung/smdkc210/smdkc210.c
@@ -246,7 +246,10 @@ int board_late_init (void)
&& boot_mode == 0) {
//printf("board_late_init\n");
char boot_cmd[100];
- sprintf(boot_cmd, "movi read kernel 40008000;movi read rootfs 40d00000 100000;bootm 40008000 40d00000");
+ //sprintf(boot_cmd, "movi read kernel 40008000;movi read rootfs 40d00000 100000;bootm 40008000 40d00000");
+ sprintf(boot_cmd, "movi read kernel 40008000;movi read rootfs 40d00000 300000;bootm 40008000");
setenv("bootcmd", boot_cmd);
}
5) modify kernel cmdline.
diff --git a/TC4_Kernel_3.0/arch/arm/configs/m8012_defconfig b/TC4_Kernel_3.0/arch/arm/configs/m8012_defconfig
index 5ddb074..3d24ece 100755
--- a/TC4_Kernel_3.0/arch/arm/configs/m8012_defconfig
+++ b/TC4_Kernel_3.0/arch/arm/configs/m8012_defconfig
@@ -570,7 +570,10 @@ CONFIG_ALIGNMENT_TRAP=y
# CONFIG_USE_OF is not set
CONFIG_ZBOOT_ROM_TEXT=0
CONFIG_ZBOOT_ROM_BSS=0
-CONFIG_CMDLINE="console=ttySAC2,115200"
+#CONFIG_CMDLINE="console=ttySAC2,115200"
+CONFIG_CMDLINE="console=ttySAC2,115200 initrd=0x40d00000,8mb root=/dev/ram0"
+
# CONFIG_CMDLINE_FROM_BOOTLOADER is not set
CONFIG_CMDLINE_EXTEND=y
# CONFIG_CMDLINE_FORCE is not set
6) build uboot, kernel, and flash them.
操作步骤:
0) set enveniment
a) $ export PATH=$PATH:/usr/local/arm/arm-2009q3/bin
1) make busybox.
a) $ cd busybox-1.20.2
b) $ make menuconfig
Busybox Settings
--> Build Options
[*] select build busybox as a static binary
(arm-none-linux-gnueabi-) Cross Compiler Prefix
c) $ make
d) $ make install
e) $ cd ..
2) create necessary directory and files
a) $ mkdir initrd && cd initrd
b) $ mkdir -p etc/init.d proc sys dev
c) $ sudo cp -a /dev/{null,zero,console} dev/
d) $ cp -rf ../busybox-1.20.2/_install/* ./
e) $ rm -f linuxrc && ln -s bin/busybox init
f) edit etc/fstab, add followings:
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
g) edit etc/inittab
::sysinit:/etc/init.d/rcS
console::respawn:-/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
h) edit etc/init.d/rcS
#!/bin/sh
mount -a
i) $ chmod +x etc/init.d/rcS
j) $ cd ..
3) create rootfs image.
a) $ dd if=/dev/zero of=initrd.img bs=1k count=8192
b) $ sudo mke2fs -F -v -m0 initrd.img
c) $ sudo mount -o loop initrd.img /mnt/tmp/
mount: mount point /mnt/tmp/ does not exist 解决办法:sudo mount -o loop initrd.img /mnt/
d) $ sudo cp initrd/* /mnt/tmp/ -rf 替换为 sudo cp initrd/* /mnt/ -rf
e) $ sudo umount /mnt/tmp/ 替换为 sudo umount /mnt/
f) $ gzip -9 initrd.img
g) $ fastboot flash ramdisk initrd.img.gz
4) modify bootloader.
diff --git a/TC4_uboot/board/samsung/smdkc210/smdkc210.c b/TC4_uboot/board/samsung/smdkc210/smdkc210.c
index c5abd40..79d55db 100755
--- a/TC4_uboot/board/samsung/smdkc210/smdkc210.c
+++ b/TC4_uboot/board/samsung/smdkc210/smdkc210.c
@@ -246,7 +246,10 @@ int board_late_init (void)
&& boot_mode == 0) {
//printf("board_late_init\n");
char boot_cmd[100];
- sprintf(boot_cmd, "movi read kernel 40008000;movi read rootfs 40d00000 100000;bootm 40008000 40d00000");
+ //sprintf(boot_cmd, "movi read kernel 40008000;movi read rootfs 40d00000 100000;bootm 40008000 40d00000");
+ sprintf(boot_cmd, "movi read kernel 40008000;movi read rootfs 40d00000 300000;bootm 40008000");
setenv("bootcmd", boot_cmd);
}
5) modify kernel cmdline.
diff --git a/TC4_Kernel_3.0/arch/arm/configs/m8012_defconfig b/TC4_Kernel_3.0/arch/arm/configs/m8012_defconfig
index 5ddb074..3d24ece 100755
--- a/TC4_Kernel_3.0/arch/arm/configs/m8012_defconfig
+++ b/TC4_Kernel_3.0/arch/arm/configs/m8012_defconfig
@@ -570,7 +570,10 @@ CONFIG_ALIGNMENT_TRAP=y
# CONFIG_USE_OF is not set
CONFIG_ZBOOT_ROM_TEXT=0
CONFIG_ZBOOT_ROM_BSS=0
-CONFIG_CMDLINE="console=ttySAC2,115200"
+#CONFIG_CMDLINE="console=ttySAC2,115200"
+CONFIG_CMDLINE="console=ttySAC2,115200 initrd=0x40d00000,8mb root=/dev/ram0"
+
# CONFIG_CMDLINE_FROM_BOOTLOADER is not set
CONFIG_CMDLINE_EXTEND=y
# CONFIG_CMDLINE_FORCE is not set
6) build uboot, kernel, and flash them.