Tanix TX6

    • Official Post

    *** Your GCC is older than 6.0 and is not supported

    I think this issue is pretty self-explanatory. If you don't have new enough gcc, you can always download one from linaro page. If you want to use linaro toolchain, just extract it in one folder and execute export CROSS_COMPILE=/path/to/linaro/compiler/arm-linux-gnueabihf- (just replace "/path/to/linaro/compiler" with absolute path where you extracted linaro gcc).

    CONFIG_MACH_SUN50I_H6_32=y

    CONFIG_DRAM_SUN50I_H6=y /* this was previously not set */

    CONFIG_DRAM_SUN50I_H6 is for 64-bit build, while CONFIG_MACH_SUN50I_H6_32 is for 32-bit. Note that libdram is 32-bit library, so it can be linked only with 32-bit SPL, so CONFIG_MACH_SUN50I_H6 should not be set.

    CONFIG_NR_DRAM_BANKS=2 /* this was previously 1 - my box has 4GB RAM - what should this be set to???*/

    This should be set to 1 for all Allwinner boards on all SoCs. It has nothing to do with amount of RAM, but how many memory regions there are. All Allwinner SoCs have whole DRAM mapped in one continuous region. Actually, there are other dislocated small SRAM regions, but they have special purpose so they don't count.

    CONFIG_DEFAULT_DEVICE_TREE="sun50i-h6-tanix-tx6" /* changed the device tree name - should it be changed back???? */

    At the end, it will be changed to "sun50i-h6-tanix-tx6", but this file doesn't exist yet and it currently doesn't matter much. Most, if not all, Allwinner boards follow common design, so for very basic functionality almost doesn't matter which DT you use in U-Boot. Linux is however different story, but we are not there yet. Just keep original value for now.

    • Official Post

    Is the next step to copy this file to an SD card (formatted as FAT32)??

    Filesystem type doesn't matter because we will work on SPL itself (SPL - secondary program loader, this loads U-Boot binary). U-Boot also supports many filesystems, so FAT32 is not requirement, it could also be ext4 or something else.

    Anyway, 32-bit U-Boot without ATF (ARM trust firmware) and without correct DT can't really boot Linux. As I said earlier, it's only to examine how libdram intializes DRAM.

    You can burn U-Boot by executing sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8 (replace sdX with actuall device name, check dmesg after you plugged in your SD card). Please double check device name, you don't want to corrupt your PC disk.

  • Filesystem type doesn't matter because we will work on SPL itself (SPL - secondary program loader, this loads U-Boot binary). U-Boot also supports many filesystems, so FAT32 is not requirement, it could also be ext4 or something else.

    Anyway, 32-bit U-Boot without ATF (ARM trust firmware) and without correct DT can't really boot Linux. As I said earlier, it's only to examine how libdram intializes DRAM.

    You can burn U-Boot by executing sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8 (replace sdX with actuall device name, check dmesg after you plugged in your SD card). Please double check device name, you don't want to corrupt your PC disk.

    I get the following in Ubuntu. It sees my sd card as /dev/sdb1, and shows that it writes data to the card (or so it appears), but the card is empty?? I'm hoping it's something simple I missed. Very new to ubuntu and the various commands.

    mark@mark-VirtualBox:~/u-boot$ sudo fdisk -l

    Disk /dev/sda: 160.4 GiB, 172197150720 bytes, 336322560 sectors

    Units: sectors of 1 * 512 = 512 bytes

    Sector size (logical/physical): 512 bytes / 512 bytes

    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Disklabel type: dos

    Disk identifier: 0x7b0db11c


    Device Boot Start End Sectors Size Id Type

    /dev/sda1 * 2048 325560319 325558272 155.2G 83 Linux

    /dev/sda2 325560320 336322559 10762240 5.1G 5 Extended

    /dev/sda5 325562368 336322559 10760192 5.1G 82 Linux swap / So



    Disk /dev/sdb: 29.9 GiB, 32044482560 bytes, 62586880 sectors

    Units: sectors of 1 * 512 = 512 bytes

    Sector size (logical/physical): 512 bytes / 512 bytes

    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Disklabel type: dos

    Disk identifier: 0x00253ab3


    Device Boot Start End Sectors Size Id Type

    /dev/sdb1 2048 62586879 62584832 29.9G c W95 FAT32 (LBA)

    mark@mark-VirtualBox:~/u-boot$ sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdb1 bs=1024 seek=8

    355+1 records in

    355+1 records out

    364324 bytes (364 kB, 356 KiB) copied, 1.30929 s, 278 kB/s

  • Note that sdb1 means partition. You want to write to raw SD card, which is achieved by removing the number, so you should use only /dev/sdb

    Still nothing showing up. I am using a USB card adapter which contains the SD card. Can't I just drag and drop the file to the SD card??:-

    mark@mark-VirtualBox:~/u-boot$ sudo fdisk -l

    [sudo] password for mark:

    Disk /dev/sda: 160.4 GiB, 172197150720 bytes, 336322560 sectors

    Units: sectors of 1 * 512 = 512 bytes

    Sector size (logical/physical): 512 bytes / 512 bytes

    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Disklabel type: dos

    Disk identifier: 0x7b0db11c

    Device Boot Start End Sectors Size Id Type

    /dev/sda1 * 2048 325560319 325558272 155.2G 83 Linux

    /dev/sda2 325560320 336322559 10762240 5.1G 5 Extended

    /dev/sda5 325562368 336322559 10760192 5.1G 82 Linux swap / So

    Disk /dev/sdb: 29.9 GiB, 32044482560 bytes, 62586880 sectors

    Units: sectors of 1 * 512 = 512 bytes

    Sector size (logical/physical): 512 bytes / 512 bytes

    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Disklabel type: dos

    Disk identifier: 0x00253ab3

    Device Boot Start End Sectors Size Id Type

    /dev/sdb1 2048 62586879 62584832 29.9G c W95 FAT32 (LBA)

    mark@mark-VirtualBox:~/u-boot$ sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdb bs=1024 seek=8

    355+1 records in

    355+1 records out

    364324 bytes (364 kB, 356 KiB) copied, 0.0218032 s, 16.7 MB/s

    EDIT: I went ahead and just dragged and dropped the file to the sd card and inserted it into the TX6 and switched on with UART connected and attached is log of that. It mentions RAM of 2gb in the log, should that not be 4gb? The box is 4gb ram and 64gb rom (or supposed to be).

    h6-test1.txt

    Edited 5 times, last by ukmark62 (June 8, 2019 at 3:52 PM).

  • ukmark62 that dd command jernej gave you before means that you take the spl file as input (if=) and are writing it to your sdb as an output (of=) with a blocksize of 1024 (bs=) and before you write you skip 8 blocks (seek=)

    So all you do is write the raw bits of your spl in the empty space between the MBR of the card and the first partition (sdb1)

    So you won't see any files, but the rom bootloader code of the H6 checks at this very location for a magic number of a bootloader and if present loads the spl.

  • ukmark62 that dd command jernej gave you before means that you take the spl file as input (if=) and are writing it to your sdb as an output (of=) with a blocksize of 1024 (bs=) and before you write you skip 8 blocks (seek=)

    So all you do is write the raw bits of your spl in the empty space between the MBR of the card and the first partition (sdb1)

    So you won't see any files, but the rom bootloader code of the H6 checks at this very location for a magic number of a bootloader and if present loads the spl.

    Thanks so much for that - I was really confused. All this stuff is greek to me. Big learning curve ahead. So basically, I will still have an empty sd card after the dd command - but the file is there and hidden. I'll give it a go later and let you know how it goes - thx again :thumbup:

  • Thanks so much for that - I was really confused. All this stuff is greek to me. Big learning curve ahead. So basically, I will still have an empty sd card after the dd command - but the file is there and hidden. I'll give it a go later and let you know how it goes - thx again :thumbup:

    You are welcome!

    I'll try to answer whatever I can. I'm just kind of an advanced linux user, by no means I'm a developer.

    If you are interested in what dd does try man dd in a console window, or well... dd(1) - Linux manual page

    Its not perfect, neither specifically for H6, but its an intro to the boot process: http://linux-sunxi.org/boot_process

    http://linux-sunxi.org/bootable_sd_card

    Edited 2 times, last by lumpi (June 8, 2019 at 10:19 PM).

  • You are welcome!

    I'll try to answer whatever I can. I'm just kind of an advanced linux user, by no means I'm a developer.

    If you are interested in what dd does try man dd in a console window, or well... dd(1) - Linux manual page

    Its not perfect, neither specifically for H6, but its an intro to the boot process: http://linux-sunxi.org/boot_process

    http://linux-sunxi.org/bootable_sd_card

    I repeated the process and the sd card was "empty". Inserted into the Tanix TX6 box and switched on with UART connected. The log is the same as I posted earlier - thinking about it, it would be the same. All those times when I was dd'ing to /dev/sdb and thinking it was doing nothing, it was in fact overwriting the .bin file (even though I couldn't see it). So all is well and I understand a little more........

    • Official Post

    It mentions RAM of 2gb in the log, should that not be 4gb? The box is 4gb ram and 64gb rom (or supposed to be).

    H6 only supports 3 GiB of memory, so if you have it 4 GiB on board, you should see 3 GiB reported in U-Boot.

    There are two possible reasons why you see 2 GiB reported:

    1. libdram supports only power of two sizes

    2. Eachlink board has only 2 GiB of RAM and there is a hack for that.

    In any way, when DDR3 support will be fixed, you should see 3 GiB reported.

  • H6 only supports 3 GiB of memory, so if you have it 4 GiB on board, you should see 3 GiB reported in U-Boot.

    There are two possible reasons why you see 2 GiB reported:

    1. libdram supports only power of two sizes

    2. Eachlink board has only 2 GiB of RAM and there is a hack for that.

    In any way, when DDR3 support will be fixed, you should see 3 GiB reported.

    What would be the next step for me to do? Thx.

    • Official Post

    What would be the next step for me to do? Thx.t

    Now the fun begins. First of all, make a backup of those binaries, they will be useful to check out register values at later time. Better yet, make another clone of that git repository in another folder, like this:

    git clone https://github.com/apritzel/u-boot.git u-boot-dram-wip

    go into that folder and execute:

    Code
    git checkout 7702a7c2b1ef4c56fc6fd6b7605f81ede82a07db
    git checkout -b h6-ddr3

    Important, you need 64-bit ARM GCC for that, including correct CROSS_COMPILE value.

    Now you will have U-Boot with work in progress H6 DDR3 driver. Building instructions still applies here, except that libdram is no longer used. This code is just few commits back from libdram one.

    We will have to fix arch/arm/mach-sunxi/dram_sun50i_h6.c and arch/arm/mach-sunxi/dram_timings/h6_ddr3_1600.c .

    This is also perfect time to get familiar with our primary sources of information for this job. File arch/arm/include/asm/arch-sunxi/dram_sun50i_h6.h has a lot of useful references to similar DRAM controllers with documentation available. It would be useful to obtain a copy of pdf or find a web page with docs.

    So from now on it's modify above files, build new U-Boot, flash it on SD card and test if it helps anything. Standard debug practice is to add printf(), so you can see final register values and compare to the working ones from libdram version.

    I will help you with ideas what to change based on reverse engineering libdram and looking what it does for DDR3.

    BTW, I'll ask moderators to split this conversation to a new thread.

  • Can you share a photo where UART is connected on TX6 ? I have this model, I want to check out the work of the new u-boot.

    Sure.

    Link here:-MEGA

    On first picture (DSC00020,jpg), look at the 5 horizontal small holes at the bottom right inside a white rectangle box. I had to de-solder these 5 holes. Then used 5 header pins to connect to UART. From left to right - they are RX, next 2 are not used,GND,TX.

    I'm trying to help jernej with adding this box to LibreELEC, but I'm afraid I have very little idea on what to do. All 3 lights are lit on the UART device (1 red and 2 blue). I can get UART logs and can compile u-boot (all with jernej help), but changing the u-boot source code to fix it for DDR3 is beyond me.:(

    Would be great if you could help.

    Edited once, last by ukmark62 (June 10, 2019 at 1:53 PM).