Skip to content

Instantly share code, notes, and snippets.

@orangecms
Last active April 25, 2022 00:52
Show Gist options
  • Save orangecms/594f3a09472f03d8c77437b20f2db5c8 to your computer and use it in GitHub Desktop.
Save orangecms/594f3a09472f03d8c77437b20f2db5c8 to your computer and use it in GitHub Desktop.
vnopn / Thin Client

SoC

The SoC is unlabeled but turns out to be an Allwinner T3/R40 aka sun8iw11p1.

The device is presumably also known as ShareVDI R1 (Pro).

See also:

Related boards

Sources

https://github.com/SoCXin/H6/blob/master/linux/kernel/arch/arm/boot/dts/sun8iw11p1-soc.dts

export ARCH=arm64
export DTC_FLAGS="-@"
export PATH=/path/to/gcc-for-aarch64/bin/:$PATH
export CROSS_COMPILE=aarch64-none-linux-gnu-

U-Boot

Press s to enter. :) To break out of the default boot, run this:

If you look at printenv, you will see things like root=/dev/ubuntu. This does not exist in the Linux system. It is used by the init script in an if statement. More later.

run setargs_mmc boot_normal

This will hint the script in the initramfs to search for a non-existent device for a rootfs.

Linux

 uname -a
Linux T3 3.10.65 #327 SMP PREEMPT Thu Aug 15 17:39:13 CST 2019 armv7l GNU/Linux

And suddenly it resets... we need to disable the watchdog! :) Repeat from U-Boot and do this in Linux:

# bye bye watchdog!
echo 0 > /sys/devices/platform/sun8iw11_watchdog/Watchdog_enable

You can find this in the /init script in the initramfs. I just ran cat /init and saved the log in Minicom to read through it.

Now you can go ahead and load the NAND kernel driver:

insmod /lib/modules/$(uname -r)/nand.ko

The NAND partitions show up as /dev/nand{a,b,c,d,e,f}. So now you can take a USB stick to back them up. :)

HELLO! BOOT0 is starting!
U-Boot 2014.07 (Apr 26 2019 - 15:33:45) Allwinner Technology
uboot commit : 8
i2c_init: by cpux
i2c_init ok
[ 0.248]pmbus: ready
[ 0.267]PMU: AXP221
[ 0.267]PMU: AXP22x found
[ 0.268]PMU: dcdc2 1160
[ 0.269]PMU: cpux 1008 Mhz,AXI=336 Mhz
PLL6=600 Mhz,AHB1=200 Mhz, APB1=100Mhz MBus=400Mhz
set power on vol to default
dcdc1_vol = 3300, onoff=1
dcdc2_vol = 1160, onoff=1
dcdc3_vol = 1200, onoff=1
dcdc4_vol = 1100, onoff=0
aldo1_vol = 3300, onoff=0
aldo2_vol = 1800, onoff=1
aldo3_vol = 3000, onoff=1
dc1sw_vol = 3000, onoff=0
dc5ldo_vol = 1100, onoff=0
dldo1_vol = 3300, onoff=1
dldo2_vol = 3300, onoff=0
dldo3_vol = 3300, onoff=0
dldo4_vol = 2500, onoff=0
eldo1_vol = 2800, onoff=1
eldo2_vol = 3300, onoff=1
eldo3_vol = 1200, onoff=0
gpio0_vol = 3300, onoff=0
gpio1_vol = 3300, onoff=0
find power_sply to end
vbus exist
run key detect
fel key configed
check_config_fel_key:get fel_key_max error: FDT_ERR_BADOFFSET
time out
key not pressed anymore
no uart input
DRAM: 256 MiB
fdt addr: 0x46ecd1d8
Relocation Offset is: 05f23000
axp: get node[charger0] error
In: serial
Out: serial
Err: serial
gic: normal mode
workmode = 0,storage type = 0
[ 2.511]NAND: NAND_UbootInit
[ 2.514]NAND_UbootInit start
[ 2.517]NB1: enter NAND_LogicInit
[ 2.637]uboot: nand version: 3 6005 20170624 1716
[ 2.638]not burn nand partition table!
[ 2.642]NB1: nftl num: 1
[ 2.643]init nftl: 0
[ 4.083][NE]not power on gc 1847!
[ 4.084]NB1: NAND_LogicInit ok, result = 0x0
[ 4.086]NAND_UbootInit end: 0x0
[ 4.089]sunxi flash init ok
--------fastboot partitions--------
-total partitions:7-
-name- -start- -size-
boot-resource: 1000000 2000000
env : 3000000 1000000
boot : 4000000 4000000
rootfs : 8000000 20000000
ubuntufs : 28000000 c0000000
sharevdi : e8000000 1000000
UDISK : e9000000 0
-----------------------------------
[mmc]: MMC Device 2 not found
base bootcmd=run setargs_nand boot_normal
bootcmd set setargs_nand
key 13
cant find rcvy value
cant find fstbt value
no misc partition is found
to be run cmd=run setargs_nand boot_normal
update dtb dram start
update dtb dram end
PowerBus = 3( 2:vBus 3:acBus other: not exist)
normal dc exist, limit to dc
no battery exist
EnterNormalBootMode sunxi_bmp_display--
[ 4.272]inter uboot shell
Hit any key to stop autoboot: 0
read partition: boot or recovery
[ 5.136]sunxi flash read :offset 4000000, 16063631 bytes OK
Android's image name: sun8i_arm
Kernel load addr 0x40008000 size 13308 KiB
RAM disk load addr 0x41000000 size 1356 KiB
[ 5.202]ready to boot
prepare for kernel
NAND_UbootExit
[ 5.202]NB1: NAND_LogicExit
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.10.65 (root@sharevdi) (gcc version 4.6.3 20120201 (prerelease) (crosstool-NG linaro-1.13.1-2012.02-20120222 - Linaro GCC 2012.02) ) #327 SMP PREEMPT Thu Aug 15 17:39:13 CST 2019
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c53c7d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine: sun8iw11p1, model: sun8iw11p1
[ 0.000000] bootconsole [earlycon0] enabled
[/init]: RootDevice is "/dev/system"
===== >>> load nand starting .... <<< ======
>>> starting insmod nand.ko Enable Watchdog .....
>>> insmod nand.ko in background OK !!!!!,starting wait rootfs node ....
[/init]: Wait /dev/nandd ready ...
[/init]: Wait /dev/nandd ready ...
>>> wait rootfs node OK !!!!,stating mount rootfs node ....
/dev/nandd: recovering journal
/dev/nandd: clean, 2734/3120 files, 179336/314251 blocks (check deferred; on battery)
>>> mount QT rootfs OK !!!!!
===== >>> load nand finished <<< ======
########### Loading QT rootfs, Disable Watchdog,Watchdog CNT = 0 ...###############
#!/bin/sh
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t devtmpfs none /dev
exec < /dev/console > /dev/console 2>&1
for parm in $(cat /proc/cmdline); do
case $parm in
ramfs)
RAMFS_MODE=1
;;
root=*)
ROOT_DEVICE=`echo $parm | awk -F\= '{print $2}'`
;;
esac
done
if [ "x$ROOT_DEVICE" = "x" ]; then
ROOT_DEVICE=autoconfig
fi
echo [$0]: RootDevice is \"$ROOT_DEVICE\"
WATCHDOG_DISABLE_CNT=0
# $1: the name of block device
wait_for_ready()
{
CNT=8
while true; do
if [ -b $1 ]; then
return 0
fi
echo [$0]: Wait $1 ready ...
CNT=`expr $CNT - 1`
if [ $CNT -eq 0 ]; then
echo [$0]: $1 is not available!
WATCHDOG_DISABLE_CNT=`expr $WATCHDOG_DISABLE_CNT + 1`
return 1
fi
sleep 1
done
}
# $1: The block device
do_mount()
{
e2fsck -p $1
mount -o rw,noatime,nodiratime,norelatime,noauto_da_alloc,barrier=0,data=ordered -t ext4 $1 /mnt
if [ $? -ne 0 ]; then
echo [$0]: Failed to mount $1!
WATCHDOG_DISABLE_CNT=`expr $WATCHDOG_DISABLE_CNT + 1`
fi
}
dd_sharevdi_env()
{
#jp debug changed
mount -t ext4 /dev/nandf /sdcard
if [ $? -eq 0 ];then
dd if=/sdcard/env_qt.fex of=/dev/nandb >/dev/null
if [ $? -eq 0 ];then
umount /sdcard
else
umount /sdcard
echo "dd env to flash failed !!!"
fi
else
echo "Mount sharevdi rootfs Failed !!!"
fi
}
load_nand()
{
#echo [$0]: ########### Try to load Nand ...###############
echo "===== >>> load nand starting .... <<< ======"
NAND_MODULE=/lib/modules/$(uname -r)/nand.ko
if [ ! -f $NAND_MODULE ]; then
echo [$0]: $NAND_MODULE does not exist!
WATCHDOG_DISABLE_CNT=`expr $WATCHDOG_DISABLE_CNT + 1`
return 1
fi
echo ">>> starting insmod nand.ko Enable Watchdog ....."
echo 1 > /sys/devices/platform/sun8iw11_watchdog/Watchdog_enable
insmod $NAND_MODULE &
if [ $? -ne 0 ]; then
echo [$0]: $NAND_MODULE is invalid!
WATCHDOG_DISABLE_CNT=`expr $WATCHDOG_DISABLE_CNT + 1`
return 2
fi
echo ">>> insmod nand.ko in background OK !!!!!,starting wait rootfs node ...."
wait_for_ready /dev/nandd
if [ $? -eq 0 ]; then
#echo 0 > /sys/devices/platform/sun8iw11_watchdog/Watchdog_enable
echo ">>> wait rootfs node OK !!!!,stating mount rootfs node ...."
if [ "$ROOT_DEVICE" = "/dev/system" ]; then
do_mount /dev/nandd
echo ">>> mount QT rootfs OK !!!!!"
fi
if [ "$ROOT_DEVICE" = "/dev/ubuntu" ]; then
dd_sharevdi_env
do_mount /dev/nande
echo ">>> mount ubuntu rootfs OK !!!!!"
fi
#jp debug changed
fi
echo "===== >>> load nand finished <<< ======"
}
load_emmc()
{
echo [$0]: ########### Try to load EMMC ...###############
wait_for_ready /dev/mmcblk0p7
if [ $? -eq 0 ]; then
do_mount /dev/mmcblk0p7
fi
}
case $ROOT_DEVICE in
/dev/nand*|/dev/system|/dev/ubuntu)
load_nand
;;
/dev/mmc*)
load_emmc
;;
autoconfig*)
sleep 1;
if cat /proc/partitions|grep "mmcblk0p7" >/dev/null;then
magic_num=$(hexdump -s 1292 -n 2 -x /dev/mmcblk0p7|head -1|awk '{print $2 }')
if echo $magic_num|grep "f30a" >/dev/null;then
load_emmc
fi
else
load_nand
fi
;;
*)
echo [$0]: "Use default type"
;;
esac
#jp debug changed
if [ "$ROOT_DEVICE" = "/dev/system" ]; then
echo 0 > /sys/devices/platform/sun8iw11_watchdog/Watchdog_enable
echo "########### Loading QT rootfs, Disable Watchdog,Watchdog CNT = $WATCHDOG_DISABLE_CNT ...###############"
[ -x /mnt/init ] && exec switch_root /mnt /init
fi
if [ "$ROOT_DEVICE" = "/dev/ubuntu" ]; then
echo 0 > /sys/devices/platform/sun8iw11_watchdog/Watchdog_enable
echo "########### Loading Ubuntu rootfs, Disable Watchdog,Watchdog CNT = $WATCHDOG_DISABLE_CNT ...###############"
[ -x /mnt/sbin/init ] && exec switch_root /mnt /sbin/init
fi
#[ -x /mnt/init ] && exec switch_root /mnt /init
#echo 0 > /sys/devices/platform/sun8iw11_watchdog/Watchdog_enable
#sleep 1
echo 1 > /sys/devices/platform/sun8iw11_watchdog/Watchdog_enable
/sbin/getty -L ttyS0 115200 vt100 -n -l /bin/ash
sunxi#printenv
Init_disp_mode=1280x720p@60Hz-v
boot_fastboot=fastboot
boot_normal=sunxi_flash read 40007800 boot;boota 40007800
boot_recovery=sunxi_flash read 40007800 recovery;boota 40007800
bootcmd=run setargs_nand boot_normal
bootdelay=3
cma=40M
console=ttyS0,115200
earlyprintk=sunxi-uart,0x01c28000
enforcing=1
fastboot_key_value_max=0x8
fastboot_key_value_min=0x2
init=/bin/sh
initcall_debug=0
loglevel=0
mmc_root=/dev/mmcblk0p7
nand_root=/dev/system
partitions=boot-resource@nanda:env@nandb:boot@nandc:rootfs@nandd:ubuntufs@nande:sharevdi@nandf:UDISK@nandg
recovery_key_value_max=0x13
recovery_key_value_min=0x10
setargs_mmc=setenv bootargs enforcing=${enforcing} earlyprintk=${earlyprintk} initcall_debug=${initcall_debug} console=${console} loglevel=${loglevel} root=${mmc_root} init=${init} partitions=${partitions} cma=${cma} vmalloc=${vmalloc} Init_disp_mode=${Init_disp_mode}
setargs_nand=setenv bootargs enforcing=${enforcing} earlyprintk=${earlyprintk} initcall_debug=${initcall_debug} console=${console} loglevel=${loglevel} root=${nand_root} init=${init} partitions=${partitions} cma=${cma} vmalloc=${vmalloc} Init_disp_mode=${Init_disp_mode}
timeout=2
vmalloc=384MB
Environment size: 1728/131068 bytes
sunxi#help
? - alias for 'help'
base - print or set address offset
boot - boot default, i.e., run 'bootcmd'
boota - boota - boot android bootimg from memory
bootd - boot default, i.e., run 'bootcmd'
bootelf - Boot from an ELF image in memory
bootm - boot application image from memory
bootvx - Boot vxWorks from an ELF image
cmp - memory compare
cp - memory copy
crc32 - checksum calculation
delay_test- do a delay test
efex - run to efex
efex_test- do a usb efex test
env - environment handling commands
exit - exit script
false - do nothing, unsuccessfully
fastboot_test- do a sprite test
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls - list files in a directory (default /)
fdt - flattened device tree utility commands
fdt_test- fdt function test just in root directly
go - start application at address 'addr'
help - print command description/usage
interrupts- enable or disable interrupts
irqinfo - print information about IRQs
key_test- Test the key value
loop - infinite loop on address range
mass_test- do a usb mass test
md - memory display
memcpy_test- do a memcpy test
memtester- start application at address 'addr'
mm - memory modify (auto-incrementing address)
mmc - MMC sub system
mmcinfo - display MMC info
mw - memory write (fill)
nm - memory modify (constant address)
printenv- print environment variables
reset - Perform RESET of the CPU
run - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv - set environment variables
showvar - print local hushshell variables
shutdown- shutdown the system
sprite_test- do a sprite test
sunxi_card0_probe- probe sunxi card0 device
sunxi_flash- sunxi_flash sub-system
test - minimal test like /bin/sh
timer_test- do a timer and int test
timer_test1- do a timer and int test
true - do nothing, successfully
usb - USB sub-system
usbboot - boot from USB device
version - print monitor, compiler and linker version
sunxi#help usbboot
usbboot - boot from USB device
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment