A10 Rescue System July 24, 2012 11:34AM |
Admin Registered: 14 years ago Posts: 304 |
wget http://download.doozan.com/a10/a10_base-1.0.zip unzip a10_base-1.0.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.0.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 #2 PREEMPT Mon Jul 23 11:55:49 EDT 2012 armv7l GNU/Linux
Building the A10 Rescue System July 24, 2012 11:37AM |
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 cp 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 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 u-boot partition on sdb fdisk /dev/sdb u n p 1 2048 +31M t b w 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 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 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/rescue/autorun-extract-system-bin.sh #!/bin/sh if [ ! -f /mnt/sysconfig/system.bin ]; then echo "Could not find /system.bin on sysconfig partition" echo "Searching NAND for usable system.bin files..." mkdir /tmp/nand mount /dev/nanda /tmp/nand if [ -f /tmp/nand/script.bin ]; then # Decompile script.bin /sbin/fexc -I bin -O fex /tmp/nand/script.bin /tmp/system.fex # Extract the MAC address from the uboot environment on nandh dd if=/dev/nandh of=/tmp/env bs=1024 count=128 mac=\`strings /tmp/env | grep "^mac=" | cut -d "=" -f 2 | sed -e 's/://g'\` # Set the new MAC address and save system.bin on sysconfig sed -i -e"s/^MAC = \\"000000000000\\"/MAC = \\"\$mac\\"/" /tmp/system.fex mount -o remount,rw /mnt/sysconfig /sbin/fexc -I fex -O bin /tmp/system.fex /mnt/sysconfig/system.bin mount -o remount,ro /mnt/sysconfig umount /tmp/nand echo "Created system.bin from nanda/script.bin, MAC Address = \$mac" echo "Rebooting system to use new system.bin" sleep 5 reboot else echo "Could not find /script.bin on nanda" fi else echo "/mnt/sysconfig/system.bin already installed, exiting" fi 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 echo "1.0" > /tmp/sysconfig/etc/version
umount /tmp/sysconfig dd if=/dev/sdb of=a10_base-1.0.img bs=1024 count=32768 zip a10_base-1.0.zip a10_base-1.0.img
Re: A10 Rescue System July 24, 2012 11:45AM |
Moderator Registered: 12 years ago Posts: 378 |
Re: A10 Rescue System July 24, 2012 12:49PM |
Admin Registered: 14 years ago Posts: 304 |
Re: A10 Rescue System July 24, 2012 01:20PM |
Moderator Registered: 12 years ago Posts: 378 |
Quote
Specifically, I'd like to know what partition your configuration file is located on
Re: A10 Rescue System July 24, 2012 08:54PM |
Admin Registered: 14 years ago Posts: 304 |
Re: A10 Rescue System July 24, 2012 10:53PM |
Moderator Registered: 12 years ago Posts: 378 |
Re: A10 Rescue System July 25, 2012 08:29AM |
Admin Registered: 14 years ago Posts: 304 |
Diolu
Re: A10 Rescue System November 24, 2012 04:51AM |
Trime
Re: A10 Rescue System May 23, 2013 04:27AM |
louigi600
Re: A10 Rescue System June 27, 2013 02:07AM |
stephane ancelot
Re: A10 Rescue System July 09, 2013 04:02PM |