au Qua Station - Part 3 - Getting a connection
In our previous installment, so we discussed before how the stock software is relatively useless at this point (and seemingly useless to begin with).
Of the machines I ordered, one had been "activated" and never reset, so I was actually able to connect to it after hacking Windows in a VM to enable SMBv1 compatibility - but that is not really all that useful to me.
By the way, most of the machines I received were unused and uopened - not bad for less than $20 USD.
Comparable boards using the same chipset, such as the Banana Pi, go for over $100 on Amazon Japan. This one includes a NAS Grade 1TB HDD, which by itself it worth more than the $20.
Some people apparently know that and buy up the QuaStations, rip out the HDDs, and then re-sell them without HDDs for more like $5. That is no problem for me because I had a bunch of 1TB HDDs lying around anyway.
As you can see, it is easy enough to insert an SSD into the drive carrier and it works fine.
Now, onto the real star of the show: Since this machine has no HDMI out jack, the connection to the console is via TTL serial. That means that unless your computer has a compatible port already (unlikely), you need to buy an adaptor. Luckily, USB to serial adaptors are dirt cheap. They can be found them on Amazon, such as this one. I got a 3 pack for around $5 US.
I didn't see any with USB C, but that issue was easy enough to solve with an adaptor.
Although the Qua station has four pins, you only actually need to connect 3 of the wires.
At least for the model linked above, the wires will go in the same order on the adaptor and the Qua Station from left to right if you turn the unit so that the LED faces up and arrange the Qua Station so that the side with the power jack faces you. (i.e. Orange, Red, Brown in this case).
I used Minicom on OS X, but if you are on OS X, ZOC (Zap-o-com) or iTerm would also work fine. For Linux, Minicom is my choice, and if you are stuck with Windows Tera term is satisfactory. (Although for Windows, I would just use WSL with Ubuntu and Minicom...)
I didn't need to install any driver, but you will need to figure out what port the USB adaptor is showing up as and set that up in your program.
In Linux or OS X, you can use dmesg, and in Windows you can use the device manager. (Actually in OS X, it is probably easiest just to do "ls /dev/cu.*", and then look for the device you don't recognize.
You need to set your serial port settings to 115200 baud, N, 1.
If you are using Minicom, you can use "minicom -s" to enter the setup screen.
The example above is from OS X, on Linux, the serial converter will typically show up as /dev/ttyUSB0.
Note that on Windows, the COM port may change depending on which USB port you plug the adaptor into and which way the wind is blowing.
Once this is set up properly, plug in the power, and lots of stuff will scroll by. Actually here is the dump:
C1:80000000C2?C3hswitch frequency to 0x00000046frequency divider is 0x00000080switch frequency to 0x00000046frequency divider is 0x00000004switch to SDR 8 bitswitch bus width to 0x00000008 bits successhwsetting size: 000005E0C4f5-5Goto FSBL: 0x10100000<=============================================>fsbl_main: sys_secure_type = 0x0000BEEEfsbl_main: sys_boot_type = 0x00000002fsbl_main: sys_boot_enc = 0x00000000fsbl_main: sys_bisr_done = 0x00000000sys_hwsetting_size:00000600sys_bootcode_size:000B31C0sys_secure_fsbl_size:00010B80sys_secure_os_size:00067B00sys_bl31_size:00005040sys_rsa_key_fw_size:00000000sys_rsa_key_tee_size:00000000sys_rescue_size:00000000HwSetting:hwsetting_blk_no:00000100hwsetting_total_size:00000680hwsetting_blk_count:00000004Bootcode:bootcode_blk_no:00000104bootcode_total_size:000B31E0bootcode_blk_count:00000599FSBL:secure_fsbl_blk_no:0000069Dsecure_fsbl_total_size:00010BA0secure_fsbl_blk_count:00000086TEE OS:secure_os_blk_no:00000723secure_os_total_size:00067B20secure_os_blk_count:0000033EBL31:bl31_blk_no:00000A61bl31_total_size:00005060bl31_blk_count:00000029RSA Key Fw:rsa_key_fw_blk_no:00000A8Arsa_key_fw_total_size:00000000rsa_key_fw_blk_count:00000000RSA Key TEE:rsa_key_tee_blk_no:00000A8Arsa_key_tee_total_size:00000000rsa_key_tee_blk_count:00000000Rescue:rescue_blk_no:00000A8Arescue_total_size:00000000rescue_blk_count:00000000********** FW_TYPE_GOLD_TEE **********fwInfo->fwType: 00000023fwInfo->isGolden: 00000001fwInfo->ddrReadAddr: 00520000fwInfo->ddrDestAddr: 10200000fwInfo->flashType: 00000002fwInfo->flashUnitSize: 00000200fwInfo->flashOffset: 000E4600fwInfo->dataSize: 00067B20body_size:00067B00flash_unit_no:00000723flash_unit_count:0000033Ereal_size:00067AECsha256 Fw********** FW_TYPE_GOLD_BL31 **********fwInfo->fwType: 00000028fwInfo->isGolden: 00000001fwInfo->ddrReadAddr: 00520000fwInfo->ddrDestAddr: 10120000fwInfo->flashType: 00000002fwInfo->flashUnitSize: 00000200fwInfo->flashOffset: 0014C200fwInfo->dataSize: 00005060body_size:00005040flash_unit_no:00000A61flash_unit_count:00000029real_size:00005018sha256 Fw********** FW_TYPE_BOOTCODE **********fwInfo->fwType: 00000001fwInfo->isGolden: 00000001fwInfo->ddrReadAddr: 00520000fwInfo->ddrDestAddr: 00020000fwInfo->flashType: 00000002fwInfo->flashUnitSize: 00000200fwInfo->flashOffset: 00020800fwInfo->dataSize: 000B31E0body_size:000B31C0flash_unit_no:00000104flash_unit_count:00000599real_size:000B3180sha256 Fwj bootcode jump address:0002000064bSHG0001W-D111.1.2.162CPU : Cortex-A53 quad core - AARCH32Board: Realtek QA BoardDRAM: 0 BytesWatchdog: DisabledCache: EnabledNon-Cache Region: 1 MB@0x07900000MMC: RTD1295 eMMC: 0mmc->version=0x00010000version=0x00000004[LY] cardtype=57, mmc->card_caps=0f[LY] freq = 00464388, clk diver = 00000080[LY] speed up emmc at HS-200[LY] HS-200 bus width=2[LY] mmc->boot_caps = 20bTEMP TX_WINDOW=0x7fffffff, TX_best=0xfRX_WINDOW=0xffffc03f, RX_best=0x19TX1_WINDOW=0x3fffff80, TX_best=0x12[LY] hs200 : 0[HC] WPG_SIZE = 8388608Device: RTD1295 eMMCManufacturer ID: 15OEM: 100Name: 8GME4Tran Speed: 5f5e100Rd Block Len: 512MMC version 4.0High Capacity: NoCapacity: 7.3 GiBBus Width: 8-bitSpeed: HS200Factory: MMCFactory: pp:1, seq#:0x59, size:0x21e00------------can't find tmp/factory/000BootParam.hIn: serialOut: serialErr: serialNet: Realtek PCIe GBE Family Controller mcfg = 0024dev->name=r8168#0Hit Esc or Tab key to enter console mode or rescue linux: 2------------can't find tmp/factory/recoveryWPS button => 1reset button => 1Current AdbStatus=offCurrent Power status 1 =onCurrent Power status 2 =on======== Checking into android recovery ====0@sz0: exit
Eventually, it will stop, and if enter is pressed, it will drop to a prompt like this:
kylin#
This is a root prompt for Android Linux.
Some standard linux commands, like dd, df, and mount are there, while others are not.
Android is not your standard linux distribution, so files are not where you would expect them to be if you know linux. f.e. /etc/fstab isn't present, but there is another similar file.
Also, the standard commands are just based on busy box, so the typical options may not work. f.e. df works, but df -h does not.
The "mount" command doesn't help you much since basically everything is mounted via FUSE.
The /dev folder is not what you would expect, so trying to mount a drive manually is not easy, and the system automatically mount USB drives - but only if they are FAT formatted.
Still, you can play around here, and even exfiltrate files you think might be useful. Have a look in the /vendor directory, for example.
Note that pressing buttons causes status messages to display on the console.
The root filesystem is mounted read-only, but if you know how, you can actually remount is as read-write (I looked in init.rc for hints).
Some people have even run Debian and Arch by using chroot from here with this stock Android kernel.
Once you have entertained yourself enough, you may want to know how to get into the bootloader. hold down the esc key on your computer and press the power button for around 5 seconds. If you wait for about 20 seconds (keep holding ESC!), then the system will shut down, reboot, and stop.
A prompt like the following should be displayed:
If you see this, you are at the u-boot prompt. If you see the kylin# prompt, you missed it, so you have to remove and reinsert the power plug and try again.
The point where you can enter u-boot is where it displays:
======== Checking into android recovery ====
0
In order to make this process easier for future boots, you can set up a delay using:
env set bootdelay 5
env save
From the next boot, u-boot will count down before continuing the boot process. If ESC is pressed, it will drop to the Realtek> prompt. Note that the boot loader is a two stage loader, so whatever delay you put in here will happen twice. For me, two seconds is more than enough to be able to hit the escape key in time.
From here you can do things like boot from USB or eMMC.
Luckily, someone figured out that there is a set top box with the same chipset made by a company called Zidoo (The Zidoo X9S - which, interestingly, costs around $250!), and they have a Linux rescue image available here or here which we can use.
There is a post here by a blogger explaining in detail how to use this, but basically:
1. On a computer, download and extract the file, it will look like this:
3. Stick the USB disk into one of the USB ports of the Qua Station and boot it up to the Realtek> prompt.
4. Type "goru".
Note: If you have played around with the environment variables (such as bootargs) in the Qua Station you are using before, then this may not work smoothly, as the rescue kernel will read those and try to follow them.
If all goes well, you will be sitting at a linux prompt in a few seconds. This rescue environment is based on OpenWRT, but it is still much more "normal" than an Android environment, and can be used for various things, including burning a new kernel into the eMMC (more about that in a blog entry by U-Haru here).
Looking at the u-boot and dmesg output, one interesting thing is that there are "phantom devices" for audio, video, ethernet and other features that are part of the chipset but a physical port hasn't been added to the board. This means that (for example) even though video is not displayed, there is actually a frame buffer.
This rescue environment only boots up with 500MB of RAM, but that can be changed by altering which DTB is used.
/sys/class/net # cat /proc/meminfoMemTotal: 582152 kBMemFree: 523412 kBMemAvailable: 525452 kB
One can even set up a root filesystem on an SD card or HDD and pass it to this kernel to run Ubuntu 16, etc. (Both this kernel and the au kernel are based on 4.1.17). Since this kernel is designed for rescue use, it may not have every feature you want.
It does, however, have support for two gigabit ethernet dongles I tried:
[ 933.256835] cdc_ether 1-1:2.0 eth1: register 'cdc_ether' at usb-xhci-hcd.4.auto-1, CDC Ethernet Device, 28:ee:52:15:e0:eb[ 1013.085061] ax88179_178a 2-1:1.0 eth1: register 'ax88179_178a' at usb-xhci-hcd.4.auto-1, ASIX AX88179 USB 3.0 Gigabit Ethernet, 50:c40
Once you're done playing here, you'll probably want to know how to set up things to boot automatically so that you don't need to keep a serial console connected forever.
Next entry - au Qua Station - Part 4 - Kernel Build & Install
Comments
Post a Comment