Difference between revisions of "Using Initial RAM disk"
From ArmadeusWiki
(creation) |
(→Boot inird from U-Boot) |
||
(12 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
Initial RAM disk are also named initrd. | Initial RAM disk are also named initrd. | ||
− | |||
− | |||
==Build the initrd== | ==Build the initrd== | ||
− | + | * Old way for old Buildroot is kept [[Talk:Using_Initial_RAM_disk|here]]. | |
+ | * With recent armadeus BSPs (== with recent Buildroot), you can configure the initrd building this way: | ||
<pre class="host"> | <pre class="host"> | ||
− | $ make | + | $ make menuconfig |
− | + | </pre> | |
− | + | <pre class="config"> | |
− | + | Filesystem images ---> | |
− | + | ... | |
− | + | -*- cpio the root filesystem (for use as an initial RAM filesystem) | |
− | + | ... | |
− | + | [*] initial RAM filesystem linked into linux kernel | |
− | + | ||
</pre> | </pre> | ||
+ | |||
+ | <pre class="host"> | ||
+ | $ make | ||
+ | </pre> | ||
+ | |||
+ | * The Linux+initrd merged image will be stored in ''buildroot/output/images/apfxx-linux.bin'' | ||
==Configure Linux== | ==Configure Linux== | ||
+ | * Should be done by default. If not: | ||
<pre class="host"> | <pre class="host"> | ||
− | + | $ make linux-menuconfig | |
</pre> | </pre> | ||
Set following options as static/builtin: | Set following options as static/builtin: | ||
<pre class="config"> | <pre class="config"> | ||
General Setup --> | General Setup --> | ||
− | Initial RAM filesystem and RAM disk support | + | Initial RAM filesystem and RAM disk support |
+ | </pre> | ||
+ | * If you want to use ramdisk outside of the context of initrd then configure also: | ||
+ | <pre class="config"> | ||
Devices Drivers --> | Devices Drivers --> | ||
Block devices --> | Block devices --> | ||
− | RAM block device support | + | <*> RAM block device support |
− | + | (16) Default number of RAM disks | |
− | + | (4096) Default RAM disk size (kbytes) | |
</pre> | </pre> | ||
+ | * increase RAM disk size if needed. | ||
+ | * rebuild the kernel image if config was changed: | ||
<pre class="host"> | <pre class="host"> | ||
− | + | $ make linux | |
</pre> | </pre> | ||
− | == | + | ==Boot inird from U-Boot== |
− | <pre class=" | + | <pre class="apf"> |
− | $ | + | BIOS> tftpboot ${loadaddr} ${board_name}-linux.bin |
− | $ | + | BIOS> setenv bootargs console=${consoledev},${baudrate} root=/dev/ram rw |
+ | BIOS> bootm | ||
</pre> | </pre> | ||
− | + | * If you have a kernel with device tree support (like on [[APF6]]), you have to load it before and boot it a different way: | |
<pre class="apf"> | <pre class="apf"> | ||
− | + | replace previous "bootm" with: | |
− | BIOS> tftpboot | + | BIOS> tftpboot ${fdt_addr} ${cpu_type}-${fdt_name}.dtb |
− | BIOS> | + | BIOS> bootz ${loadaddr} - ${fdt_addr}; |
− | + | ||
</pre> | </pre> | ||
− | May be a bit long but it | + | * ''bootm'' is when you have Linux uImage (U-Boot custom format) like on APF9328/27/28/51, ''bootz'' is when you have Linux zImage (compressed format) like on [[APF6]]. |
+ | |||
+ | May be a bit long, but it should boot ;-) | ||
==Going further== | ==Going further== |
Latest revision as of 09:50, 27 July 2015
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.
Contents
Build the initrd
- Old way for old Buildroot is kept here.
- With recent armadeus BSPs (== with recent Buildroot), you can configure the initrd building this way:
$ make menuconfig
Filesystem images ---> ... -*- cpio the root filesystem (for use as an initial RAM filesystem) ... [*] initial RAM filesystem linked into linux kernel
$ make
- The Linux+initrd merged image will be stored in buildroot/output/images/apfxx-linux.bin
Configure Linux
- Should be done by default. If not:
$ make linux-menuconfig
Set following options as static/builtin:
General Setup --> Initial RAM filesystem and RAM disk support
- If you want to use ramdisk outside of the context of initrd then configure also:
Devices Drivers --> Block devices --> <*> RAM block device support (16) Default number of RAM disks (4096) Default RAM disk size (kbytes)
- increase RAM disk size if needed.
- rebuild the kernel image if config was changed:
$ make linux
Boot inird from U-Boot
BIOS> tftpboot ${loadaddr} ${board_name}-linux.bin BIOS> setenv bootargs console=${consoledev},${baudrate} root=/dev/ram rw BIOS> bootm
- If you have a kernel with device tree support (like on APF6), you have to load it before and boot it a different way:
replace previous "bootm" with: BIOS> tftpboot ${fdt_addr} ${cpu_type}-${fdt_name}.dtb BIOS> bootz ${loadaddr} - ${fdt_addr};
- bootm is when you have Linux uImage (U-Boot custom format) like on APF9328/27/28/51, bootz is when you have Linux zImage (compressed format) like on APF6.
May be a bit long, but it should boot ;-)
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.