The ODROID-N2 is a single board computer of Hardkernel, which is released on Feb/2019 and that runs with Amlogic’s S922X (4xA73@1.8GHz and 2xA53@1.9GHz). One of the new features on the ODROID-N2 is SPI flash memory of 8MB. Obviously, onboard SPI flash memory is not a new technology at all and some SBC already has it to be used for a certain purpose. Usually, the SPI flash memory has a bootloader and loads OS image from larger storage like uSD or USB storage.
The SPI flash memory on the ODROID-N2 can be bootable and 8MB is a pretty large space for a bootloader which is usually under 1MB. Besides it’s very small for the Linux kernel image which is usually 8~9MB for the compressed image for ODROID-N2. We want to improve the usage of the small storage rather than just install a bootloader.
There have been many demands to manage multiple OS and many SBC users had tried to run multiple OS installed in eMMC, uSD and USB storage, many instructions were introduced with a script or Linux commands as well. Many users succeed with it but the instructions are not simple for users who are not familiar with Linux system. We want to help new users who wish to use two OS but having trouble to set up multiple OS environments.
For the two reasons above, I and my workmate Joy started to study the Petitboot which is an operating system bootloader based on Linux kexec. We had to struggle to build a complete image to fit in 8MB, specifically, we had to customize the Linux kernel in order to reduce size smaller than 3.8MB which more than half of the generic Linux kernel. At the same time, since Petitboot is an application running on Linux userspace, we had to build a tiny root file system fit in 3.2MB. Otherwise, we were not able to fit the whole tiny Linux system into 8MB. Here is the memory map of the image to boot Petitboot in 8MB.
After jumping multiple hurdles, we’ve successfully built the bootable tiny Linux system including U-boot in 8MB and ODROID-N2 can run Petitboot from SPI flash memory. But the first version just displayed the Petitboot menus and boot entry manually configured for an OS since there were supported boot formats such as Grub or PXE boot which were not supported by ODROID-N2.
Since I wanted to help users to boot an OS without any efforts for setting up, I had to add a component which can recognize the OS image contributed by many open source community. All OS images for ODROID SBC has a special boot script a.k.a boot.ini that contains the bootloader commands what the bootloader set the kernel parameters, which kernel must be loaded and so son. Otherwise, a user has to learn the new boot config format for the Petitboot and assign the boot files manually.
I’ve written the code to parse the file boot.ini time to time and I was able to make Petitboot read the OS image from attached storages of ODROID-N2 and show up to the display such that user can select a boot entry using a USB keyboard attached or IR remote. I believe that this is big progress allows user can easily select an OS within installed and attached to ODROID-N2.
I’ve also managed the version of Petitboot for ODROID-N2 intensively on June and eventually, I was able to fix the major bugs and improved more features which were usually done by U-boot in order to boot an OS. Still, it’s not perfect yet. Because I am not able to fully occupy myself to Petitboot task and lack of capability, the current Petitboot is not fully functioning as much as I expected and dreamed but it will be improved and released from time to time.
The current version can do:
- Recognize different OS images from open source community as is, which means ideally you are able to boot the OS images as booted from eMMC or uSD slot without any change on it. (Exceptionally, I’ve discovered that Armbian has changed its file system structure, a bit of change is required.)
- Easily can boot from USB storage. Many SoC for SBC does not boot from USB storage other than uSD or eMMC and this is the same on ODROID-N2. ODROID-N2 is more capable to boot from USB easily selecting the boot entry of USB storage rather than using a command line.
- Boot device order can be set in the menu, you can choose uSD as a first priority boot media or USB.
- Boot automatically to the high priority booting media in seconds unit.
- The boot configuration must be stored into uSD, which is awkward. This is because of the limitation of SoC feature but keep thinking of a workaround.
- Still, this is WIP project and having some issues working in the legacy booting from uSD or eMMC. Because some of the work which was done in U-boot is moving to Petitboot and all features are not moved and compatible yet.
- Boot from network media such as PXE is not supported but had put into my TODO list.
- Not offering fancy UX due to the small capacity of SPI flash memory, 8MB is the edge to store the mandatory blobs only.
- And…more… :)
I was happy to see more users are trying to use the Petitboot on their ODROID-N2 and many of them are happy with it since they are able to boot an OS for a different purpose. Here is the link of the Petitboot running in the ODROID forum and I will keep updating the version whenever I have. https://forum.odroid.com/viewtopic.php?f=182&t=33873.
Thank you for reading and have fun with ODROID.