If you use any of the ubuntu based distributions out there you might want to make use of Initramfs support for the Allwinner A10. Using a initramfs solves a lot of errors related to boot profilers such as ureadahead. Secondly you are able to load kernel modules soon in the boot process, hence the reason why I investigated this aspect.
For the Linaro build that I am creating I wanted to have a nice boot splash. (Also wanted for OpenELEC) Although I knew about the current issues we have with the framebuffer console, I was hoping I could bypass this error by graphicalize the console and draw the splash on top of it. (This is sort of how the boot splash works) However it appears to be not that easy. I will still continue developing this, but as I am about to realse the first alpha version of my Linaro build I wanted to share the knowledge about the initramfs support for the Allwinner A10 as well.
Create the initramfs file
To make use of the initramfs you need to have u-boot load the initramfs file into memory and boot it together with the kernel. You can do this by changing the default parameters of the u-boot sources, but then when you want to switch between using it and not you need to flash the new binaries again and again to the SD card. It is easier to set up your u-boot environment to make use of the boot.scr files You then only have to change the boot.scr file to change the way of booting. This is nice because you need to create the initramfs from within the native device. You therefor first has to boot it without initramfs, create the initramfs, change the boot.scr file and then reboot for it to make use of it.
So let’s boot into your device with the boot.scr file support. Then at the command line copy over your used kernel configuration file to the /boot directory called config-<kernel version>
cp .config /boot/config-'uname -r'
The update-initramfs system will search for it at that place with that name. Now go into the /boot folder and give the following commands to generate the needed uInitrd file which can be loaded by the u-boot system.
update-initramfs -c -k `uname -r`
mkimage -A arm -T ramdisk -C none -n "uInitrd" -d /boot/initrd.img-`uname -r` ./uInitrd
The first one generates a “/boot/initrd.img-<kernel version> file and the second converts that file into a loadable image file for u-boot. I called the file uInitrd as that appears to be the default for Linaro.
Load the uInitrd file at boot time
Now we have an uInitrd file, we also would like to boot with it. We need to adjust our boot.scr file to also take the initramfs into account. Read about my previous post of how to change boot.scr files, but make it look like the following;
setenv console 'ttyS0,115200'
setenv root '/dev/mmcblk0p1'
setenv panicarg 'panic=10'
setenv extra 'rootfstype=ext4 rootwait'
setenv loglevel '8'
setenv setargs 'setenv bootargs console=${console} root=${root}
loglevel=${loglevel} ${panicarg} ${extra}'
setenv kernel 'boot/uImage'
setenv boot_mmc 'ext4load mmc 0 0x43000000 boot/script.bin; ext4load
mmc 0 0x48000000 ${kernel}; ext4load mmc 0 0x43100000 boot/uInitrd;
bootm 0x48000000 0x43100000'
setenv bootcmd 'run setargs boot_mmc'
Of course change the ‘root’ parameter if your rootfs is on the second partition. Change the ‘kernel’ parameter to the right path if you have it somewhere else (FAT) and finally change the path/file to the uInitrd as well if needed (still need to see which variable we can use for that one). Above code is based on using just one big EXT4 partition having the kernel, uInitrd, boot.scr and script.bin all inside the /boot/ directory. If you have it somewhere else you need to alter it a little bit, but nothing difficult about that. Be aware that I am using the ‘ext4load’ command. You can only use that by booting of an EXT4 partition using the EXT4 supported u-boot binary files from the download section (or have patched and compiled it yourself with EXT4 support). Change it to either ‘fatload’ or ‘ext2load’ accordingly on which file system type your kernel and initramfs are placed.
Place the boot.scr and uInitrd files at the right place (usually besides the kernel and script.bin) and reboot the device. It should now load the uImage and uInitrd into memory and boot with boot of them.
Do you like what you just read? Keep me going by donating on Paypal or become a Patron.