PINE64
not able to flash u-boot onto SD Card - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: ROCK64 (https://forum.pine64.org/forumdisplay.php?fid=85)
+--- Forum: General Discussion on ROCK64 (https://forum.pine64.org/forumdisplay.php?fid=86)
+--- Thread: not able to flash u-boot onto SD Card (/showthread.php?tid=5210)



not able to flash u-boot onto SD Card - consoleadam - 10-04-2017

greetings,
I have manged to build u-boot as per http://opensource.rock-chips.com/wiki_U-Boot . However, after burning the images to SD card, booting stops before starting my built version of u-boot, i.e., no u-boot prompt!
Serial console output below, also, further down build details.

Can anyone please shed light whats wrong in the process ?
thanks 
consoleadam

serial output
========
 DDR version 1.06 20170424
In
LPDDR3
786MHz
Bus Width=32 Col=10 Bank=8 Row=15 CS=1 Die Bus-Width=32 Size=1024MB
ddrconfig:1
OUT
Boot1 Release Time: 2017-05-18, version: 2.43
ChipType = 0x11, emmc reinit
emmc reinit
SdmmcInit=2 20
SdmmcInit=0 0
BootCapSize=0
UserCapSize=7587MB
FwPartOffset=2000 , 0
StorageInit ok = 48039
Raw SecureMode = 0
SecureInit read PBA: 0x4
SecureInit read PBA: 0x404
SecureInit read PBA: 0x804
SecureInit read PBA: 0xc04
SecureInit read PBA: 0x1004
SecureInit ret = 0, SecureMode = 0
LoadTrustBL
No find bl30.bin
No find bl32.bin
Load uboot, ReadLba = 2000
Load OK, addr=0x200000, size=0x7b5f4
RunBL31 0x10000
NOTICE:  BL31: v1.3(debug):f947c7e
NOTICE:  BL31: Built : 09:28:45, May 31 2017
NOTICE:  BL31:Rockchip release version: v1.3
INFO:    ARM GICv2 driver initiapteed sec cpu_context!
INFO:    boot cpu mask: 1
INFO:    platng runtime services
WARNING: No OPTEE provided by BL2 boot loadTEE will return SMC_UNK
ERROR:   Error initializing runtime sernormal world
INFO:    Entry point address = 0x200000
INFO:
-------------------

Build and Flashing in details:
==================

consoleadam@barbarian:~/rock64$ git clone https://github.com/rockchip-linux/u-boot.git

consoleadam@barbarian:~/rock64/u-boot$ make ARCH=arm -j4 CROSS_COMPILE=aarch64-linux-gnu- distclean

consoleadam@barbarian:~/rock64/u-boot$ make ARCH=arm -j4 CROSS_COMPILE=aarch64-linux-gnu- evb-rk3328_defconfig all

BL2 ddr.bin & idbloader.img
-----------------------------
consoleadam@barbarian:~/rock64/u-boot$ dd if=../rkbin/rk33/rk3328_ddr_786MHz_v1.06.bin of=ddr.bin bs=4 skip=1

consoleadam@barbarian:~/rock64/u-boot$ tools/mkimage -n rk3328 -T rksd -d ddr.bin idbloader.img

consoleadam@barbarian:~/rock64/u-boot$ cat ../rkbin/rk33/rk3328_miniloader_v2.43.bin >> idbloader.img

BL3 trust.img & u-boot.img
----------------------------
consoleadam@barbarian:~/rock64/u-boot$ ../rkbin/tools/loaderimage --pack --uboot ./u-boot-dtb.bin uboot.img 0x200000



consoleadam@barbarian:~/rock64/u-boot$ cp ../rkbin/rk33/rk3328_loader_ddr786_v1.06.243.bin ./

consoleadam@barbarian:~/rock64/u-boot$ cat >trust.ini <<EOF
[VERSION]
MAJOR=1
MINOR=2
[BL30_OPTION]
SEC=0
[BL31_OPTION]
SEC=1
PATH=../rkbin/rk33/rk3328_bl31_v1.34.bin
ADDR=0x10000
[BL32_OPTION]
SEC=0
[BL33_OPTION]
SEC=0
[OUTPUT]
PATH=trust.img
EOF

consoleadam@barbarian:~/rock64/u-boot$ ../rkbin/tools/trust_merger trust.ini

flashing
---------
consoleadam@barbarian:~/rock64/u-boot$ sudo dd if=idbloader.img of=/dev/sdb seek=64 bs=512
consoleadam@barbarian:~/rock64/u-boot$ sudo dd if=uboot.img of=/dev/sdb seek=16384 bs=512
consoleadam@barbarian:~/rock64/u-boot$ sudo dd if=trust.img of=/dev/sdb seek=24576 bs=512


RE: not able to flashing u-boot to SD Card - consoleadam - 10-14-2017

FIXED
the trick was to re-create the paritions after dd'ing, as following:

making dummy system.img (of size 2000 MB)
--------------------------------------------
consoleadam@barbarian:~/rock64$ dd status=progress if=/dev/zero of=system.img bs=1M count=0 seek=2000 status=none

adding my custom built images to the dummy image
-----------------------------------------------------------------
consoleadam@barbarian:~/rock64$ umount /media/consoleadam/*
consoleadam@barbarian:~/rock64$ dd status=progress if=idbloader.img of=system.img seek=64 conv=fsync status=none
consoleadam@barbarian:~/rock64$ dd status=progress if=uboot.img of=system.img seek=16384 conv=fsync status=none
consoleadam@barbarian:~/rock64$ dd status=progress if=rk3328evb-trust.img of=system.img seek=24576 conv=fsync status=none

you can add kernel/rootfs images to dummy system.img from another built image as following:
-------------------------------------------------------------------------------------------------------------
consoleadam@barbarian:~/rock64$ dd status=progress if=jessie-openmediavault-rock64-0.5.10-118-arm64.img of=system.img seek=32768 skip=32768 count=229376 conv=fsync status=none
consoleadam@barbarian:~/rock64$ dd status=progress if=jessie-openmediavault-rock64-0.5.10-118-arm64.img of=system.img seek=262144 skip=262144 count=4194304 conv=fsync status=none
consoleadam@barbarian:~/rock64$ sync

re-partitioning the dummy image
--------------------------------------
consoleadam@barbarian:~/rock64$ parted -s system.img mklabel gpt
consoleadam@barbarian:~/rock64$ parted -s system.img unit s mkpart loader1 64 8063
consoleadam@barbarian:~/rock64$ parted -s system.img unit s mkpart reserved1 8064 8191
consoleadam@barbarian:~/rock64$ parted -s system.img unit s mkpart reserved2 8192 16383
consoleadam@barbarian:~/rock64$ parted -s system.img unit s mkpart loader2 16384 24575
consoleadam@barbarian:~/rock64$ parted -s system.img unit s mkpart atf 24576 32767
consoleadam@barbarian:~/rock64$ parted -s system.img unit s mkpart reserved3 32768 262143
consoleadam@barbarian:~/rock64$ parted -s system.img unit s mkpart root 262144 100%
consoleadam@barbarian:~/rock64$ parted -s system.img set 7 boot on

below in one go:
-----------------

consoleadam@barbarian:~/rock64$ parted -s system.img mklabel gpt; \
> sync; \
> parted -s system.img unit s mkpart loader1 64 8063; \
> sync; \
> parted -s system.img unit s mkpart reserved1 8064 8191; \
> sync; \
> parted -s system.img unit s mkpart reserved2 8192 16383; \
> sync; \
> parted -s system.img unit s mkpart loader2 16384 24575; \
> sync; \
> parted -s system.img unit s mkpart atf 24576 32767; \
> sync; \
> parted -s system.img unit s mkpart reserved3 32768 262143; \
> parted -s system.img unit s mkpart root 262144 100%; \
> sync;\
> parted -s system.img set 7 boot on


burning the dummy image to SDcard
-------------------------------------------
consoleadam@barbarian:~/rock64$ sudo dd status=progress if=system.img of=/dev/sdb conv=fsync

Note that you can only dd specific parts [dd status=progress if=idbloader.img of=system.img seek=64 conv=fsync status=none] directly to SDcard instead of to dummy image (system.img) but also make sure to repartition the SDcard after dd'ing!


RE: not able to flash u-boot onto SD Card - gene83 - 02-16-2018

See "below in one go" above, can this all be done on the rock64, ending up on an sdcard plugged into a reader on a usb hub? I have most of the work files except "linux build-master.zip already installed on a 1T spinning rust drive on the usb3 port. Along with a prebuilt realtime kernel v4.14.15-rc13 waiting to be tested. I have installed quite a bit of stuff to a minimal stretch ayufan published, and I'd like to have all that available on the new sdcard when I swap it from the reader to the boot socket.

Following the instructions in that linux-build-master.zip, I have it up to finishing the qemu-stuff install, but binfmt-misc gives errors. I there a better name for that?
====
rock64@rock64:/media/slash/home/rock64/v4.14.15-rt13$ sudo apt install binfmt-misc
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package binfmt-misc
====
stretch has a package whose description reads like I would expect for a -misc, so I installed that. No idea if its works yet. binfmt-support/stable,now 2.1.6-2 arm64 [installed]

And, although docker and docker-compose are installed on the rock64, the only response I can get looks like a long helpmsg from docker-compose. Docker is not to be found in the xfce menu's, nor from a terminal, nor does it show up in the app box at bottom center of the screen.
This is my first experience with docker, so I'll need some tutoring.

synaptic claims its a gtk/kde app, and its actually running xfce, at a screen resolution thats displayable on a 1366x768 monitor, running at 1280x760 but the fonts are just fuzzed up enough its difficult to read. Is there any help for that? The display configurator id's the monitor as a 19" AOC, which is correct, but only offers 800x600 and 1280x760. Fugly fonts.

Lots of questions I'm afraid.

Many Thanks, gene83