[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Cubieboard4, u-boot, flash-kernel



Am 2016-01-11 um 21:52 schrieb Vagrant Cascadian:
> On 2015-12-29, Ian Campbell wrote:
>> On Tue, 2015-12-29 at 12:15 +0100, Karsten Merker wrote:
>>> On Mon, Dec 28, 2015 at 02:45:33PM -0800, Vagrant Cascadian wrote:
>>>> I'm trying to get a Cubieboard4 board booting.
>>>>
>>>> It looks like the Cubieboard4 has support in mainline linux since
>>> at
>>>> least 4.2 (so should work with jessie-backports), but I can't find
>>> a
>>>> u-boot that will boot it...
> ...
>>> Generic A80 support (Clocks, PIO, RSB, UART, MMC) is available in
>>> mainline u-boot since v2015.07, but you are of course right - a
>>> CC-A80-specific config has indeed not yet entered the mainline
>>> u-boot git, so adding the flash-kernel stanza was probably a bit
>>> premature.
>>
>> I'd expect that a pretty trivial modification to
>>  configs/Merrii_A80_Optimus_defconfig (to switch the
>>  CONFIG_DEFAULT_DEVICE_TREE option over) would result in something
>> useful, but I've not tried it (need to setup my CB4, apply h/sink etc).
> 
> I gave this a quick try, but it wouldn't build an SPL image, and the
> image it did built didn't work with whatever SPL was already
> on-board. I may just not have the right offsets, though.

I've also tried booting a current u-boot from sdmmc, but without success
(NB: I've almost no experience with u-boot): I've compiled (on a 2nd CB4
running Cubietech's wheezy server image) a current u-boot (commit
077678eb0c226e52a1f90edabd3369ab26065b32, 2016-01-12) with
 make distclean
 make Cubieboard4_config
 make all
where I've created a file configs/Cubieboard4_defconfig in advance with
these contents:
CONFIG_ARM=y
CONFIG_ARCH_SUNXI=y
CONFIG_MACH_SUN9I=y
CONFIG_DRAM_CLK=360
CONFIG_DRAM_ZQ=123
CONFIG_SYS_CLK_FREQ=1008000000
CONFIG_MMC0_CD_PIN="PH18"
# CONFIG_VIDEO is not set
CONFIG_DEFAULT_DEVICE_TREE="sun9i-a80-cubieboard4"
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
# CONFIG_CMD_IMLS is not set
# CONFIG_CMD_FLASH is not set
# CONFIG_CMD_FPGA is not set
CONFIG_CMD_GPIO=y
CONFIG_SYS_NS16550=y

Experimenting for quite some time I've learnt a few things:

* When putting u-boot.bin onto to sdmmc at offset 8k the system boots
from NAND instead. (I guess the ROM expects the 'eGON.BT0' byte sequence
at 8196.)

* So I copied the first 25MB of cubietech's (installed&running) server
image. At offset 8k it has the boot0 code (less than 32k). (See
https://github.com/allwinner-zh/bootloader/tree/master/basic_loader/boot0).

* The next storage area on the sdmmc (40k+) is not used for u-boot (
I can 'dd if=/dev/zero of=/dev/sda bs=1024 seek=40 count=300' and still
load Cubietech's u-boot-sunxi).

* In fact, at offset 19096k on the sdmmc (38192 sectors, cf.
BOOT1_START_SECTOR_IN_SDMMC in
https://github.com/allwinner-zh/bootloader/blob/master/basic_loader/bsp/bsp_for_a80/include/interinc/spare_head.h)
we find a 'uboot_file_head' (same link) comprising a
'spare_boot_ctrl_head' and a 'spare_boot_data_head' of size 1280 bytes
prepended to a u-boot.bin .

* When I replace this u-boot.bin (at offset 0x12A6500) with my
self-compiled current u-boot and adjust the checksum in
'spare_boot_ctrl_head' (which boot0 checks before 'Jump to secend
Boot.'), then nothing happens on the serial console after boot0 executes
the jump.

At this point I'm stuck. I've no idea how to debug u-boot (without JTAG
and without experience).

Using Cubietech's u-boot-sunxi I've also verified that the
uboot_file_head with subsequent u-boot get's loaded into RAM at
0x2a000000 (which ist different from the other allwinner SOCs where it
is 0x4a000000).

I hope you or somebody else can make use of this information.
If I can contribute anything, please let me know.

Let me also use this occasion to thank you all for your work. I'm a very
happy user of debian on a few cubieboards (and otherwise too), one of
them being a cubietruck to which my keyboard and mouse are connected.

Regards, ibu


Reply to: