Linaro has a tool called linaro-media-create to install Linaro Ubuntu to an SD card by passing the device, hardware pack file, the rootfs and the board as arguments. Hardware packs are files that contains hardware specific binaries and configs files (e.g. bootloader, kernel…).
I’ve done something similar (albeit more basic) for AllWinner A10 devices so that you can easily install and run Ubuntu (and possibly other distributions) on an SD card. I’ve written 2 scripts for this:
- a10-hwpack-bld.sh – Script to generate evb.bin, build the latest u-boot and linux kernel, retrieve some config files and compress all this in an hardware pack file
- a1x-media-create.sh – Script to make a bootable SD card for AllWinner A10 devices.
You can get the scripts with git:
1 |
git clone git://github.com/cnxsoft/a10-tools.git |
I’ve only tested it with Mele A1000, but if you have other A10 devices such as MK802 mini PC or MINI X media player, it should also work. Installing Ubuntu on tablets should also be possible, but you’ll need to generate the hardware pack files and test it yourself. This is alpha and many things still need to be improved. (Update: I’ve just seen I forgot to enable Wi-Fi by default. Just run “depmod -a” to make sure 8192cu is loaded).
In the first section of this post, I’ll explain some details about the scripts, so If you’re just interesting in trying out Ubuntu 12.04, you can skip to the “Creating a bootable Ubuntu SD card for Mele A1000, MK802, MINI X…” section at the end of this post.
a10-hwpack-bld.sh Script
I wrote this script because a build server will be setup soon, and we should be able to get regular builds for u-boot & the Linux kernel (e.g. daily or weekly), without everybody having to build their own.
The build will clone the following repositories:
- https://github.com/cnxsoft/a10-config – Contains the fex files and some config files for the rootfs
- https://github.com/hno/uboot-allwinner – The recommended u-boot for A1X (v2011.09-sun4i branch for now)
- https://github.com/amery/linux-allwinner – The recommended Linux kernel (3.0.31) for A1X.
- https://github.com/cnxsoft/a10-bin – Binary files (now just Open GLES files) for armel and soon armhf
a10-config has the script.fex for the following devices:
- Mele A1000/A2000. 1 file for HDMI and 1 file for VGA and composite (display mirroring). This should also work for other A10 media player / mini PC such as MK802 and MINI X.
- A few EVB fex files – Extracted from leaked tools.rar
- Ainol tablet (tools.rar)
- BK7011 (tools.rar). I don’t know what this is.
- Onda M702(H6) and N507H5 tablets (tools.rar)
- Teclast T780 tablet (tools.rar)
- TVDEVEVB (TV Development Board?) (tools.rar)
a10-hwpack-bld.sh is run with the file name (without extension) of the fex files and calls fex2bin utility to generate script.bin (aka evb.bin). For example:
1 |
./a10-hwpack-bld.sh mele-a1000 |
The script will then build u-boot and the Linux kernel and generate the hardpack file which will be available in bld_a10_hwpack_${blddate}/${board}_hwpack_${blddate}.7z (e.g. bld_a10_hwpack_2012.06.12/mele-a1000_hwpack_2012.06.12.7z)
Subsequent calls to ./a10-hwpack-bld.sh will not build u-boot nor the kernel, but simply generates the hwpack file for the new device.
a1x-media-create.sh
a1x-media-create.sh will partition the SD card, format the partition, extract the hwpack file and the rootfs and copy all necessary files to create a bootable SD card.
It basically follows the instructions provided on How to Create Your Own Debian / Ubuntu Image for Mele A1000 page.
It is called as follows:
1 |
./a1x-media-create.sh sd_card_device hwpack_file.7z rootfs_file |
You can see examples in the section below.
Creating a bootable Ubuntu 12.04 SD card for Mele A1000, MK802, MINI X…
I’ll provide 2 examples:
- ALIP (ARM Linux Internet Platform) which is based on Ubuntu with Xfce desktop and with the application to access the net such as Firefox and Thunderbird. If needed, you can always use apt-get to install other applications. This is the one I use now.
- Linaro Ubuntu Desktop – The full Ubuntu 12.04 experience with the monthly Linaro release. This is not supposed to be as stable as the official Ubuntu released every 6 months, but still reasonably stable and you can test the very latest Ubuntu improvements.
The first time, make sure git and 7z are installed and download a1x-media-create.sh script:
1 2 3 4 |
sudo apt-get install git p7zip-full git clone git://github.com/cnxsoft/a10-tools.git cd a10-tools chmod +x *.sh |
1 |
./a10-hwpack-bld.sh mk802 |
Warning: If you use the wrong device in the instructions below (I use/dev/sdb as an example), you may completely wipe out your system, so use with care.
Here are the instructions to install ALIP 12.05 on an SD card:
wget http://dl.dropbox.com/u/45842273/mele-a1000_hwpack_2012.06.13.7z
wget http://releases.linaro.org/12.05/ubuntu/precise-images/alip/linaro-precise-alip-20120525-143.tar.gz
./a1x-media-create.sh /dev/sdb mele-a1000_hwpack_2012.06.13.7z linaro-precise-alip-20120525-143.tar.gz
and the instructions to install Linaro Ubuntu Desktop 12.05:
wget http://dl.dropbox.com/u/45842273/mele-a1000_hwpack_2012.06.13.7z
wget http://releases.linaro.org/12.05/ubuntu/precise-images/ubuntu-desktop/linaro-precise-ubuntu-desktop-20120524-177.tar.gz
./a1x-media-create.sh /dev/sdb mele-a1000_hwpack_2012.06.13.7z linaro-precise-ubuntu-desktop-20120524-177.tar.gz
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
I’ve just tried this for an MK802 with the ALIP option and for some reason the result does _not_ boot at all. The original Ubuntu image boots up just fine but I haven’t been able to create an image myself that would boot on the MK802, manually or automatically through your scripts. I’ve also tried to modify the evb.bin file to tell the MK802 to use 480p instead of 720p on the HDMI output (need to use it with a picoprojector that doesn’t support HD). For some reason, doing bin2fex and then using script.exe in Windows (fex2bin segfaults 🙁 )… Read more »
Hi, I have an MK802, which I’ve booted with the older mele a1000 image that’s been floating around. I was trying to upgrade the kernel and each time I do, I’m unable to boot after I replace the uImage and create a new /lib/modules/3.0.31+/ directory. I saw that you have a uImage and modules for 3.0.31+ in your mele-a1000_hwpack_2012.06.13. I just found this post and haven’t tried yours yet, but I was wondering if you could publish the kernel config you used to produce it? I’m concerned that the kernel I created was missing some module, or that I created… Read more »
root@ubuntu:~# ./a10-hwpack-bld.sh mk802
./a10-hwpack-bld.sh: 1: eval: pushd: not found
Build step failed!
fixed it by removing the ! at the beg of the script.. but now ./a10-hwpack-bld.sh: line 70: fex2bin: command not found
Excellent work there, I will be testing this out on the MK802, I’ll let you know how we get on.
Andy
Works get on my Mele A2000. Both ALIP and full desktop verisons. Thank goodness for ALIP as the full desktop is very sllow. However these do not on my mk802. On the mk802 all I get is an occasionally flash on the mouse. The original Ubuntu 10 does boot and work on the mk802. Thanks for your script. I now have a much newer version to explore.
@ Razvan Dragomirescu
There is no evb.bin in that image, it’s called script.bin, because u-boot source code default to that file.
It should be straightforward to change resolution to 480p, have a look at the fex guide in English:
http://dl.dropbox.com/u/65312725/Crane_Fex_Guide%20v0.4%20%EF%BC%88EN%29.pdf
@ Eric Betts
I used the default configure in github, check the script https://github.com/cnxsoft/a10-tools/blob/master/a10-hwpack-bld.sh to see how the kernel is built.
@ Chargher858
You need to install fex2bin or add it to your path. Cf http://www.cnx-software.com/2012/05/06/editing-allwinner-a10-board-configuration-files-script-bin/ for details.
Not sure why you add to remove “!”…
@ Robert
Do you have a USB to TTL debug device ? And do you feel comfortable opening MK802 to connect it ?
@Jean-Luc Aufranc (CNXSoft) No. Sorry, I do not have USB to TTL. I did open the mk802 as the microSD card does not line up with the case.
@ Chargher858
For mk802, you’d have to run:
./a10-hwpack-bld.sh mele-a1000
As I expected the same config and kernel to run on the Mele A1000 and MK802. But it does not seem to work for others (No MK802 to test it).
You may need to change the script.bin or the kernel config to disable SATA.
Regarding USB to TTL, has it been established where on the board the contacts for that are? I might be willing to purchase one and give it a try.
@ Eric Betts Some picture have been uploaded – http://lists.phcomp.co.uk/pipermail/arm-netbook/2012-May/004015.html And in one of the following post: > Maybe the 4 pins next to the a10 chip are a serial port? More than maybe. It’s very likely. The standard pins for uart0 are exactly next to there at the cpu edge. There is also a large group of test pads on the other side of the pcb. For order of the pins, you would have to try by error I think. The easy part is to find the GND with a multimeter, and for the other pins as long as… Read more »
@ cnxsoft
Scripts fail for me on ubuntu 12.04 with an error about pushd unless I remove the “!” from the first line
@ Chargerher858
Ok, I also use Ubuntu 12.04 but my shell was configured to be bash.
sudo dpkg-reconfigure dash
and answer no.
But If I move back to dash, I can reproduce the issue, removing “!” seems to work for both, so I’ll change this.
I don’t get this.
mele-a1000_hwpack_2012.06.13.7z contain mali armhf version of libraries/drivers or not?
And as much I know http://releases.linaro.org/12.05/ubuntu/precise-images/ubuntu-desktop/linaro-precise-ubuntu-desktop-20120524-177.tar.gz
is hardfp version of ubuntu
@ misko
For now, we only have armel binary libraries, so if you want to use Open GLES it won’t work with linaro releases.
If you want to test those an armel image is needed. (e.g. Ubuntu Core armel or an image generated with rootstock).
The image provided do not use hardware acceleration (and none of the binary libs provided in the hardware pack are used for now), which is probably why Ubuntu Desktop (unity) is slow, but ALIP runs more smoothly with a less demanding desktop envirnment (Xfce).
Hopefully, AllWinner will make armhf libs available soon.
For me the scrip fails. I’m getting the following output on ubuntu 12.04. :alexandru@ubuntu:~/a10-tools$ sudo ./a1x-media-create.sh /dev/sde mele-a1000_hwpack_2012.06.13.7z linaro-precise-alip-20120525-143.tar.gz [sudo] password for alexandru: Delete Existing Partition Table 1+0 records in 1+0 records out 1048576 bytes (1.0 MB) copied, 0.164962 s, 6.4 MB/s Creating Partitions Partition 1 – /dev/sde1 Partition 2 (Starts at sector No. 30720) Format Partition 1 to VFAT Format Partition 2 to EXT-4 mke2fs 1.42 (29-Nov-2011) Extracting HW Pack mele-a1000_hwpack_2012.06.13.7z ./a1x-media-create.sh: 77: ./a1x-media-create.sh: pushd: not found ./a1x-media-create.sh: 79: ./a1x-media-create.sh: popd: not found extracting Rootfs linaro-precise-alip-20120525-143.tar.gz ./a1x-media-create.sh: 85: ./a1x-media-create.sh: pushd: not found File Extension gz ./a1x-media-create.sh: 88: [: gz:… Read more »
@ Alexandru Stoian
I’ve just noticed my script will only work by bash, and fail with dash.
Changing !/bin/sh to !/bin/bash in the script fixes this
@ cnxsoft
Ok but
mele-a1000_hwpack_2012.06.13.7z is vfp
linaro-precise-ubuntu-desktop-20120524-177.tar.gz is hardfp
It can’t work
wget http://dl.dropbox.com/u/45842273/mele-a1000_hwpack_2012.06.13.7z
wget http://releases.linaro.org/12.05/ubuntu/precise-images/ubuntu-desktop/linaro-precise-ubuntu-desktop-20120524-177.tar.gz
./a1x-media-create.sh /dev/sdb mele-a1000_hwpack_2012.06.13.7z linaro-precise-ubuntu-desktop-20120524-177.tar.gz
@ misko
An hardfp rootfs can work with this method (on Mele A1000), it’s just it’s not using any of the libraries inside mele-a1000_hwpack_2012.06.13.7z as hardware accelerated X11 is not yet implement in any AllWinner A1X Linux distribution.
The command line commands you provided above works for me and a few other people on the Mele A1000. It fails on MK802, possibly because of SATA.
However, If you want to play with the OpenGL ES libraries present in the hwpack, you’re right that you’ll need an armel rootfs.
@ cnxsoft
Not working either with sh or with bash. Gives me the same error.
@ cnxsoft
ok than kernel and modules are hardfp in mele-a1000_hwpack_2012.06.13.7z
but mali drivers/libs are vfp in mele-a1000_hwpack_2012.06.13.7z ?
@ Alexandru Stoian
That’s weird. I’ve change the script again, you can try that.
If it still doesn’t work and you run Ubuntu, change the shell with:
sudo dpkg-reconfigure dash
and answer no.
and let me know the result.
If you’re not using Ubuntu let me know which OS you use, I’ll give it a try.
@ misko
I’ve noticed that with the Ubuntu 10.04 image released by Tom Cubie, I could use both armel and armhf rootfs.
The kernel and modules (kernel space) and rootfs (user space) seem to just communicate, but do not directly use each other files. That’s why an armhf kernel can be used with both armel and armhf rootfs. Somebody please correct me if I’m wrong.
I saw the issue you created for the hno/uboot-allwinner repository and I wondered if you’d tried processing the uboot image through https://github.com/hipboi/mksunxiboot ? Embedded systems are not my area, so I figure you’ll have a better idea of the relevance than I.
@ Eric Betts
I think the issue is being worked on. In the meantime, hno has reverted to the old working u-boot spl (with fat32 support). That’s what I’m using now. mksunxiboot is called in the Makefile, so there’s no need to call it manually.
Worked like a charm – i only had to change the shell from /bin/sh to /bin/bash in your a1x-media-create.sh script.
Otherwise the push, popd commands are not available.
I plan to use the Mele as a simple, cheap git repository device with a small energy footprint running in a different office (two location principle). We’ll see how it behaves. (I know it is not really the intended use case for the Mele but that’s life and i do not need a media thingy right now anyways).
FYI, https://www.miniand.com/forums/forums/2/topics/1
@ Alexander
Yes, using the old kernel 3.0.8+, it can work on MK802.
Does the WIFI work on the ‘linaro’ distro?
I can’t see in the output of ifconfig command
@ Claudio
Iyes, but I forgot to enable it by default. You need to open a terminal and run “depmod -a” or “insmod 8192cu”
@ cnxsoft
OK Thanks, i will test asap. The following commands still needs to be apply (for network access) or has been already fixed?
“sudo groupadd -g 3003 aid_inet
sudo usermod -a -G aid_inet ubuntu”
@ cnxsoft I edited and recreated the alip script.bin with sata=used = 0 Still no go on the mk802. Same behavior only the mouse lights up then off then on … repeat.
@ Claudio
Yes, this must have been fixed by disabling android paranoid network option in the kernel.
@ Robert
Thanks Robert.
For you want to try Ubuntu 12.04 on the MK802, you use the old Ubuntu 10.04 image and change the rootfs to Ubuntu 12.04 by following the instructions at http://www.cnx-software.com/2012/04/28/how-to-create-your-own-debian-ubuntu-image-for-mele-a1000-allwinner-a10-based-stb/, or more simply download the binary they made at https://www.miniand.com/forums/forums/2/topics/1
I’ll try top find somebody with a serial board on arm-netbook to find the issue on MK802 with the latest kernel.
How do you flash it onto the Mele? I don’t want Android, only proper linux.
Would I be correct in saying that the file system is locked down due to UFI? We need to partition at the base level, not within the OS. I haven’t researched much, but I can’t delete partitions on Mele and make on big section to parition again.
@ e8hffff
There’s no UEFI. It’s possible to flash Linux to the Mele or other A10 devices, just like they do firmware updates for Android. I just don’t know exactly how to do that yet. Some people on arm-netbook mailing list should know that, or hte instructions should be available on the net. Beyond the method for flashing, you’d also need to modified u-boot environment to point the rootfs to the right partition.
depmod -a seems not work. After reboot the 8192cu.ko module are still no in ‘lsmod’
only insmod /lib/modules/… works (i put into /etc/rc.local, but not the best solution)
@ cnxsoft
Well there is a limitation in deleting partitions and then restructuring their size while managing them from Linux booting off memory card slot.
I know you can set partition sizes when using LiveSuit in the image config files.
I’d like some to explain why there is the limitation and how to get around it. I’d prefer to have may two partitions, one the kernel and the other user space. Maybe a third for the low down boot.
@ Claudio
You need to ‘sudo modprobe 8192cu’ to add. modprobe -l can list modules.
If you want the module loading automatically then edit /etc/modules and at the 8192cu in a line.
@ e8hffff
I think the only requirement is to have U-boot SPL at 8K in the SD card, because that’s were the system look for it.
After that you are free to change the partition size, but you need to edit u-boot configuration.
There are already 2 partitions: one for the kernel and one for user space (rootfs). If you want a third one, you can modify the script or possibly run tools such as gparted (not tried).
@ cnxsoft Thanks but I’m talking about the mapping on the device, not the image that’s put onto the SDCard. Android on Allwinner SoCs usualy has about 7 partitions. It’s a real mess if you want to install proper Linux. In Linux, say using gparted you try delete the partitions and they don’t get placed into a pool to build a new partition. There is some underlying structure that’s locked and can only be setup at flash time. I’d like to format the partitions on the device and copy over the system over to new partitions using cp -Rp /*… Read more »
@ e8hffff
Oups… sorry I misunderstood your comment. I’m not sure how it’s done yet. In some other projects i worked on, the partition table was hardcoded in the kernel, and the only way to change that was to change the code and rebuild the kernel. I wonder if it could be the case here.
You’d better ask on http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook or in IRC #arm-netbook, there are some clever people over there very familiar with AllWinner A10, even an AllWinner employee lurks there.
Dunno if could be useful:
http://lists.phcomp.co.uk/pipermail/arm-netbook/2012-May/003487.html
Can’t see what that guy rewrite/hack and how…
@ Claudio
Yes this is on topic. I’m not sure if I’d accept the partition management is handled by a driver as that would require a layer/ring and cpu time.
From experience with tinkering with roms for my Ainol Elf, the partitioning is carried out at flash time with Livesuit. One file contains a structure list of how to partition with leftover being auto to user space. There must be some sort of direct orchestration to the memory manager chip to perform the partitioning, then the partitions are visible to the system. All guesses.
The Linaro distro seems to be slowly then the one provided by Tom (ubuntu gnome).
Could be a 3.0.31+ kernel issue, armhf issue or distro one??
@ Claudio
My guess is that it’s because of Unity… If you use ALIP it’s much faster.
Once an Open GLES X11 is ported to the platform Ubuntu Desktop should be faster.
On Topic;
Someone needs to create a script to installs any image on a SD to the main memory of an AllWinner Soc/CPU. This will be a vital part in making successful Linux use on ARM devices, as it will mean inherent boots, no memory card hanging out side. It will also promote devices sold with Linux not Android by resellers.
@e8hffff
From recollection i think there is a bug in the wear levelling code on the device that needs to be sorted as well …
for me though if i can get to a nice headless debian armhf distro running on a fast sd card with gpu disabled and wifi/bluetooth as well giving me as close to 512MB RAM as possible I will be well pleased
@ mac me
An armhf debian server distro with a maximum amount of RAM is a low hanging fruit… I think instructions to do that are already available somewhere in Rhombus Tech Wiki. Not sure about Bluetooth however.
I got an image created for the odys xelio (for hw see: http://www.android-hilfe.de/odys-xelio-forum/224122-odys-xelio-hardware-technik.html ) using evb.bin. Wireless, Sound and Screen work. As do External usb devices.
However, I don’t get evdev to use the internal keys or touchscreen.
Any ideas about that?
ft5x-driver is loaded..
@ Ar Isel
I don’t know the answer to your issue, but could you provide your evb.bin or evb.fex either via github (https://github.com/cnxsoft/a10-config) or a link? If you changed anything else (e.g. kernel config) did you document it somewhere ?
evb.bin is here: http://www.filejumbo.com/Download/2260B22FF7E99A02
as for the rest: I just used your scripts, set the first partition to bootable and did a depmod.
I installed wicd since the network configuration didn’t want to work out of the box.
Is there someone hwo want to make an bootable Ubuntu 12.04 SD card for MK802 and sell it to me?
Hi
I really want know how this whole process can be done ,i have no knowledge of linux.
At beginning i thought this was done in command prompt in windows, then i notice command is linux.
Can some one show me step by step….. i have MK802…..is there img ready that I can just drag to SD and boot off straight away?
@ Peter Nordstrom
Images are available online using an older kernel. Images based on the latest kernel, do not work on MK802. This can be easily fixed, but I don’t have hardware.
Could we use the same steps described here:
http://www.cnx-software.com/2012/06/18/mele-a1000a2000-android-4-0-image-released/
to flash the NAND with a Linux distro image?
@ Claudio
In theory yes, but I don’t think such image is available yet.
I did install both on my 7″ tablet unfortunately usb to otg mini usb port didnt work on both.
@ zmaj
Which tablets did you try and using which config (script.fex)?
Hello, First, thank you very much for the tuto, that’s a nice work. I have a Teclast P85, very close from the T780 in terms of hardware and wanted to use your Hardware pack builder but I got several problems: 1/ illegal character in t780.fex at line 1091 >Fixed: I retrieved the file, replaced a : by a ; and modified ./a10-hwpack-bld.sh to read the file locally instead of from the GIT 2/ error at line 69: try patch -p1 Fixed (i Think): I retrieved u-boot-rootwait.patch from a10-config and modified a10-hwpack-bld.sh to read the file locally 3/ Then, I have… Read more »
@ Olivier Piau
There’s a log file in bld_a10_hwpack_${blddate} directory, you can have a look at it first.
Maybe it’s because arm-linux-gnueabihf-gcc is not installed on your machine.
If you know how to use github, you could do a pull request for t780.fex.
I’ve added mk802.fex to github, and I’ve been told it is the only thing to modify to make it work.
Hi, you’re mixing armel from github.com/cnxsoft/a10-bin with cross_compiler=arm-linux-gnueabihf-
@ hackandfab
Yes, I’ll have to change that since we now have armhf libs.
I’m still having problems with the fex2bin even later then followed the steps of installation that you’ve mentioned before.
line 22: fex2bin command not found.
I`ve downloaded the sunxi-tools and followed the steps, and ran without problems.
I’ve created bootable sd card (nano 12.05 and mele-a1000), but my tv box(based on allwinner a10 – cortex a9 – AML8726M) doesn’t boot from card. It boot android.
How can I set this hardware for dual boot?
@alex
Is your device based on AllWinner A10 or AMLogic AML8726M? This only works for A10.
Hi, could you take a look at this: http://forum.a10linux.org/read.php?3,74
I used only your a1x-media-create.sh because I already had all the files needed for the hwpack. They work with Debian.
(Touchscreen works with multi-touch disabled in drivers/input/touchscreen/ft5x_ts.h)
Only boot.scr might be problematic. But I guess this is more of a kernel space problem …
Hey,
thanks for this thing.
When i m executing ./a10-hwpack-bld.sh mele-a1000. I am not able to get the 7z file. Following is the error in the log file.
cp: cannot stat `uboot-allwinner/spl/sun4i-spl.bin’: No such file or directory
Build step failed!
I bought a liliput touchscreen monitor and the mk802 ii and the ug802, but there is a problem with the input coordinates. When you move your finger down the screen, you see the mouse move to the left When you move your finger to the left, you see your finger move down the screen. An usb mouse works fine, but the touch screen input coordinates seem to be messed up. So I’m recompiling android ICS to try to boot it as is on either the ug802 or the mk802 ii. Then once I get my image booting, I’m going to… Read more »
Hi, guys. I have Mele A2000G – it’s mele A2000 with 1024Mb RAM. Involved only 512 MB 🙁 How to use the entire RAM
LiveSuit kitchen ublaze.ru for linux (Slackware) Unpack and pack Allwinner img
Screenshot http://i.pixs.ru/storage/3/1/8/port2png_7398383_12772318.png
Download kitchen https://cloud.mail.ru/public/513f69b27c23/livesuit_kitchen_ublaze.ru.tar.bz
How to use it look at my article http://ublaze.ru/allwinner-img/ (Russian)