An initramfs is a minimal root filesystem that is loaded at an early stage of the boot process, before the rootfs partition is mounted. This is optional but is now used by many Linux distributions such as Ubuntu in order to speed up boot time among others things.
Up to recently, there was no support for this in the AllWinner A10 nightly builds, and there would be lot of error messages due to ureadahead process with Ubuntu, but I’ve changed that by:
- Using a boot.scr file (U-Boot Script) for each supported device in order to either follow the default init boot method or do an initramfs boot if uInitrd file is present in the FAT partition.
- Adding a script (a1x-initramfs.sh) to generate and install uInitrd initramfs in the rootfs. The initramfs can’t be generated at build time since the hardware packs are (mostly) distribution agnostic. If you want an initramfs, you’ll need to run the script manually, as initramfs support is optional.
I mainly followed and adapted the instructions provided by Peter (j1nx) for boot.scr and the initramfs.
As an example, I’ll generate a Linaro ALIP (ARM Linux Internet Platform) 12.07 SD card for Mele A1000 with VGA output.
First let’s download the latest hardware pack from http://dl.linux-sunxi.org/nightly/latest/ in a Linux PC e.g.:
1 |
wget http://dl.linux-sunxi.org/nightly/latest/mele-a1000-vga_hwpack_2012.08.03.7z |
as well as a1x-media-create.sh script and Linaro ALIP 12.07 rootfs:
1 2 |
wget https://github.com/cnxsoft/a10-tools/raw/master/a1x-media-create.sh wget http://releases.linaro.org/12.07/ubuntu/precise-images/alip/linaro-precise-alip-20120724-274.tar.gz |
We’ve got all we need. Let’s create a bootable SD card the usual way:
1 2 |
chmod 755 a1x-media-create.sh ./a1x-media-create.sh /dev/sdb mele-a1000-vga_hwpack_2012.08.03.7z linaro-precise-alip-20120724-274.tar.gz |
Now let’s insert the SD card into the Mele A1000 and boot as usual. You should notice a lot of error messages:
1 2 |
[ 5.870000] init: Failed to create pty - disabling logging for job [ 5.880000] init: Temporary process spawn error: No such file or directory |
Those are due to the lack of initramfs, but are not critical. The boot from power to LXDE took 1m 8s.
I’ll run all the next command as root in the serial console, if you want to run those with a terminal window in LXDE as linaro user, simply run add “sudo”to the commands.
Let’s check the content of the FAT partition:
1 2 3 4 5 6 |
root@linaro-alip:~# ls -l /media/A9B2-DF2C/ total 3924 drwx------ 2 linaro linaro 2048 Aug 2 2012 LOST.DIR -rw-r--r-- 1 linaro linaro 835 Aug 1 22:28 boot.scr -rw-r--r-- 1 linaro linaro 42144 Aug 1 22:28 script.bin -rw-r--r-- 1 linaro linaro 3969832 Aug 1 22:28 uImage |
There’s the u-boot script, script.bin and the kernel image.
Time to generate the initramfs, simply run a1x-initramfs.sh:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
root@linaro-alip:~# a1x-initramfs.sh Make sure required tools are installed Reading package lists... Done Building dependency tree Reading state information... Done initramfs-tools is already the newest version. The following NEW packages will be installed: u-boot-tools 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/52.5 kB of archives. After this operation, 145 kB of additional disk space will be used. Selecting previously unselected package u-boot-tools. (Reading database ... 45631 files and directories currently installed.) Unpacking u-boot-tools (from .../u-boot-tools_2011.09-2_armhf.deb) ... Setting up u-boot-tools (2011.09-2) ... Mount the FAT partition Extract and copy kernel config to /boot directory Generate the initramfs update-initramfs: Generating /boot/initrd.img-3.0.38+ Make initramfs image for u-boot Image Name: uInitrd Created: Thu Aug 2 02:27:14 2012 Image Type: ARM Linux RAMDisk Image (uncompressed) Data Size: 1779255 Bytes = 1737.55 kB = 1.70 MB Load Address: 00000000 Entry Point: 00000000 Done. Reboot if you want to use the initramfs |
uInitrd file has been properly generated in the FAT partition:
1 2 3 4 5 6 7 |
root@linaro-alip:~# ls -l /media/A9B2-DF2C/ total 5662 drwx------ 2 linaro linaro 2048 Aug 2 2012 LOST.DIR -rw-r--r-- 1 linaro linaro 835 Aug 1 22:28 boot.scr -rw-r--r-- 1 linaro linaro 42144 Aug 1 22:28 script.bin -rw-r--r-- 1 linaro linaro 3969832 Aug 1 22:28 uImage -rw-r--r-- 1 linaro linaro 1779319 Aug 2 02:27 uInitrd |
Let’s reboot. All errors messages are gone and it just took 38s to boot to LXDE.
This script currently only support Ubuntu / Debian. Feel free to update it to support other distributions.

Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress