J1nx

YOU CAN DO IT CHEAPER YOURSELF.
  • Home
  • Articles
    • [DiY] Home (Personal AI) Assistant – BLOG series
    • [DEV] MycroftOS – A bare minimal OS based on Buildroot
  • Projects
    • [DIY] Home (Personal A.I.) Assistant – Project Page
    • [HACK] Installing HassOS on the Homey
    • [DEV] MycroftOS – Buildroot OS for Mycroft A.I.
  • Patreon
  • Contact
  • Home
  • Articles
  • ICT Matters
  • ARM
  • Initramfs support for Linux-ARM (Allwinner A10)

Blog

Wednesday, 09 November 2016 / Published in ARM, Embedded, ICT Matters, Linux

Initramfs support for Linux-ARM (Allwinner A10)

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.


 

BE AMONG THE FIRST..
I agree to have my personal information transfered to MailChimp ( more information )
Be among the first to get access to all the latest information, tutorials and how-to's by joining the newsletter email list.
We hate spam. Your email address will not be sold or shared with anyone else.

Share this:

  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Telegram (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Skype (Opens in new window)
  • Click to email a link to a friend (Opens in new window)
Tagged under: ARM, ICT-Matters, Linux

What you can read next

Ordering some Goodies
[DEV] MycroftOS – A bare minimal OS based on Buildroot – PART 5
[DiY] Home (Personal AI) Assistant (HASS / GA / Alexa / MyCroft) – PART 1

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • ReSpeaker 4-Mic Array HAT Mycroft A.I. Skill

    A while ago I created a Mycroft A.I. skill for ...
  • [DEV] MycroftOS – A bare minimal OS based on Buildroot – PART 5

    It has been a while once again since the last u...
  • [Update] Busy, busy, busy….

    Holy crap ! The last blog post here is already ...
  • [DEV] MycroftOS – A bare minimal OS based on Buildroot – PART 4

    A first (very) early alpha release is ready. St...
  • [Update] My plans for 2019

    It has (again, yeah I know) been a while since ...

Categories

  • ARM
  • DIY
  • Embedded
  • Home Assistance
  • Home Automation
  • Homey
  • ICT Matters
  • IoT
  • Linux
  • MyCroft A.I.
  • Project 1
  • Project 2
  • Project 3
  • Smart Speaker
  • Website News

Tags

A.I. Adapt Alexa ARM Bootsplash Buildroot chroot crosscompiling DeepSpeech DIY Embedded Google Assistance Google Home HASS HDMI Home Assistance Home Automation Homey ICT-Matters IoT Kodi Linux Mimic Multimedia MyCroft A.I. News Padatious Precise Raspberry Pi Raspbian ReSpeaker RPi Skills Smart Speaker sourcecode Webkit WPE

PETER STEENBERGEN

Born on the 25th of July 1978 in Leiderdorp - The Netherlands. A "geek" who is working 15+ years in the Oil & Gas industry. As a result of that, visited many parts of the world. His strong affinity with ICT matters has earned him certain online recognition and got him involved in multiple interesting projects. Was a co-founder of "The Little Black Box", a multimedia streamer based on XBMC / Kodi. A device that was brought available to big retail shops in the Netherlands such as MediaMarkt, BCC and many big online webshops as bol.com as an end result.

WEBSITE

  • Articles
  • Projects
  • Patreon
  • Our Policy
  • Contact

FOLLOW

  • Facebook
  • MeWe
  • Patreon
  • Github
  • Youtube

© 2018 J1nx | All rights reserved.

TOP