Difference between revisions of "Using Initial RAM disk"
(creation) |
m (→Configure Linux) |
||
Line 26: | Line 26: | ||
==Configure Linux== | ==Configure Linux== | ||
<pre class="host"> | <pre class="host"> | ||
− | + | $ make linux-menuconfig | |
</pre> | </pre> | ||
Set following options as static/builtin: | Set following options as static/builtin: | ||
Line 39: | Line 39: | ||
</pre> | </pre> | ||
<pre class="host"> | <pre class="host"> | ||
− | + | $ make | |
</pre> | </pre> | ||
Revision as of 17:15, 4 September 2013
Initial RAM disk are filesystem images stored in RAM memory that can be used by Linux at a first step/rootfs during the boot process. They may be usefull if the final root filesystem is not ready after Linux boot and needs some manipulation before mounting it.
For examples most USB keys takes too much time to be detected and in that case Linux is not able to use them as rootfs immediatly after boot. Other example is when you don't know the filesystem type of your rootfs and don't want to put all possibilities statically in kernel.
Initial RAM disk are also named initrd.
Page under construction... Informations on this page are not guaranteed !!
Contents
Build the initrd
Here we use a 35Mbytes initrd formatted as EXT2. Other format/size can be used (if supported by kernel).
$ make shell_env $ source armadeus_env.sh $ dd if=/dev/zero of=./myinitrd.img bs=1M count=35 $ mke2fs -m 1 ./myinitrd.img $ mkdir ./myinitrd $ mount -t ext2 ./myinitrd.img ./myinitrd -o loop $ tar -xvf $ARMADEUS_ROOTFS_TAR -C ./myinitrd/ $ umount ./myinitrd/ $ gzip ./myinitrd.img
Configure Linux
$ make linux-menuconfig
Set following options as static/builtin:
General Setup --> Initial RAM filesystem and RAM disk support Devices Drivers --> Block devices --> RAM block device support --> "Default number of RAM disks" = 2 (un pour le initrd, un autre pour montage à chaud si on veut) --> "Default RAM disk size" = 40000 (40MO pour supporter les 35MO de mon rootfs complet).
$ make
Convert initrd for U-Boot
$ ./buildroot/project_build_armv5te/apf27/u-boot-1.3.4/tools/mkimage -n 'MyRamDisk' -A arm -O linux -T ramdisk -C gzip -d ./myinitrd.img.gz rootfs-initrd $ cp rootfs-initrd /tftpboot/
Boot inird from U-Boot
BIOS> tftpboot 0xA0000000 kernel BIOS> tftpboot 0xA2000000 rootfs-initrd BIOS> setenv bootargs console=ttySMX0,115200 root=/dev/ram rw BIOS> bootm 0xA0000000 0xA2000000
May be a bit long but it boots ;-)
Going further
Loading kernel and ramdisk from FLASH
- Avoir kernel et rootfs dans la flash ==> nand write depuis u-boot ou linux
- Charger kernel + rootfs de la flash vers memory via nboot
BIOS> bootm 0xA0000000 0xA2000000
Thanks to Raphael A. for the informations.