A10 Rescue System 1.1 July 26, 2012 12:58PM |
Admin Registered: 14 years ago Posts: 304 |
wget http://download.doozan.com/a10/a10_base-1.1.zip unzip a10_base-1.1.zipinsert flash drive
dmesgfind drive id (sdb, in my case, using a USB SD card reader)
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
dd if=a10_base-1.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 65536 31744+ b W95 FAT32
ssh root@192.168.0.2 (use the ip address that you found here)
[root@rescue ~]# uname -a Linux rescue 3.0.36 #1 PREEMPT Wed Jul 25 17:50:56 EDT 2012 armv7l GNU/Linux
Building the A10 Rescue System 1.1 July 26, 2012 01:01PM |
Admin Registered: 14 years ago Posts: 304 |
cd ~/src wget http://buildroot.uclibc.org/downloads/buildroot-2012.05.tar.gz cd buildroot-2012.05 git clone https://github.com/doozan/a10-rescue.git custom cd custom git checkout v1.1 cd .. cp custom/buildroot-config .config make mkimage -A arm -O linux -T ramdisk -C bzip2 -a 0 -e 0 -n RescueSystem -d output/images/rootfs.cpio.bz2 output/images/uInitrd
cd ~/src git clone https://github.com/amery/sunxi-tools cd sunxi-tools make cd..
git clone https://github.com/hno/uboot-allwinner.git cd uboot-allwinner git checkout sun4i make CROSS_COMPILE=arm-linux-gnueabi- sun4i cd..
# Zero the first 32M of the card dd if=/dev/zero of=/dev/sdb bs=1024 count=32768 # Install the boot images dd if=uboot-allwinner/spl/sun4i-spl.bin of=/dev/sdb bs=1024 seek=8 dd if=uboot-allwinner/u-boot.bin of=/dev/sdb bs=1024 seek=32 # Create partition table and sysconfig partition cat <<EOF | fdisk /dev/sdb u n p 1 2048 63487 t b w EOF mkfs.vfat /dev/sdb1
mkdir /tmp/sysconfig mount /dev/sdb1 /tmp/sysconfig mkdir /tmp/sysconfig/rescue cp buildroot-2012.05/output/images/uInitrd buildroot-2012.05/output/images/uImage /tmp/sysconfig/rescue cat<<EOF>/tmp/sysconfig/boot.cmd setenv system.bin 'fatload mmc 0:1 0x43000000 system.bin || fatload mmc 0:1 0x43000000 /rescue/system.bin' setenv force_rescue 0 setenv force_rescue_bootcmd 'if test \$force_rescue -eq 1 || fatload mmc 0 0x45000000 /rescue/force_rescue.txt; then run rescue_bootcmd; fi' setenv mmc_root '/dev/mmcblk0p2' setenv mmc_rootfstype 'ext2' setenv mmc_bootargs 'setenv bootargs console=\$console root=\$mmc_root rootfstype=\$mmc_rootfstype rootwait' setenv mmc_boot 'mw 0x44000000 0 1; if ext2load mmc 0:2 0x44000000 /boot/uImage; then if ext2load mmc 0:2 0x45000000 /boot/uInitrd; then bootm 0x44000000 0x45000000; else bootm 0x44000000; fi; else if fatload mmc 0:1 0x44000000 uImage; then if fatload mmc 0:1 0x45000000 uInitrd; then bootm 0x44000000 0x45000000; else bootm 0x44000000; fi; fi; fi;' setenv mmc_bootcmd 'run mmc_bootargs ; run mmc_boot' setenv rescue_set_bootargs 'setenv bootargs console=\$console' setenv rescue_boot 'mw 0x44000000 0 1; fatload mmc 0 0x44000000 /rescue/uImage; if fatload mmc 0 0x45000000 /rescue/uInitrd; then bootm 0x44000000 0x45000000; else bootm 0x44000000; fi' setenv rescue_bootcmd 'run rescue_set_bootargs; run rescue_boot' setenv bootcmd 'run system.bin ; run force_rescue_bootcmd; run mmc_bootcmd; run rescue_bootcmd; reset' setenv boot_mmc 'run bootcmd' EOF ./uboot-allwinner/tools/mkimage -A arm -O u-boot -T script -C none -n "boot" -d /tmp/sysconfig/boot.cmd /tmp/sysconfig/boot.scr wget https://github.com/amery/sunxi-bin-archive/raw/master/mele-a1000/stock-nanda/script.bin -O system.bin.orig ./sunxi-tools/fexc -I bin -O fex system.bin.orig system.fex sed -i -e's/^MAC = "000000000000"/MAC = "d0b3d0b3d000"/' system.fex ./sunxi-tools/fexc -I fex -O bin system.fex system.bin cp system.bin /tmp/sysconfig/rescue wget https://raw.github.com/doozan/a10-rescue-scripts/master/init-extract-system-bin.sh -O /tmp/sysconfig/rescue/init-extract-system-bin.sh wget https://raw.github.com/doozan/a10-rescue-scripts/master/init-modules.sh -O /tmp/sysconfig/rescue/init-modules.sh wget https://raw.github.com/doozan/a10-rescue-scripts/master/autorun-deviceinfo.sh -O /tmp/sysconfig/rescue/autorun-deviceinfo.sh cat<<EOF>/tmp/sysconfig/rescue/interfaces # Configure Loopback auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp # Uncomment and adjust for your own wifi settings #auto wlan0 #iface wlan0 inet dhcp # # WPA/WPA2 security, uncomment the next two lines and then edit wpa_supplicant.conf #pre-up wpa_supplicant -B -Dwext -i wlan0 -c/etc/wpa_supplicant.conf #post-down killall -q wpa_supplicant # # WEP security, uncomment and edit the next three lines #wireless-mode managed #wireless-essid mynetworkname #wireless-key mywepkey # # Open or no security, uncomment and edit the next two lines #wireless-mode managed #wireless-essid mynetworkname # EOF cat<<EOF>/tmp/sysconfig/rescue/wpa_supplicant.conf ctrl_interface=/var/run/wpa_supplicant # Uncomment the following lines if you're using WPA supplicant #network={ # ssid="MyNetwork" # psk=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx #} EOF cat<<EOF>/tmp/sysconfig/README.txt This partition is reserved for system/boot configs plus a rescue system. /system.bin - device-specific hardware configuration, extracted from Android partition boot.scr = compiled uboot environment boot.cmd = source code for uboot environment, this file can be compiled with the following command: mkimage -A arm -O u-boot -T script -C none -n "boot" -d boot.cmd boot.scr /rescue ====== The images in /rescue will be loaded if no system is found on the mmc0p2 partition. The rescue system should have just enough tools to allow you to ssh to your device and repair or install an operating system. You can force booting to the rescue system by creating a file named 'force_rescue.txt' in the /rescue directory. You can also configure the wireless network settings for the rescue system by editing the network_interfaces file. If you're editing this file on Windows, be sure to use an editor that will preserve the UNIX line endings (Notepad2 is a safe choice) The rescue system includes a precompiled fexc binary. Full source is available at http://github.com/amery/sunxi-tools EOF
umount /tmp/sysconfig dd if=/dev/sdb of=a10_base-1.1.img bs=1024 count=32768 zip a10_base-1.1.zip a10_base-1.1.img
J. Carlos
Re: A10 Rescue System 1.1 July 26, 2012 03:00PM |
Re: Building the A10 Rescue System 1.1 July 26, 2012 03:21PM |
Admin Registered: 14 years ago Posts: 304 |
Re: Building the A10 Rescue System 1.1 July 26, 2012 03:36PM |
Moderator Registered: 12 years ago Posts: 378 |
I'm fairly certain that is what's breaking kpartx. . .Quote
# Create partition table and sysconfig partition
cat <<EOF | fdisk /dev/sdb
u
n
p
1
2048
63487
t
b
w
EOF
if [ $WIRED = 1 ]; then echo "Loading wired ethernet module" modprobe sun4i_wemac else echo "Loading wireless module" modprobe 8192cu fiWhy not load both modules on the mele. Wemac is crap. I never use Eth0 on the mele. Have not even tried it. . .
Re: Building the A10 Rescue System 1.1 July 26, 2012 04:14PM |
Admin Registered: 14 years ago Posts: 304 |
Quote
gnexus
Why not load both modules on the mele.
dd if=/dev/nandh of=/tmp/env bs=1024 count=128 strings /tmp/env
J. Carlos
Re: Building the A10 Rescue System 1.1 July 26, 2012 04:14PM |
Re: Building the A10 Rescue System 1.1 July 26, 2012 04:32PM |
Admin Registered: 14 years ago Posts: 304 |
Re: Building the A10 Rescue System 1.1 July 26, 2012 05:13PM |
Moderator Registered: 12 years ago Posts: 378 |
I figured it out. Your FAT partition is one block too big. For some reason writing the u-boot changes it slightly:Quote
I'm not seeing the kpartx issue on my system, so I'm not in a position to test that. If you can get it working with sfdisk, I will be more than happy to accept patches.
sfdisk -d /dev/sdb > > a10_base-partitions.txt
qemu-img create a10_base-1.11.img 32M
kpartx -a a10_base-1.11.img
sfdisk -d /dev/loop0 < a10_base-partitions.txt sfdisk: ERROR: sector 0 does not have an msdos signature sfdisk: /dev/loop0: unrecognized partition table type
fdisk /dev/sdb Device Boot Start End Blocks Id System /dev/sdb1 2048 65536 31744+ b W95 FAT32
fdisk /dev/loop0
[root@lp01 z]# fdisk /dev/loop0 Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): p Partition number (1-4, default 1): Using default value 1 First sector (2048-65535, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-65535, default 65535): Using default value 65535 Partition 1 of type Linux and of size 31 MiB is set Command (m for help): t Selected partition 1 Hex code (type L to list codes): c Changed system type of partition 1 to c (W95 FAT32 (LBA)) Command (m for help): w The partition table has been altered!
dd if=/dev/sdb of=/dev/loop0 bs=1024 count=2048
kpartx -d a10_base-1.11.img loop deleted : /dev/loop0
kpartx -a a10_base-1.11.img device-mapper: resume ioctl on loop0p1 failed: Invalid argument create/reload failed on loop0p1
fdisk /dev/loop0 Device Boot Start End Blocks Id System /dev/loop0p1 2048 65536 31744+ b W95 FAT32 Command (m for help): d Command (m for help): n Select (default p): p Device Boot Start End Blocks Id System /dev/loop0p1 2048 65535 31744 83 Linux Command (m for help): t Hex code (type L to list codes): c Changed system type of partition 1 to c (W95 FAT32 (LBA)) Command (m for help): w
kpartx -d a10_base-1.11.img kpartx -a a10_base-1.11.img
mount /dev/mapper/loop0p1 /mnt/misc
mount /dev/sdb1 /mnt/ns01 tar -c --one-file-system -f - -C /mnt/ns01 . | tar xvf - -C /mnt/misc
# Create partition table and sysconfig partition sfdisk -d /dev/sdb < a10_base-partitions.txt. . . or you can use the text itself from a10_base-partitions.txt.
Re: Building the A10 Rescue System 1.1 July 26, 2012 05:14PM |
Registered: 13 years ago Posts: 5 |
> dd if=/dev/nandh of=/tmp/env bs=1024 count=128 > strings /tmp/env >>
Re: Building the A10 Rescue System 1.1 July 27, 2012 06:21AM |
Moderator Registered: 12 years ago Posts: 378 |
Quote
I had upgraded to the ICS that is on Lundmans site. I found the environment on nandb.
root@mele:/# dd if=/dev/nandb of=/tmp/env bs=1024 count=128 root@mele:/# strings /tmp/env bootdelay=1 bootcmd=run setargs boot_normal console=ttyS0,115200 nand_root=/dev/nandd mmc_root=/dev/mmcblk0p7 (but how did this get there?) init=/init loglevel=8 setargs=setenv bootargs console=${console} root=${nand_root} init=${init} loglevel=${loglevel} mac_addr=${mac} boot_normal=nand read 40007800 boot;boota 40007800 boot_recovery=nand read 40007800 recovery;boota 40007800 boot_fastboot=fastboot mac=xx:xx:xx:xx:xx:xx
Re: Building the A10 Rescue System 1.1 July 27, 2012 06:35AM |
Registered: 13 years ago Posts: 5 |
Re: Building the A10 Rescue System 1.1 July 27, 2012 06:54AM |
Moderator Registered: 12 years ago Posts: 378 |
Quote
On mine at least, the MAC in the environment corresponds to eth0 as labeled on the rj45 connector inside the case.
Re: A10 Rescue System 1.1 July 27, 2012 11:48PM |
Registered: 12 years ago Posts: 6 |
Re: A10 Rescue System 1.1 July 28, 2012 11:06AM |
Registered: 12 years ago Posts: 378 |
auto lo iface lo inet loopback auto wlan0 iface wlan0 inet dhcp pre-up ifconfig wlan0 hw ether [your wireless MAC address] up || true # wireless-essid [your wireless SSID ] (use for WEP only) # wireless-key [your wireless password ] (use for WEP only) wpa-ssid [your wireless SSID ] wpa-psk [your wireless password ]
J. Carlos
Re: A10 Rescue System 1.1 August 01, 2012 12:00PM |
Re: A10 Rescue System 1.1 August 01, 2012 06:51PM |
Admin Registered: 14 years ago Posts: 304 |
J. Carlos
Re: A10 Rescue System 1.1 August 02, 2012 03:36AM |
Re: A10 Rescue System 1.1 August 02, 2012 07:18AM |
Admin Registered: 14 years ago Posts: 304 |