debootstrap --verbose --arch armhf --foreign jessie /mnt/debian http://ftp.cn.debian.org/debian/ export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/system/bin chroot extsd /debootstrap/debootstrap --second-stage echo 'deb http://ftp.cn.debian.org/debian jessie main' >/root/etc/apt/sources.list mount -t proc none /root/proc mount -t sysfs none /root/sys mount -o bind /dev /root/dev mount -t devpts none /root/dev/pts export TMPDIR=/tmp chroot /root /bin/bash apt-get update apt-get install openssh-server passwd root exit sync
Instead of falling through boot options, the A31 boots slightly differently. One fel pin, which is the same as A10/A20. Two boot select pins, boot sel0 and boot sel1, which decide where to boot. The fel key priority is higher than the boot select key. The boot-flow process is explained briefly below.
boot-> check fel key pressed (yes)-> check if sd0 bootable(no) -->go to fel mode \ \ \ (yes)\__ boot from sd0 \ \ _____[00] boot from nand flash (go to fel mode if failed) (no) \ /_____[01] boot from sd2 (go to fel mode if failed) \ / \___check boot sel[0:1]----[10] boot from emmc2 (go to fel mode if failed) \ \______[11] boot from spi (go to fel mode if failed) by hipboi
<4>[ 674.036417] [mmc]: mmc 0 detect change, present 1 <4>[ 674.537511] [mmc]: sdc0 set ios: clk 0Hz bm PP pm UP vdd 3.3V width 1 timing LEGACY(SDR12) dt B <4>[ 674.567125] [mmc]: sdc0 set ios: clk 400000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B <4>[ 674.649795] [mmc]: *** sw_mci_dump_errinfo(L559): smc 0 err, cmd 52, RTO !! <4>[ 674.659084] [mmc]: *** sw_mci_dump_errinfo(L559): smc 0 err, cmd 52, RTO !! <4>[ 674.667574] [mmc]: sdc0 set ios: clk 400000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B <4>[ 674.681049] [mmc]: sdc0 set ios: clk 400000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B <4>[ 674.694293] [mmc]: *** sw_mci_dump_errinfo(L559): smc 0 err, cmd 5, RTO !! <4>[ 674.703426] [mmc]: *** sw_mci_dump_errinfo(L559): smc 0 err, cmd 5, RTO !! <4>[ 674.712547] [mmc]: *** sw_mci_dump_errinfo(L559): smc 0 err, cmd 5, RTO !! <4>[ 674.721667] [mmc]: *** sw_mci_dump_errinfo(L559): smc 0 err, cmd 5, RTO !! <4>[ 674.730913] [mmc]: sdc0 set ios: clk 400000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B <4>[ 674.743133] [mmc]: sdc0 set ios: clk 400000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B <4>[ 674.756102] [mmc]: sdc0 set ios: clk 400000Hz bm PP pm ON vdd 3.3V width 1 timing LEGACY(SDR12) dt B <4>[ 674.861647] [mmc]: sdc0 set ios: clk 400000Hz bm PP pm ON vdd 3.3V width 1 timing SD-HS(SDR25) dt B <4>[ 674.872437] [mmc]: sdc0 set ios: clk 50000000Hz bm PP pm ON vdd 3.3V width 1 timing SD-HS(SDR25) dt B <4>[ 674.938767] [mmc]: sdc0 set ios: clk 50000000Hz bm PP pm ON vdd 3.3V width 4 timing SD-HS(SDR25) dt B <6>[ 674.950354] mmc0: new high speed SDHC card at address b368 <6>[ 674.963568] mmcblk0: mmc0:b368 NCard 3.73 GiB <6>[ 674.977098] mmcblk0: p1 root@fiber-onda809q9:/ # cat /proc/partitions major minor #blocks name 93 0 16384 nanda 93 8 16384 nandb 93 16 16384 nandc 93 24 819200 nandd 93 32 2097152 nande 93 40 16384 nandf 93 48 32768 nandg 93 56 524288 nandh 93 64 131072 nandi 93 72 10379264 nandj 179 0 3920896 mmcblk0 179 1 3919872 mmcblk0p1 $ ./awimage -u ../V812_Core4_v4.4_v1.img ./awimage: unpacking ../V812_Core4_v4.4_v1.img to ../V812_Core4_v4.4_v1.img.dump Extracting: COMMON SYS_CONFIG100000 (64461, 64464) Extracting: COMMON SYS_CONFIG_BIN00 (45336, 45344) Extracting: COMMON SPLIT_0000000000 (512, 512) Extracting: COMMON SYS_CONFIG000000 (3418, 3424) Extracting: BOOT BOOT0_0000000000 (32768, 32768) Extracting: 12345678 1234567890BOOT_0 (32768, 32768) Extracting: 12345678 UBOOT_0000000000 (655360, 655360) Extracting: FES FES_1-0000000000 (11648, 11648) Extracting: PXTOOLSB XXXXXXXXXXXXXXXX (132608, 132608) Extracting: UPFLYTLS XXXXXXXXXXXXXXXX (153820, 153824) Extracting: UPFLTL32 XXXXXXXXXXXXXXXX (140528, 140528) Extracting: 12345678 1234567890CARDTL (81920, 81920) Extracting: 12345678 1234567890SCRIPT (1770, 1776) Extracting: 12345678 1234567890___MBR (65536, 65536) Extracting: 12345678 1234567890DLINFO (16384, 16384) Extracting: RFSFAT16 BOOTLOADER_FEX00 (4484096, 4484096) Extracting: RFSFAT16 VBOOTLOADER_FEX0 (4, 16) Extracting: RFSFAT16 ENV_FEX000000000 (131072, 131072) Extracting: RFSFAT16 VENV_FEX00000000 (4, 16) Extracting: RFSFAT16 BOOT_FEX00000000 (9369600, 9369600) Extracting: RFSFAT16 VBOOT_FEX0000000 (4, 16) Extracting: RFSFAT16 SYSTEM_FEX000000 (676196288, 676196288) Extracting: RFSFAT16 VSYSTEM_FEX00000 (4, 16) Extracting: RFSFAT16 RECOVERY_FEX0000 (12810240, 12810240) Extracting: RFSFAT16 VRECOVERY_FEX000 (4, 16) Extracting: RFSFAT16 DISKFS_FEX000000 (512, 512)
1). Mount BPI-M2 image
ondav812$ sudo dd if=BPI-M2_Snappy_15.04_V4.0_Beta1.img of=/dev/sdc [sudo] password for who: 10485760+0 records in 10485760+0 records out 5368709120 bytes (5.4 GB) copied, 764.308 s, 7.0 MB/s ondav812$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sdc1 63M 26M 38M 42% /media/who/system-boot /dev/sdc2 976M 228M 682M 26% /media/who/system-a /dev/sdc4 1.6G 356M 1.1G 25% /media/who/writable /dev/sdc3 976M 228M 682M 26% /media/who/system-b ondav812$ mount /dev/sdc1 on /media/who/system-boot type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks2) /dev/sdc2 on /media/who/system-a type ext4 (rw,nosuid,nodev,uhelper=udisks2) /dev/sdc4 on /media/who/writable type ext4 (rw,nosuid,nodev,uhelper=udisks2) /dev/sdc3 on /media/who/system-b type ext4 (rw,nosuid,nodev,uhelper=udisks2) ondav812$ tree /media/who/system-boot/ /media/who/system-boot/ ├── a │ ├── dtbs │ │ └── sun6i-a31s-bananapi-m2.dtb │ ├── hardware.yaml │ ├── initrd.img │ └── vmlinuz ├── b │ ├── dtbs │ │ └── sun6i-a31s-bananapi-m2.dtb │ ├── hardware.yaml │ ├── initrd.img │ └── vmlinuz ├── boot.cmd ├── boot.scr ├── install.yaml ├── snappy-system.txt └── uEnv.txt 4 directories, 13 files
2) Dump into files
dd if=/dev/sdc1 of=system-boot.img dd if=/dev/sdc2 of=system-a.img dd if=/dev/sdc3 of=system-b.img dd if=/dev/sdc4 of=writable.img $ ls -lh total 3.7G -rw-r--r-- 1 root root 1.0G Oct 24 17:39 system-a.img -rw-r--r-- 1 root root 1.0G Oct 24 17:42 system-b.img -rw-r--r-- 1 root root 64M Oct 24 17:38 system-boot.img -rw-r--r-- 1 root root 1.6G Oct 24 17:45 writable.img
1). Dump nandc as boot.img
2). Split boot.img into kernel and ramdisk
who@ubuntu:/ondav812/tools$ ./split_bootimg.pl ../boot.img Page size: 2048 (0x00000800) Kernel size: 8537532 (0x008245bc) Ramdisk size: 827726 (0x000ca14e) Second size: 0 (0x00000000) Board name: Command line: console=ttyS0,115200 rw init=/init loglevel=8 Writing boot.img-kernel ... complete. Writing boot.img-ramdisk.gz ... complete.
2.1) Decompress the ramdisk data
gunzip -c ../boot.img-ramdisk.gz | cpio -i who@ubuntu:/ondav812/tools/boot$ tree . ├── data ├── default.prop ├── dev ├── file_contexts ├── fstab.sun6i ├── init ├── init.environ.rc ├── initlogo.rle ├── init.rc ├── init.recovery.sun6i.rc ├── init.sun6i.rc ├── init.sun6i.usb.rc ├── init.trace.rc ├── init.usb.rc ├── nand.ko ├── proc ├── property_contexts ├── sbin │ ├── adbd │ ├── healthd │ ├── ueventd -> ../init │ └── watchdogd -> ../init ├── seapp_contexts ├── sepolicy ├── sys ├── system ├── ueventd.rc └── ueventd.sun6i.rc
3). Dump nanda
root@fiber-onda809q9:/sdcard # dd if=/dev/block/nanda of=nanda.img 32768+0 records in 32768+0 records out 16777216 bytes transferred in 1.023 secs (16400015 bytes/sec)
/mnt/ ├── bat │ ├── bat0.bmp │ ├── bat10.bmp │ ├── bat1.bmp │ ├── bat2.bmp │ ├── bat3.bmp │ ├── bat4.bmp │ ├── bat5.bmp │ ├── bat6.bmp │ ├── bat7.bmp │ ├── bat8.bmp │ ├── bat9.bmp │ ├── battery.bmp │ ├── bempty.bmp │ ├── bootlogo.bmp │ └── low_pwr.bmp ├── bootlogo.bmp ├── font24.sft ├── font32.sft └── magic.bin
4). Dump nandb
root@fiber-onda809q9:/sdcard # dd if=/dev/block/nandb of=nandb.img 32768+0 records in 32768+0 records out 16777216 bytes transferred in 1.095 secs (15321658 bytes/sec)
4.1) Using strings
who@ubuntu:/ondav812$ strings nandb.img console=ttyS0,115200 nand_root=/dev/system mmc_root=/dev/mmcblk0p7 init=/init loglevel=5 setargs_nand=setenv bootargs console=${console} root=${nand_root} init=${init} loglevel=${loglevel} partitions=${partitions} setargs_mmc=setenv bootargs console=${console} root=${mmc_root} init=${init} loglevel=${loglevel} partitions=${partitions} boot_normal=sunxi_flash read 40007800 boot;boota 40007800 boot_recovery=sunxi_flash read 40007800 recovery;boota 40007800 boot_fastboot=fastboot recovery_key_value_max=0x13 recovery_key_value_min=0x10 fastboot_key_value_max=0x8 fastboot_key_value_min=0x2 bootdelay=0 bootcmd=run setargs_nand boot_normal
/dev/block/nanda 128M 4.1M 124M /dev/block/by-name/bootloader
/dev/block/nandb
/dev/block/nandc boot.img
/dev/block/nandd system.img
/dev/block/nande 2.0G 1022M 998M /dev/block/by-name/data
/dev/block/nandf
/dev/block/nandg
/dev/block/nandh 505M 8.9M 496M /dev/block/by-name/cache
/dev/block/nandi 127M 4.1M 122M /dev/block/by-name/databk
/dev/block/nandj 9.9G 9.4G 559M /dev/block/by-name/UDISK
boot/env/misc/recovery/system
root@fiber-onda809q9:/ # df
Filesystem Size Used Free Blksize
/dev 798.0M 128.0K 797.8M 4096
/sys/fs/cgroup 798.0M 12.0K 798.0M 4096
/mnt/secure 798.0M 0.0K 798.0M 4096
/mnt/asec 798.0M 0.0K 798.0M 4096
/mnt/obb 798.0M 0.0K 798.0M 4096
/system 756.8M 644.2M 112.6M 4096
/cache 504.4M 8.8M 495.6M 4096
/databk 126.0M 4.1M 121.9M 4096
/data 2.0G 1.0G 973.9M 4096
/mnt/sdcard 9.9G 9.3G 554.2M 4096
/mnt/secure/asec 9.9G 9.3G 554.2M 4096
1) Install busybox
2) remount system
mount -o remount,rw /
mount -o remount,rw -t ext4 /dev/block/by-name/system
3. Format ext2 fs
mke2fs /dev/block/nandj
4) mount ubuntu.img & nandj
mount -o loop -t ext2 /data/ubuntu.img /data/rootfs
mount -t ext4 /dev/block/nandj sdcard/
cp -a /data/rootfs/* /mnt/sdcard/
5) Using linuxdeploy bootup via partition /dev/block/nandj