JeffyCN / meta-rockchip

Yocto BSP layer for the Rockchip SOC boards
Other
114 stars 87 forks source link

rk3328-evb u-boot Build break #46

Closed jwinarske closed 1 year ago

jwinarske commented 1 year ago
|   aarch64-poky-linux-gcc  --sysroot=/__w/meta-flutter/kirkstone-rockchip-rk3328/rockchip-rk3328-evb/tmp/work/rockchip_rk3328_evb-poky-linux/u-boot/1_2017.09-r0/recipe-sysroot -Wp,-MD,spl/common/.image-android-dt.o.d -nostdinc -isystem /__w/meta-flutter/kirkstone-rockchip-rk3328/rockchip-rk3328-evb/tmp/work/rockchip_rk3328_evb-poky-linux/u-boot/1_2017.09-r0/recipe-sysroot-native/usr/bin/aarch64-poky-linux/../../lib/aarch64-poky-linux/gcc/aarch64-poky-linux/11.3.0/include -Iinclude  -I/__w/meta-flutter/kirkstone-rockchip-rk3328/rockchip-rk3328-evb/tmp/work/rockchip_rk3328_evb-poky-linux/u-boot/1_2017.09-r0/git/include  -I/__w/meta-flutter/kirkstone-rockchip-rk3328/rockchip-rk3328-evb/tmp/work/rockchip_rk3328_evb-poky-linux/u-boot/1_2017.09-r0/git/arch/arm/include -include /__w/meta-flutter/kirkstone-rockchip-rk3328/rockchip-rk3328-evb/tmp/work/rockchip_rk3328_evb-poky-linux/u-boot/1_2017.09-r0/git/include/linux/kconfig.h  -I/__w/meta-flutter/kirkstone-rockchip-rk3328/rockchip-rk3328-evb/tmp/work/rockchip_rk3328_evb-poky-linux/u-boot/1_2017.09-r0/git/spl/common -Ispl/common -D__KERNEL__ -D__UBOOT__ -DCONFIG_SPL_BUILD -Wall -Wstrict-prototypes -Wno-format-security -fno-builtin -ffreestanding -fshort-wchar -Os -fno-stack-protector -fno-delete-null-pointer-checks -g -fstack-usage -Wno-format-nonliteral -Wno-address-of-packed-member -Werror=date-time -ffunction-sections -fdata-sections -D__ARM__ -mstrict-align -ffunction-sections -fdata-sections -fno-common -ffixed-r9 -fno-common -ffixed-x18 -pipe -march=armv8-a+nosimd -D__LINUX_ARM_ARCH__=8   -I/__w/meta-flutter/kirkstone-rockchip-rk3328/rockchip-rk3328-evb/tmp/work/rockchip_rk3328_evb-poky-linux/u-boot/1_2017.09-r0/git/arch/arm/mach-rockchip/include    -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(image_android_dt)"  -D"KBUILD_MODNAME=KBUILD_STR(image_android_dt)" -c -o spl/common/image-android-dt.o /__w/meta-flutter/kirkstone-rockchip-rk3328/rockchip-rk3328-evb/tmp/work/rockchip_rk3328_evb-poky-linux/u-boot/1_2017.09-r0/git/common/image-android-dt.c
|   File "/__w/meta-flutter/kirkstone-rockchip-rk3328/rockchip-rk3328-evb/tmp/work/rockchip_rk3328_evb-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/dtoc", line 50
|     print result
|     ^^^^^^^^^^^^
| SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
jwinarske commented 1 year ago

Looks like this machine is behind a bit. Per the wiki aarch64 can be used, as well as upstream u-boot.

https://opensource.rock-chips.com/wiki_U-Boot

I'll take a look at this.

JeffyCN commented 1 year ago

maybe try to hack it like:

--- a/recipes-bsp/u-boot/u-boot_%.bbappend
+++ b/recipes-bsp/u-boot/u-boot_%.bbappend
@@ -37,7 +37,8 @@ do_configure:prepend() {
        sed -i -e 's/\(open(.*[^"]\))/\1, "rb")/' -e 's/,$//' \
                -e 's/print >> \([^,]*\), *\(.*\)$/print(\2, file=\1)/' \
                -e 's/print \(.*\)$/print(\1)/' \
-               ${S}/arch/arm/mach-rockchip/make_fit_atf.py
+               ${S}/arch/arm/mach-rockchip/make_fit_atf.py \
+               ${S}/tools/dtoc/dtoc

or use u-boot-dummy

ballestrerod commented 1 year ago

hi, I've got the same problem. after your patch build fails on this:

|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/dtoc", line 60
|     parser.add_option('-d', '--dtb-file', action='store'
|                                                  ^^^^^^^
| SyntaxError: invalid syntax. Perhaps you forgot a comma?
JeffyCN commented 1 year ago

this should work:

--- a/recipes-bsp/u-boot/u-boot_%.bbappend
+++ b/recipes-bsp/u-boot/u-boot_%.bbappend
@@ -34,10 +34,11 @@ do_configure:prepend() {
        done

        # Support python3
-       sed -i -e 's/\(open(.*[^"]\))/\1, "rb")/' -e 's/,$//' \
-               -e 's/print >> \([^,]*\), *\(.*\)$/print(\2, file=\1)/' \
+       sed -i -e 's/\(open(.*[^"]\))/\1, "rb")/' \
+               -e 's/print >> \([^,]*\), *\(.*\),*$/print(\2, file=\1)/' \
                -e 's/print \(.*\)$/print(\1)/' \
-               ${S}/arch/arm/mach-rockchip/make_fit_atf.py
+               ${S}/arch/arm/mach-rockchip/make_fit_atf.py \
+               ${S}/tools/dtoc/dtoc
ballestrerod commented 1 year ago

thank you very much. now compilation goes forward but stops on:

| Traceback (most recent call last):
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/dtoc", line 75, in <module>
|     dtb_platdata.run_steps(args, options.dtb_file, options.include_disabled,
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/dtb_platdata.py", line 558, in run_steps
|     plat.scan_dtb()
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/dtb_platdata.py", line 246, in scan_dtb
|     self._fdt = fdt.FdtScan(self._dtb_fname)
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/fdt.py", line 413, in FdtScan
|     dtb = Fdt(fname)
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/fdt.py", line 275, in __init__
|     self._fdt = bytearray(fd.read())
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/recipe-sysroot-native/usr/lib/python3.10/codecs.py", line 322, in decode
|     (result, consumed) = self._buffer_decode(data, self.errors, final)
| UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 0: invalid continuation byte
| make -f /home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/scripts/Makefile.build obj=spl/drivers/serial
| make -f /home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/scripts/Makefile.build obj=spl/lib/avb/rk_avb_user
| make[2]: *** [/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/scripts/Makefile.spl:278: include/generated/dt-structs-gen.h] Error 1
| make[2]: *** Waiting for unfinished jobs....
JeffyCN commented 1 year ago

so this chip is building spl, which needs to parse dtb using dtoc.

all scripts of it need to hack

--- a/recipes-bsp/u-boot/u-boot_%.bbappend
+++ b/recipes-bsp/u-boot/u-boot_%.bbappend
@@ -34,10 +34,11 @@ do_configure:prepend() {
        done

        # Support python3
-       sed -i -e 's/\(open(.*[^"]\))/\1, "rb")/' -e 's/,$//' \
-               -e 's/print >> \([^,]*\), *\(.*\)$/print(\2, file=\1)/' \
+       sed -i -e 's/\(open([^,]*\))/\1, "rb")/' \
+               -e 's/print >> \([^,]*\), *\(.*\),*$/print(\2, file=\1)/' \
                -e 's/print \(.*\)$/print(\1)/' \
-               ${S}/arch/arm/mach-rockchip/make_fit_atf.py
+               ${S}/arch/arm/mach-rockchip/make_fit_atf.py \
+               ${S}/tools/dtoc/*.py
ballestrerod commented 1 year ago

no way. sorry if I'm bothering you but that build keep failing. maybe is the wrong u-boot version or too old for kirkstone? I'm trying to build for a Rockchip RK3328 on an Olimex SOM board.

| Traceback (most recent call last):
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/dtoc", line 75, in <module>
|     dtb_platdata.run_steps(args, options.dtb_file, options.include_disabled,
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/dtb_platdata.py", line 558, in run_steps
|     plat.scan_dtb()
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/dtb_platdata.py", line 246, in scan_dtb
|     self._fdt = fdt.FdtScan(self._dtb_fname)
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/fdt.py", line 414, in FdtScan
|     dtb.Scan()
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/fdt.py", line 289, in Scan
|     self._root.Scan()
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/fdt.py", line 228, in Scan
|     node.Scan()
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/fdt.py", line 217, in Scan
|     val = fdt_util.fdt32_to_cpu(phandle.value)
|   File "/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/tools/dtoc/fdt_util.py", line 29, in fdt32_to_cpu
|     val = val.encode('raw_unicode_escape')
| AttributeError: 'list' object has no attribute 'encode'
| make[2]: *** [/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/scripts/Makefile.spl:278: include/generated/dt-structs-gen.h] Error 1
| make[1]: *** [/home/ballest/rockhevc_workspace/oses/rockhevc-kirkstone/build_rockhevc/tmp/work/rockhevc-poky-linux/u-boot/1_2017.09-r0/git/Makefile:1446: tpl/u-boot-tpl.bin] Error 2
| make[1]: *** Waiting for unfinished jobs....
jwinarske commented 1 year ago

@ballestrerod that was also my impression; old u-boot.

@JeffyCN Any reason you aren't keeping u-boot the same for all the machine types? Also what is the point of using the mirror repo, opposed to using origin repo?

JeffyCN commented 1 year ago

the u-boot is bsp's 2017, which is using python2. but yocto switched to python3, so we need to hack it's scripts to python3, or use other u-boot.

3328's u-boot is different with other chips, it has spl stage, so calls more scripts.

for this error, need this u-boot commit:

commit a90df2b17282c43600284a92bf034d81d0c49444
Author: Simon Glass <sjg@chromium.org>
Date:   Thu Oct 31 07:43:04 2019 -0600
    dtoc: Convert fdt.py to Python 3

or use dummy u-boot and flash your old u-boot images instead of the generated ones: PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot-dummy" PREFERRED_PROVIDER_u-boot ?= "u-boot-dummy

JeffyCN commented 1 year ago

FYI, i've uploaded a patch for it

ballestrerod commented 1 year ago

great job! everything works now.

jwinarske commented 1 year ago

@JeffyCN Thanks!