Building Petitboot

The Petitboot image is a complete set of minimal Linux system, and its software modules are ported to Buildroot. Therefore, Petitboot image can be built with the same instruction as Buildroot when its build configuration is selected.

The Buildroot source tree can be downloaded with the same branch of ODROID-N2's release branch, aml64_buildroot_master. This page, Buildroot, introduces how the Buildroot source tree can be downloaded and set up the building environment.

odroidn2_spibios_release the build configuration to build Petitboot image in the Buildroot source tree.

$ source buildroot/build/ odroidn2_bios_release
$ make

Once the building is completed, many files are dropped into the directory output/odroidn2_bios/images, but only two files sdcard.img and spiboot.img will be used to boot and update Petitboot.

$ ls output/odroidn2_bios/images/
Image.gz     boot.ini       boot.vfat               rootfs.cpio     rootfs.cpio.uboot
rootfs.ext4  rootfs.tar.gz  spi-update.img          spiboot.img     u-boot.bin
boot.cmd     boot.scr       meson64_odroidn2.dtb    rootfs.cpio.gz  rootfs.ext2
rootfs.tar   sdcard.img     spi-update.vfat         spiupdate.cmd   uImage

sdcard.img vs spiboot.img

  • The image sdcard.img is the bootable SD card image on ODROID-N2, this image is aimed to fully update the SPI flash memory on the board. As soon as the bootloader from SD card is loaded, ODROID-N2 will start to update the SPI flash memory and reboot once updating is completed.
  • Another file spiboot.img is the file which is to be flashed into the SPI flash memory. Its size is always 8MiB which is the same amount of the SPI flash memory on ODROID-N2.

If SPI flash memory is empty or corrupted, even you are not sure, the flash memory can be updated with sdcard.img. In this case, boot selector switch must be placed to MMC in order to select the first boot media as SD card.

IF SPI flash memory is already running and needs to be updated with a newer version, simple copy spiboot.img to the file system of the first partition on SD card. Then Petitboot in SPI flash memory will load and update it by itself.