Rescue System 1.2
August 03, 2012 10:53PM
I've created a bootable rescue system for the A10. When this image is written to an empty flash card, it will use the first 32MB of the card for uBoot and a 31MB FAT32 partition (I'll refer to this as the sysconfig partition). The sysconfig partition contains the uboot environment and a /rescue directory containing a basic system.bin file, boot images, autorun scripts, and network configuration files for the rescue system. The included uBoot is configured to boot both the rescue system and any other systems that can be found on the SD card. This way, you can use the remaining space on the SD card for a linux installation.


Installing the rescue system
wget http://download.doozan.com/a10/a10_base-1.2.1.zip
unzip a10_base-1.2.1.zip
insert flash drive
dmesg
find drive id (sdb, in my case, using a USB SD card reader)
double check that it's the drive you're expecting to be:
fdisk -l /dev/sdb

Disk /dev/sdb: 7948 MB, 7948206080 bytes
245 heads, 62 sectors/track, 1021 cylinders
Units = cylinders of 15190 * 512 = 7777280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x5d02e879

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        1021     7754464    b  W95 FAT32

Yup, that's my 8GB SD card. I've copied everything I need off of it, which is good because the following dd command is going to wipe out the partition table:

dd if=a10_base-1.2.1.img of=/dev/sdb bs=4096

fdisk -lu /dev/sdb

Disk /dev/sdb: 7948 MB, 7948206080 bytes
245 heads, 62 sectors/track, 1021 cylinders
Units = cylinders of 15190 * 512 = 7777280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x5d02e879

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048       63489       30721    b  W95 FAT32


alternatively, you can write the image using Windows with this program, making sure that you unzip the file first:
https://launchpad.net/win32-image-writer

Configuring the rescue system

If you're using a device with a wired network port, make sure it's attached to your network. No other configuration is needed.

If you're using a device without a wired network port, you'll need to configure the rescue system so it can connect to your wireless network. On the sysconfig partition, inside /rescue, you'll find two files named 'interfaces' and 'wpa_supplicant.conf' Depending on the type of security used on your wireless network, you will need to edit one or both of these files.

No matter what security you're using, you need to edit 'interfaces' so open that in your favorite editor (Windows users, make sure you're using an editor that respects UNIX line endings, such as Notepad2). Uncomment the two lines starting with "auto wlan0" and "iface wlan0" and then uncomment the section that corresponds with your security. If you're using Open or WEP encryption, you're done. If you're using WPA or WPA2, you'll also need to edit 'wpa_supplicant.conf'


Using the rescue system

On boot, the rescue system will search for and run any files matching the pattern init-*.sh and autorun-*.sh. It will also extract any files matching the pattern init-*.tgz and autorun-*.tgz and then run the extracted autorun.sh script. Init scripts are run just after the partitions have been mounted but before any network initialization. Autorun scipts run after everything has settled down. You can use this to write hooks to automate recovery or installation procedures.

The default rescue system comes with two init scripts:

init-extract-system-bin.sh - This script will attempt to extract the hardware configuration file from the android nand and patch it with the MAC address extracted from the android uboot environment.
init-modules.sh - This script will parse the system.bin file. If your device's system.bin lists an ethernet port, the module wil l be loaded. If no ethernet port is detected, the 8192cu wireless module will be loaded.

There is also one default autorun script:
autorun-deviceinfo.sh - This script will dump some helpful system debugging information to /log/deviceinfo.log on the sysconfig partition. If you're running a device that is not fully supported by the rescue system, this file can help us to add support for your system.

On boot, the rescue system will fill the default display (HDMI or LCD, depending on your device) with a light blue/grey color to show that it's "on" Until the fbcon module is fixed, there's not way to use the default display as a terminal, so you'll need to use SSH to connect to the rescue system.

Let's try it out
Turn off your system, insert the SD card and boot it up. If it boots into android, you may need to power-cycle again. I find that my mele a2000 alternates between booting from NAND and MMC with each power cycle.

Now that the device has booted, you'll need to find its IP address (check your router's DHCP log). Once you've got the ip, go ahead and connect with SSH:

ssh root@192.168.0.2 (use the ip address that you found here)

the root password is 'root'

[root@rescue ~]# uname -a
Linux rescue 3.0.36 #1 PREEMPT Fri Aug 3 22:30:56 EDT 2012 armv7l GNU/Linux

It works! You're in! This is a simple linux environment with just enough tools to help you restore or recover a broken system. It can also be used as a sane environment for installing your favorite linux distribution. See the Debian install post for more details.

Additional init/autorun scripts are available in the a10-rescue-scripts repo.



Edited 1 time(s). Last edit at 08/11/2012 10:04AM by Jeff.
Building the Rescue System 1.2
August 03, 2012 10:53PM
I've added some scripts to make building the image easier.

cd ~/src
wget http://buildroot.uclibc.org/downloads/buildroot-2012.05.tar.gz
tar -xzvf buildroot-2012.05.tar.gz
cd buildroot-2012.05
git clone https://github.com/doozan/a10-rescue.git custom
cd custom
git checkout v1.2
cd ..
cp custom/buildroot-config .config
make

sudo custom/make_image.sh
Re: Building the Rescue System 1.2
August 09, 2012 09:51AM
The first three characters in the interfaces file are missing, it begins like this:
onfigure Loopback
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

It was keeping dhcp from obtaining an ip address.

Another issue for me is that rebooting is successful only about half of the time on my Mele. I must then unpug/plug for it to boot again.
Re: Rescue System 1.2
August 11, 2012 10:05AM
Thanks for pointing that out, for some reason it was right in the repo but wrong on my working copy. I've rebuilt the image and uploaded it as 1.2.1.
Re: Rescue System 1.2
August 12, 2012 07:54AM
I am new to the A10 system and I wonder if this rescue image can assist me in installing Debian on the NAND-disk of my MeLe A1000?
I have successfully booted a Debian image from SDHC, but unfortunately there is no way for me to access the NAND. :(

Thanks.
Re: Rescue System 1.2
August 12, 2012 11:49AM
You should be able to do that. I haven't tried it myself.

The nand partitions show up in /dev as nanda through nandh and if you don't want to alter the partition table, you can just install debian to whichever partition is largest and configure uboot to load from that device.
Andrew
FBCON driver fixed by pull request 66?
August 21, 2012 03:15PM
Jeff, thanks for this rescue system, I used it today to confirm that a set top box I thought I had just bricked was still alive.
Just wanted to mention that apparently somebody got down to working on the FBCON kernel driver. You may want to merge his patches with your A10 kernel tree and try it with your rescue system, it would make it even more useful.
Re: FBCON driver fixed by pull request 66?
August 21, 2012 04:58PM
Thanks for pointing that out. I took a crack a fixing fbcon a few weeks ago but without any luck. If that patch works, I'll gladly merge it into the rescue system.
Rob van der Hoeven
Re: Rescue System 1.2
August 22, 2012 12:41PM
Hi Jeff,

I think a rescue system is a GREAT idea! Tested your 1.21 version on my MK802 with 1 GB but it does not work (probably did not run at all because no /log/deviceinfo.log is created). The README.txt mentions that system.bin is device specific. Is this the problem?

Kind regards,
Rob van der Hoeven.
Andrew
Re: Rescue System 1.2
August 23, 2012 06:29PM
Rob van der Hoeven Wrote:
-------------------------------------------------------
> Hi Jeff,
>
> I think a rescue system is a GREAT idea! Tested
> your 1.21 version on my MK802 with 1 GB but it
> does not work (probably did not run at all because
> no /log/deviceinfo.log is created). The README.txt
> mentions that system.bin is device specific. Is
> this the problem?
>
> Kind regards,
> Rob van der Hoeven.

Hi, yes, that is probably the problem, or one of the possible problems. You should copy the file script.bin from the MK802 to the root of the rescue partition, and rename it system.bin (rename Jeff's system.bin to anything else).
Andrew
Re: FBCON driver fixed by pull request 66?
August 24, 2012 01:56AM
Jeff Wrote:
-------------------------------------------------------
> Thanks for pointing that out. I took a crack a
> fixing fbcon a few weeks ago but without any luck.
> If that patch works, I'll gladly merge it into
> the rescue system.

Hi Jeff, I ended up applying the patch manually to the amery allwinner 3.0.36 kernel and it works.
There are two bugs left, though:
1. The FBCON driver is incompatible with the Mali driver for some reason. You have to unload the FBCON module before you can load the Mali module. My guess is they both claim some or the same overlapping range in ram.
2. There is a minor issue with the text and background colour mapping, this can be circumvented by using the method explained here: http://wlair.us.to/blog/2011/09/26/re-linux-console-colors/
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: