Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build command "# ./build/mk-uboot.sh rockpi4c " fails #11

Open
student-forever opened this issue May 19, 2021 · 4 comments
Open

Build command "# ./build/mk-uboot.sh rockpi4c " fails #11

student-forever opened this issue May 19, 2021 · 4 comments

Comments

@student-forever
Copy link

I followed Part 2 of this documentation (non docker method) to build u-boot for rockpi4c and the build fails.

https://github.com/radxa/rockchip-bsp

Here are the details of my Ubuntu-VM:

uname -a

Linux ubuntu20-vm 5.8.0-53-generic #60~20.04.1-Ubuntu SMP Thu May 6 09:52:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

more /etc/*release

::::::::::::::
/etc/lsb-release
::::::::::::::
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
::::::::::::::
/etc/os-release
::::::::::::::
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Installed all the required tools:

apt-get install gcc-aarch64-linux-gnu device-tree-compiler libncurses5 libncurses5-dev build-essential libssl-dev mtools bc python dosfstools

Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'python-is-python2' instead of 'python'
bc is already the newest version (1.07.1-2build1).
device-tree-compiler is already the newest version (1.5.1-1).
dosfstools is already the newest version (4.1-2).
gcc-aarch64-linux-gnu is already the newest version (4:9.3.0-1ubuntu2).
libncurses5-dev is already the newest version (6.2-0ubuntu2).
mtools is already the newest version (4.0.24-1).
libncurses5 is already the newest version (6.2-0ubuntu2).
python-is-python2 is already the newest version (2.7.17-4).
build-essential is already the newest version (12.8ubuntu1.1).
libssl-dev is already the newest version (1.1.1f-1ubuntu2.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

And here are commands I entered :

git clone --recursive https://github.com/radxa/rockchip-bsp.git

cd rockchip-bsp

./build/mk-uboot.sh rockpi4c

Building U-boot for rockpi4c board!
Using rock-pi-4c-rk3399_defconfig
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:2468:
scripts/kconfig/confdata.c: In function ‘conf_write’:
scripts/kconfig/confdata.c:771:19: warning: ‘%s’ directive writing likely 7 or more bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
771 | sprintf(newname, "%s%s", dirname, basename);
| ^~~~~~
scripts/kconfig/confdata.c:771:19: note: assuming directive output of 7 bytes
In file included from /usr/include/stdio.h:867,
from scripts/kconfig/zconf.tab.c:82:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output 1 or more bytes (assuming 4104) into a destination of size 4097
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from scripts/kconfig/zconf.tab.c:2468:
scripts/kconfig/confdata.c:774:20: warning: ‘.tmpconfig.’ directive writing 11 bytes into a region of size between 1 and 4097 [-Wformat-overflow=]
774 | sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid());
| ^~~~~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:867,
from scripts/kconfig/zconf.tab.c:82:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:10: note: ‘__builtin___sprintf_chk’ output between 13 and 4119 bytes into a destination of size 4097
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HOSTLD scripts/kconfig/conf

configuration written to .config

scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config.h
UPD include/config.h
CFG u-boot.cfg
GEN include/autoconf.mk
GEN include/autoconf.mk.dep
CFG spl/u-boot.cfg
GEN spl/include/autoconf.mk
CFG tpl/u-boot.cfg
GEN tpl/include/autoconf.mk
CHK include/config/uboot.release
UPD include/config/uboot.release
CHK include/generated/version_autogenerated.h
UPD include/generated/version_autogenerated.h
CHK include/generated/timestamp_autogenerated.h
UPD include/generated/timestamp_autogenerated.h
CC lib/asm-offsets.s
CHK include/generated/generic-asm-offsets.h
UPD include/generated/generic-asm-offsets.h
CC arch/arm/lib/asm-offsets.s
CHK include/generated/asm-offsets.h
UPD include/generated/asm-offsets.h
HOSTCC scripts/dtc/dtc.o
HOSTCC scripts/dtc/flattree.o
HOSTCC scripts/dtc/fstree.o
HOSTCC scripts/dtc/data.o
HOSTCC scripts/dtc/livetree.o
HOSTCC scripts/dtc/treesource.o
HOSTCC scripts/dtc/srcpos.o
HOSTCC scripts/dtc/checks.o
HOSTCC scripts/dtc/util.o
SHIPPED scripts/dtc/dtc-lexer.lex.c
SHIPPED scripts/dtc/dtc-parser.tab.h
HOSTCC scripts/dtc/dtc-lexer.lex.o
SHIPPED scripts/dtc/dtc-parser.tab.c
HOSTCC scripts/dtc/dtc-parser.tab.o
HOSTLD scripts/dtc/dtc
HOSTCC tools/gen_eth_addr
HOSTCC tools/gen_ethaddr_crc.o
WRAP tools/lib/crc8.c
HOSTCC tools/lib/crc8.o
HOSTLD tools/gen_ethaddr_crc
HOSTCC tools/mkenvimage.o
HOSTCC tools/os_support.o
WRAP tools/lib/crc32.c
HOSTCC tools/lib/crc32.o
HOSTLD tools/mkenvimage
HOSTCC tools/aisimage.o
HOSTCC tools/atmelimage.o
WRAP tools/common/bootm.c
HOSTCC tools/common/bootm.o
HOSTCC tools/default_image.o
WRAP tools/lib/fdtdec_common.c
HOSTCC tools/lib/fdtdec_common.o
WRAP tools/lib/fdtdec.c
HOSTCC tools/lib/fdtdec.o
HOSTCC tools/fit_common.o
HOSTCC tools/fit_image.o
WRAP tools/common/image-fit.c
HOSTCC tools/common/image-fit.o
HOSTCC tools/image-host.o
WRAP tools/common/image.c
HOSTCC tools/common/image.o
HOSTCC tools/imagetool.o
HOSTCC tools/imximage.o
HOSTCC tools/kwbimage.o
WRAP tools/lib/md5.c
HOSTCC tools/lib/md5.o
HOSTCC tools/lpc32xximage.o
HOSTCC tools/mxsimage.o
HOSTCC tools/omapimage.o
HOSTCC tools/pblimage.o
HOSTCC tools/pbl_crc32.o
HOSTCC tools/vybridimage.o
WRAP tools/lib/rc4.c
HOSTCC tools/lib/rc4.o
HOSTCC tools/rkcommon.o
HOSTCC tools/rkimage.o
HOSTCC tools/rknand.o
HOSTCC tools/rksd.o
HOSTCC tools/rkspi.o
HOSTCC tools/socfpgaimage.o
WRAP tools/lib/sha1.c
HOSTCC tools/lib/sha1.o
WRAP tools/lib/sha256.c
HOSTCC tools/lib/sha256.o
WRAP tools/common/hash.c
HOSTCC tools/common/hash.o
HOSTCC tools/ublimage.o
HOSTCC tools/zynqimage.o
HOSTCC tools/zynqmpimage.o
HOSTCC tools/libfdt/fdt.o
HOSTCC tools/libfdt/fdt_wip.o
HOSTCC tools/libfdt/fdt_sw.o
HOSTCC tools/libfdt/fdt_rw.o
HOSTCC tools/libfdt/fdt_strerror.o
HOSTCC tools/libfdt/fdt_empty_tree.o
HOSTCC tools/libfdt/fdt_addresses.o
HOSTCC tools/libfdt/fdt_overlay.o
WRAP tools/lib/libfdt/fdt_ro.c
HOSTCC tools/lib/libfdt/fdt_ro.o
WRAP tools/lib/libfdt/fdt_region.c
HOSTCC tools/lib/libfdt/fdt_region.o
HOSTCC tools/gpimage.o
HOSTCC tools/gpimage-common.o
HOSTCC tools/dumpimage.o
HOSTLD tools/dumpimage
HOSTCC tools/mkimage.o
HOSTLD tools/mkimage
HOSTCC tools/rockchip/boot_merger.o
tools/rockchip/boot_merger.c: In function ‘initOpts’:
tools/rockchip/boot_merger.c:479:14: warning: ‘_loader_v’ directive output may be truncated writing 9 bytes into a region of size between 1 and 256 [-Wformat-truncation=]
479 | "%s_loader_v%d.%02d.%d%02d.bin", gOpts.chip, v0, v1, v2, v3);
| ^~~~~~~~~
In file included from /usr/include/stdio.h:867,
from ././include/compiler.h:25,
from :
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 22 and 315 bytes into a destination of size 256
67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 | __bos (__s), __fmt, __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/rockchip/boot_merger.c: In function ‘main’:
tools/rockchip/boot_merger.c:884:11: warning: array subscript 20 is outside array bounds of ‘char[20]’ [-Warray-bounds]
884 | str[len] = 0;
| ~~~~~~~~~^~~
tools/rockchip/boot_merger.c:922:7: note: while referencing ‘name’
922 | char name[MAX_NAME_LEN];
| ^~~~
HOSTCC tools/rockchip/sha2.o
HOSTLD tools/boot_merger
HOSTCC tools/rockchip/trust_merger.o
HOSTLD tools/trust_merger
HOSTCC tools/rockchip/loaderimage.o
HOSTCC tools/rockchip/sha.o
HOSTCC tools/rockchip/crc32_rk.o
HOSTLD tools/loaderimage
HOSTCC tools/rockchip/resource_tool.o
HOSTLD tools/resource_tool
HOSTCC tools/rockchip/checksum.o
HOSTLD tools/checksum
HOSTCC tools/proftool
HOSTCC tools/relocate-rela
HOSTCC tools/fdtgrep.o
HOSTLD tools/fdtgrep
LD arch/arm/cpu/built-in.o
CC arch/arm/cpu/armv8/cpu.o
CC arch/arm/cpu/armv8/generic_timer.o
CC arch/arm/cpu/armv8/cache_v8.o
AS arch/arm/cpu/armv8/exceptions.o
AS arch/arm/cpu/armv8/cache.o
AS arch/arm/cpu/armv8/tlb.o
AS arch/arm/cpu/armv8/transition.o
CC arch/arm/cpu/armv8/fwcall.o
CC arch/arm/cpu/armv8/cpu-dt.o
CC arch/arm/cpu/armv8/../armv7/suspend.o
AS arch/arm/cpu/armv8/sleep.o
AS arch/arm/cpu/armv8/smccc-call.o
LD arch/arm/cpu/armv8/built-in.o
AS arch/arm/cpu/armv8/start.o
AS arch/arm/lib/crt0_64.o
AS arch/arm/lib/setjmp_aarch64.o
AS arch/arm/lib/relocate_64.o
CC arch/arm/lib/bootm-fdt.o
CC arch/arm/lib/bootm.o
CC arch/arm/lib/zimage.o
CC arch/arm/lib/sections.o
CC arch/arm/lib/stack.o
AS arch/arm/lib/gic_64.o
CC arch/arm/lib/interrupts_64.o
CC arch/arm/lib/stacktrace_64.o
CC arch/arm/lib/cache.o
CC arch/arm/lib/psci-dt.o
LD arch/arm/lib/built-in.o
AR arch/arm/lib/lib.a
CC arch/arm/mach-rockchip/boot_mode.o
CC arch/arm/mach-rockchip/board.o
CC arch/arm/mach-rockchip/chip_info.o
CC arch/arm/mach-rockchip/iomem.o
CC arch/arm/mach-rockchip/rockchip_smccc.o
CC arch/arm/mach-rockchip/vendor.o
CC arch/arm/mach-rockchip/resource_img.o
CC arch/arm/mach-rockchip/param.o
CC arch/arm/mach-rockchip/sdram_common.o
CC arch/arm/mach-rockchip/rk3399/clk_rk3399.o
CC arch/arm/mach-rockchip/rk3399/rk3399.o
CC arch/arm/mach-rockchip/rk3399/syscon_rk3399.o
LD arch/arm/mach-rockchip/rk3399/built-in.o
CC arch/arm/mach-rockchip/rk_atags.o
LD arch/arm/mach-rockchip/built-in.o
CC board/rockchip/evb_rk3399/evb-rk3399.o
LD board/rockchip/evb_rk3399/built-in.o
CC cmd/boot.o
CC cmd/bootm.o
CC cmd/help.o
CC cmd/version.o
CC cmd/blk_common.o
CC cmd/source.o
CC cmd/bdinfo.o
CC cmd/boot_android.o
CC cmd/bootrkp.o
CC cmd/bootz.o
CC cmd/booti.o
CC cmd/cache.o
CC cmd/console.o
CC cmd/dtimg.o
CC cmd/echo.o
CC cmd/exit.o
CC cmd/ext4.o
CC cmd/ext2.o
CC cmd/fat.o
CC cmd/fdt.o
CC cmd/fs.o
CC cmd/load.o
CC cmd/mem.o
CC cmd/mii.o
CC cmd/mdio.o
CC cmd/mmc.o
CC cmd/net.o
CC cmd/part.o
CC cmd/pci.o
CC cmd/pcmcia.o
CC cmd/pxe.o
CC cmd/pxe_utility.o
CC cmd/nvme.o
CC cmd/rockusb.o
CC cmd/test.o
CC cmd/usb.o
CC cmd/disk.o
CC cmd/fastboot.o
CC cmd/gpt.o
CC cmd/optee.o
CC cmd/nvedit.o
LD cmd/built-in.o
CC common/init/board_init.o
LD common/init/built-in.o
CC common/main.o
CC common/exports.o
CC common/hash.o
CC common/cli_hush.o
CC common/autoboot.o
CC common/board_f.o
CC common/board_r.o
CC common/board_info.o
CC common/bootm.o
CC common/bootm_os.o
CC common/fdt_support.o
CC common/miiphyutil.o
CC common/usb.o
CC common/usb_hub.o
CC common/usb_storage.o
CC common/iomux.o
CC common/edid.o
CC common/splash.o
CC common/menu.o
CC common/cli_readline.o
CC common/cli_simple.o
CC common/bouncebuf.o
CC common/console.o
CC common/dlmalloc.o
CC common/malloc_simple.o
CC common/image.o
CC common/image-android.o
CC common/android_bootloader.o
CC common/image-fdt.o
CC common/image-fit.o
CC common/memsize.o
CC common/stdio.o
CC common/image-android-dt.o
CC common/boot_rkimg.o
CC common/image-sparse.o
CC common/fb_mmc.o
CC common/fb_common.o
CC common/cli.o
CC common/command.o
CC common/s_record.o
CC common/xyzModem.o
CC common/write_keybox.o
CC common/keymaster.o
CC common/attestation_key.o
LD common/built-in.o
CC disk/part.o
CC disk/part_dos.o
CC disk/part_efi.o
disk/part_efi.c: In function ‘gpt_verify_partitions’:
disk/part_efi.c:858:49: error: taking address of packed member of ‘struct _gpt_entry’ may result in an unaligned pointer value [-Werror=address-of-packed-member]
858 | gpt_convert_efi_name_to_char(efi_str, gpt_e[i].partition_name,
| ~~~~~~~~^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:281: disk/part_efi.o] Error 1
make[1]: *** [Makefile:1289: disk] Error 2
make: *** [Makefile:461: __build_one_by_one] Error 2
MAKE UBOOT IMAGE FAILED.

@StephenInVamrs
Copy link
Contributor

Hi, I think the reason would be the version of toolchain.

Please use gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu. Check this guide, https://wiki.radxa.com/Rockpi4/dev/Debian.

@student-forever
Copy link
Author

Thank you Stephen. That worked !

cd rockchip-bsp

./build/mk-uboot.sh rockpi4c

...
...
load addr is 0x200000!
pack input ./u-boot-dtb.bin
pack file size: 989258
crc = 0xb27b75a6
pack uboot.img success!
Image Type: Rockchip RK33 (SD/MMC) boot image
Data Size: 73728 bytes
Image Type: Rockchip RK33 (SPI) boot image
Data Size: 75776 bytes
out:trust.img
merge success(trust.img)
name=IDBlock, offset=40, size=7c0
name=uboot, offset=1000, size=800
name=trust, offset=1800, size=800
Writing vendor...
Writing idblock...
Adding ./uboot ...
Adding ./trust ...
Generating hash file...
Generating firmware OK.
U-boot IMAGE READY!

root@ubuntu20-vm:/rockchip-bsp# ls -lt out/u-boot/
total 2504
drwxr-xr-x 2 root root 4096 May 20 13:46 spi
-rw-r--r-- 1 root root 1048576 May 20 13:46 trust.img
-rw-r--r-- 1 root root 1048576 May 20 13:46 uboot.img
-rw-r--r-- 1 root root 297294 May 20 13:46 rk3399_loader_v1.20.119.bin
-rw-r--r-- 1 root root 163836 May 20 13:46 idbloader.img
root@ubuntu20-vm:
/rockchip-bsp#

@student-forever
Copy link
Author

I followed the document and managed to build everything as per document, all the way till building the final system.img.

But I believe this is the part that need an update.

RELEASE=buster TARGET=desktop ARCH=arm64 ./mk-base-debian.sh

This is what I see in this directory /root/rockchip-bsp/rootfs/ubuntu-build-service

ls -l ubuntu-build-service/
total 28
drwxr-xr-x 3 root root 4096 May 19 15:24 buster-desktop-armhf
drwxr-xr-x 2 root root 4096 May 19 15:24 packages
drwxr-xr-x 2 root root 4096 May 19 15:24 scripts
drwxr-xr-x 3 root root 4096 May 19 15:24 stretch-base-arm64
drwxr-xr-x 3 root root 4096 May 19 15:24 stretch-base-armhf
drwxr-xr-x 10 root root 4096 May 21 23:48 stretch-desktop-arm64
drwxr-xr-x 3 root root 4096 May 19 15:24 stretch-desktop-armhf

There is no "buster-desktop-arm64" but "stretch-desktop-arm64" instead. So by entering the following command, I managed to complete the rest of the steps in building system.img

RELEASE=stretch TARGET=desktop ARCH=arm64 ./mk-base-debian.sh

The entire build went thru flawlessly! Great Document !

Thanks for sharing.

@gudvinr
Copy link

gudvinr commented May 14, 2022

Hi, I think the reason would be the version of toolchain.

Please use gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu. Check this guide, https://wiki.radxa.com/Rockpi4/dev/Debian.

No, the reason is that newer gcc version found an error and older toolchain just doesn't have check that is supposed to catch this error.

So real solution would be to fix building with newer toolchain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants