Home > AllWinner A1X, Linux > AllWinner A10 Initramfs Support and Linaro 12.07 Image

AllWinner A10 Initramfs Support and Linaro 12.07 Image

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.:

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:

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:

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:

[    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:

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:

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:

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.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

  1. August 4th, 2012 at 02:38 | #1

    Great job!

    Is this now also included into the build server?

  2. e8hffff
    August 4th, 2012 at 05:58 | #2

    Has anyone yet got the build to write to the internet memory? I’m not that interested running off a SD.

  3. August 4th, 2012 at 09:23 | #3

    @ j1nx
    Yes, the example I showed is based on an image generated on the build server.

  4. August 4th, 2012 at 09:25 | #4

    @ e8hffff
    There are some instructions for that – https://www.miniand.com/forums/forums/2/topics/73

  5. August 4th, 2012 at 20:41 | #5

    ok, well done.

    Does ureadahead also terminates at the end of the boot? The errors are gone but I still had ureadahead terminating at the end of the boot process.

  6. August 5th, 2012 at 09:24 | #6

    @j1nx
    Same here
    [ 5.430000] init: ureadahead main process (158) terminated with status 5

    I found some at thread with that problem – http://ubuntuforums.org/showthread.php?t=1423305

    and

    ureadahead –dump
    ureadahead:/var/lib/ureadahead/pack: No such file or directory

    This could be the reason. I won’t have time to check this right now as I’ve just received another very interesting board…

  7. August 5th, 2012 at 14:02 | #7

    I saw that thread indeed. Will look into it again after the holidays. Disabled ureadahead, because it is meant to lower the disk access times anyways.

  8. August 5th, 2012 at 14:05 | #8

    Oh and I think I have a very good idea which board you are looking at ;). Hope to see a review soon :-D

  9. August 5th, 2012 at 14:08 | #9

    @j1nx
    There’s something on the front page now which should give you a clue, or maybe that’s what tipped you :)

  10. e8hffff
    August 6th, 2012 at 16:36 | #10

    @cnxsoft

    Many thanks. I’m working on other projects, but would have loved to look into using LiveSuit to write an Linux Image a while back. The other day I spent some time catching up on how to use adb and fastboot to manage Android devices. I’m just way behind the mark compared to others in this field.

    I really hope those that make Linux images use something like PPA’s or repositories to keep systems up to date.

    Thanks everyone!

  11. nklh
    August 9th, 2012 at 05:37 | #11

    Boot in less than 20seconds using HDMI hwpack, Linaro’s precise alip and a 16GB Class10 SDcard : very fast but didn’t find how to change locale or at least layout for keyboard.

  12. August 9th, 2012 at 09:06 | #12

    @nklh
    There must be an option in the GUI, but sure where. This is basically Lubuntu so there must be some doc somewhere.
    Using the command line

    sudo dpkg-reconfigure console-data
    sudo dpkg-reconfigure locales

    should work.

  13. August 9th, 2012 at 09:07 | #13

    @nklh
    You might even make that closer to 15 seconds by removing the 3 seconds delay in u-boot and specifying the rootfs file system in u-boot.

  14. nklh
    August 10th, 2012 at 23:09 | #14

    @cnxsoft
    ok, I’ll try but linaro’s alip seems to have a “weird” lxde. it’s very different from Lubuntu’s Desktop version that I use through a VM, although I’m not a Linux Power User. Not afraid of command Line but a GUI is far away effortlessly accessible.

    Meanwhile, I switched to linaro’s ubuntu Desktop but It’s obviously to heavy to be usable without graphic acceleration (I assume isn’t supported yet?), very laggy, freezing sometime (mostly everytime) and also I definitively hate unity :D.

    thanks, for helping, I started to tweak mele’s android config files to switch for a full french azerty keyboard but was not able to do the same under Alip, I’ll try harder :D

  15. nklh
    August 11th, 2012 at 09:51 | #15

    @cnxsoft
    finally , nothing seems worked with linaro’s alip.

    so :
    -I switched to Linaro’s ubuntu desktop version (hdmi hwpack 2012.08.09 build)
    -Installed lxde through apt-get
    -Added “setxkbmap -layout fr” at end of .bashrc

    it’s a lot smother now.

    Sometimes, the mele don’t achieve boot and the screen don’t switch on if the ethernet cable is connected (I assume it’s that because the ethernet activity led blink a lot) but maybe it’s due to my ISP adsl box.

    And also it don’t let me shutdown it through GUI (command line are salvation )

  16. Pawel
    August 31st, 2012 at 03:01 | #16

    Hi, I have my first Android box (mele a2000). I tried this instruction, everything ended with success, but when mele is booting it stops logging after “Starting kernel …”, sometime is logged 1-5 lines more. I used 3 different SDHC 4GB cards without success. Did someone have the same problem and knows solution?

  1. No trackbacks yet.