Jump to content
wahaha

how to build uboot.img, trust.img and flash them onto an empty sd card?

Recommended Posts

I am referring to https://github.com/TinkerBoard-Linux where the newer kernel 5.10 is found.

I want to build the uboot.img and trust.img and flash them onto an empty SD card. meaning, there's no partition on it yet.

How should i do it?

Note: I am familiar with how to build a kernel. but not sure how to flash it onto empty sd card also.

 

I found the partition list here http://opensource.rock-chips.com/wiki_Partitions --> should i just sudo dd and write them into the respective locations and thats it?

Share this post


Link to post
Share on other sites

FYI - I am trying to install Fedora server on the tinkerboard 2s. not debian.

Share this post


Link to post
Share on other sites

hello @wahaha,

to generate uboot.img for sd cards:

1. please compile the .img with command (aka 'the normal way' to compile .imgs) 

./build.sh

2. use sdboot.sh to overwrite the device/rockchip/common/scripts/sdboot.sh in the sources

sdboot.sh can be downloaded here: https://www.asuswebstorage.com/navigate/a/#/s/8D32B97F2E6D428A9344DB456B2CC5464

3. generate sd_uboot.img with command 

sudo ./device/rockchip/common/scripts/sdboot.sh -t uboot

the sd_uboot.img will be located in rockdev directory

4. flash sd_uboot.img to sd card -- you can either use tools like balenaetcher or the sudo dd command

 

 

Share this post


Link to post
Share on other sites
Posted (edited)

Hi @tooz,

Sorry I missed your reply..!

I was revisiting this again, but i don't see where ./build.sh is. I cloned https://github.com/TinkerBoard-Linux/rockchip-linux-u-boot which is for kernel 5.10 uboot it seems. but can't seem to build the uboot.

2nd qns: the guide you posted above is purely to build the uboot right? I still have to build the kernel separately, and the OS image?

Can you share how the OS image can also be flashed onto the sdcard please?

 

Thank you,

 

Edited by wahaha

Share this post


Link to post
Share on other sites

hello @wahaha

you still need to download all the sources and build a complete os image in order to make the sd card work; unfortunately only building u-boot image is not enough. the easiest way is to compile the complete .img and then change the rootfs

to compile u-boot:

git clone https://github.com/TinkerBoard-Linux/rockchip-linux-rkbin.git
mv rockchip-linux-rkbin rkbin
git clone https://github.com/TinkerBoard-Linux/rockchip-linux-prebuilts-gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.git
git clone https://github.com/TinkerBoard-Linux/rockchip-linux-u-boot.git
cd rockchip-linux-u-boot
./make.sh tinker_board_2 CROSS_COMPILE=/path/to/rockchip-linux-prebuilts-gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-

*please change the path of CROSS_COMPILE=/ to where rockchip-linux-prebuilts-gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu- is located
 

Share this post


Link to post
Share on other sites

hi @tooz,

I get met with the error:

./make.sh tinker_board_2 CROSS_COMPILE=/home/rockchip-linux-prebuilts-gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
grep: .config: No such file or directory
grep: .config: No such file or directory
## make tinker_board_2_defconfig -j24
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
In file included from scripts/kconfig/zconf.tab.c:2470:
In function 'dep_stack_insert',
    inlined from 'sym_check_print_recursive' at scripts/kconfig/symbol.c:1123:3,
    inlined from 'sym_check_deps' at scripts/kconfig/symbol.c:1300:3:
scripts/kconfig/symbol.c:1099:19: warning: storing the address of local variable 'cv_stack' in 'check_top' [-Wdangling-pointer=]
 1099 |         check_top = stack;
      |         ~~~~~~~~~~^~~~~~~
scripts/kconfig/symbol.c: In function 'sym_check_deps':
scripts/kconfig/symbol.c:1120:26: note: 'cv_stack' declared here
 1120 |         struct dep_stack cv_stack;
      |                          ^~~~~~~~
scripts/kconfig/symbol.c:1090:4: note: 'check_top' declared here
 1090 | } *check_top;
      |    ^~~~~~~~~
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
make: /home/rockchip-linux-prebuilts-gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc: No such file or directory
/bin/sh: /home/rockchip-linux-prebuilts-gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc: not found
BusyBox v1.36.1 (2024-05-21 13:38:37 UTC) multi-call binary.

Usage: dirname FILENAME

Strip non-directory suffix from FILENAME
scripts/kconfig/conf  --silentoldconfig Kconfig
  CHK     include/config.h
  UPD     include/config.h
  CFG     u-boot.cfg
/bin/sh: /home/rockchip-linux-prebuilts-gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc: not found
  GEN     include/autoconf.mk.dep
/bin/sh: /home/rockchip-linux-prebuilts-gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc: not found
make[1]: *** [scripts/Makefile.autoconf:79: u-boot.cfg] Error 1
make[1]: *** Waiting for unfinished jobs....
  CFG     spl/u-boot.cfg
make[1]: *** [scripts/Makefile.autoconf:50: include/autoconf.mk.dep] Error 1
  CFG     tpl/u-boot.cfg
/bin/sh: /home/rockchip-linux-prebuilts-gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc: not found
/bin/sh: /home/rockchip-linux-prebuilts-gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc: not found
make[1]: *** [scripts/Makefile.autoconf:83: spl/u-boot.cfg] Error 1
make[1]: *** [scripts/Makefile.autoconf:87: tpl/u-boot.cfg] Error 1
make: *** No rule to make target 'include/config/auto.conf', needed by 'include/config/uboot.release'.  Stop.

Am I missing something?

Share this post


Link to post
Share on other sites

Also, I am cross_compiling it on my desktop pc (so not directly on the arm64 tinkerboard).

Share this post


Link to post
Share on other sites
Posted (edited)

Hi @tooz,

I've successfully ran

./make.sh tinker_board_2 CROSS_COMPILE=/path/to/rockchip-linux-prebuilts-gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-

 

I noticed that in the make.sh file, it says -> board built okay, there are uboot/trust/loader images in current directory.

From this below image, I understand that uboot and trust image can be written into the sd card via the sudo dd command. Curious, what do I need the loader that was created also?

I also understand that boot is the kernel. But what about misc, recovery, backup? How do they get generated?

typical_layout_tinker_debian.png

Edited by wahaha

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...