linuxembedded-linuxrootfs

Buildroot to load full rootfs into Ram


I have an Arm based embedded board. Currently the RootFS is squashfs. I am still in the development phase. My current workflow is:

  1. Make changes in the development machine.
  2. Create new Root FS image.
  3. Burn the image to the flashdisk in board.
  4. Reboot and test the changes.

As you see the above workflow is not efficient. It wastes a lot of time to create a full image of the FS, while only minor changes in my application or some scripts in the FS is required, burn the image and reboot.

I know that I can create Initial Ram Disk, to hold the RootFS, I have picked that option in buildroot, and the build is done.

Now I am a bit confused what should I burn in the board? And would that suffice to avoid the whole rebuild, burn, reboot cycle in the development.

I know I will need to burn the image at the end to persist in the board, but I just want to burn a one final image after I make sure my changes are working.


Solution

  • This does not allow you to burn smaller parts. You still need to copy full image to the memory on the device. There's a workaround: use networking facilities in U-Boot, i.e. tftpboot, download image in memory and run it on board.

    Here is the example for one of PowerPC board:

    nb_load=dhcp;run nb_load_dtb;run nb_load_vmlinuz;run nb_load_initrd
    nb_load_initrd=tftpboot 0x1900000 /mybooklive/initrd
    nb_load_vmlinuz=tftpboot 0x1000000 /mybooklive/vmlinuz
    nb_load_dtb=tftpboot 0x1800000 /mybooklive/apollo3g.dtb
    nb_boot=setenv bootargs ${nb_bootargs}; run nb_load; bootm 0x1000000 0x1900000 0x1800000
    nb_bootargs=console=ttyS0,115200n8 ignore_loglevel
    

    To boot run run nb_boot in U-boot command line.

    Basically you need kernel image, initial ram disk, and device tree blob (in case you choose to not compile it in the kernel).

    Here is another example of U-Boot options for Intel Edison board to boot from eMMC:

    setenv boot_edsboot 'zboot 0x100000 0 0x3000000 0x1000000'
    setenv bootargs_edsboot 'console=tty1 console=ttyS2,115200n8 rootfstype=ramfs rw'
    setenv bootcmd_edsboot 'setenv bootargs ${bootargs_edsboot}; run load_edsboot; run boot_edsboot'
    setenv load_edsboot 'load mmc 0:9 0x100000 vmlinuz.efi; load mmc 0:9 0x3000000 initrd'
    

    To boot run run bootcmd_edsboot in U-Boot command line.

    Full article is here.

    It's obvious you need to get correct files (DTB) and addresses according to board you possess.