ramdisk target - ihipop/winsun_mininas_v1 GitHub Wiki
Read the target/ramdisk/ramdisk.mk
or issue make ramdisk
command.
ramdisk
target takes following steps to build:
- create a staging directory
target/ramdisk/ramdisk_staging
- extract the predefined template archive into staging directory
target/ramdisk/ramdisk_template.tar.gz
-
extract the
busybox-install.tar.gz
into staging directory, this file is created when building busybox target. (hence the dependency) -
copy init script example
target/ramdisk/rcS
into stating directory, placed atetc/init.d/rcS
-
calculate optimized argument for ramdisk format (ext2).
-
launch
genext2fs
to create the image file from the staging directory. Noticing that a device table description file is provided as argument,-D target/generic/IntelCE_device_table.txt
. -
finally the ramdisk is zipped.
Busybox bug & feature
There is a bug in busybox package. the busybox-install.tar.gz
file are created with absolute path for each file inside. This results in wrong paths for all busybox binaries and links in generated ramdisk.
Furthermore, we need pivot_root (or switch_root if initramfs is used instead of initrd) command for using ramdisk in boot process.
We do these two jobs.
First, Remove busybox source tree.
rm -rf project_build_i686/IntelCE/busybox-29.0.12344.325128/
then unpack it.
make busybox-unpackage
Edit config file
vim project_build_i686/IntelCE/busybox-29.0.12344.325128/conf/busybox.config
Enable pivot_root in line 554
CONFIG_PIVOT_ROOT=y
Enable switch_root in line 564
CONFIG_SWITCH_ROOT=y
Save and exit.
Edit busybox make file
vim project_build_i686/IntelCE/busybox-29.0.12344.325128/mk/busybox.mk +8
change:
@tar -czf $(BUILD_DEST)/bin/busybox_install.tar.gz $(BUSYBOX_UTILS_INSTALL_ROOT)/*
to
tar -czf $(BUILD_DEST)/bin/busybox_install.tar.gz -C $(BUSYBOX_UTILS_INSTALL_ROOT) .
WARNING: for makefile, all commands must be preceded by tab, not space. In vim, the leading spaces in command line will be highlighted with red color. Vim command :set noexpandtab
will cure if your vim expand tab into spaces by default.
save and exit. re-make busybox.
make busybox
Now, busybox-install.tar.gz
should have the right format.