On Mar 21, 2024, at 1:16 PM, George Koehler <kern...@gmail.com> wrote: > > I don't use u-boot, but I saw the powerpc bulk failing to package > u-boot for rk356x and rk3588. This diff fixes the failures by adding > 5 endian swaps. I don't know if my u-boot works, but I picked 2 > boards (1 from each package) and compared u-boot-rockchip.bin between > powerpc and amd64: cmp -l|wc -l found 106 to 117 different bytes. > > Right now, powerpc is the only big-endian arch that can build this. > mips64 and powerpc64 are missing devel/arm-none-eabi/gcc,aarch64; and > sparc64 has BROKEN-sparc64 on u-boot. My 750 MHz PowerPC G4 takes > over 3+1/2 hours to package rk3588 and over 7+1/2 hours for rk356x. > > May I get an ok from arm64 people? > --gkoehler
George provided me the rock5b u-boot-rockchip.bin built on powerpc to test. It boots fine and with no output differences. I also built this on amd64 and tested the result on a rock5b. It also boots fine and with no output differences. okay kurt@ > Index: rk356x/Makefile > =================================================================== > RCS file: /cvs/ports/sysutils/u-boot/rk356x/Makefile,v > diff -u -p -r1.4 Makefile > --- rk356x/Makefile 17 Feb 2024 11:27:42 -0000 1.4 > +++ rk356x/Makefile 20 Mar 2024 22:34:34 -0000 > @@ -1,4 +1,5 @@ > VERSION= 2024.01 > +REVISION= 0 > > SOC= rk356x > > Index: rk356x/files/rkbinpatch.c > =================================================================== > RCS file: /cvs/ports/sysutils/u-boot/rk356x/files/rkbinpatch.c,v > diff -u -p -r1.1 rkbinpatch.c > --- rk356x/files/rkbinpatch.c 17 Oct 2023 19:36:22 -0000 1.1 > +++ rk356x/files/rkbinpatch.c 20 Mar 2024 22:34:35 -0000 > @@ -16,6 +16,7 @@ > > #include <sys/mman.h> > #include <sys/stat.h> > +#include <endian.h> > #include <err.h> > #include <fcntl.h> > #include <unistd.h> > @@ -43,12 +44,13 @@ main(int argc, char *argv[]) > > end = (char *)start + st.st_size; > for (word = start; (void *)word < end; word++) { > - if (*word == 0x12345678 && (void *)(word + 10) < end) { > - data = *(word + 9); > + if (le32toh(*word) == 0x12345678 && > + (void *)(word + 10) < end) { > + data = le32toh(*(word + 9)); > if ((data & 0xffffff) == 1500000) { > data &= 0xff000000; > data |= 115200; > - *(word + 9) = data; > + *(word + 9) = htole32(data); > close(fd); > return 0; > } > Index: rk356x/patches/patch-tools_rkcommon_c > =================================================================== > RCS file: rk356x/patches/patch-tools_rkcommon_c > diff -N rk356x/patches/patch-tools_rkcommon_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ rk356x/patches/patch-tools_rkcommon_c 20 Mar 2024 22:34:35 -0000 > @@ -0,0 +1,23 @@ > +Add endian swaps for BE_ARCHS. > + > +Index: tools/rkcommon.c > +--- tools/rkcommon.c.orig > ++++ tools/rkcommon.c > +@@ -454,7 +454,7 @@ int rkcommon_verify_header(unsigned char *buf, int siz > + int ret; > + > + /* spl_hdr is abandon on header_v2 */ > +- if ((*(uint32_t *)buf) == RK_MAGIC_V2) > ++ if (le32_to_cpu(*(uint32_t *)buf) == RK_MAGIC_V2) > + return 0; > + > + ret = rkcommon_parse_header(buf, &header0, &img_spl_info); > +@@ -489,7 +489,7 @@ void rkcommon_print_header(const void *buf, struct ima > + uint8_t image_type; > + int ret, boot_size, init_size; > + > +- if ((*(uint32_t *)buf) == RK_MAGIC_V2) { > ++ if (le32_to_cpu(*(uint32_t *)buf) == RK_MAGIC_V2) { > + ret = rkcommon_parse_header_v2(buf, &header0_v2); > + > + if (ret < 0) { > Index: rk3588/Makefile > =================================================================== > RCS file: /cvs/ports/sysutils/u-boot/rk3588/Makefile,v > diff -u -p -r1.3 Makefile > --- rk3588/Makefile 6 Mar 2024 10:19:30 -0000 1.3 > +++ rk3588/Makefile 20 Mar 2024 22:34:35 -0000 > @@ -1,5 +1,5 @@ > VERSION= 2024.01-rc3 > -REVISION= 1 > +REVISION= 2 > > SOC= rk3588 > > Index: rk3588/files/rkbinpatch.c > =================================================================== > RCS file: /cvs/ports/sysutils/u-boot/rk3588/files/rkbinpatch.c,v > diff -u -p -r1.1 rkbinpatch.c > --- rk3588/files/rkbinpatch.c 26 Nov 2023 21:06:26 -0000 1.1 > +++ rk3588/files/rkbinpatch.c 20 Mar 2024 22:34:35 -0000 > @@ -43,12 +43,13 @@ main(int argc, char *argv[]) > > end = (char *)start + st.st_size; > for (word = start; (void *)word < end; word++) { > - if (*word == 0x12345678 && (void *)(word + 14) < end) { > - data = *(word + 13); > + if (le32toh(*word) == 0x12345678 && > + (void *)(word + 14) < end) { > + data = le32toh(*(word + 13)); > if ((data & 0xffffff) == 1500000) { > data &= 0xff000000; > data |= 115200; > - *(word + 13) = data; > + *(word + 13) = htole32(data); > close(fd); > return 0; > } > Index: rk3588/patches/patch-tools_rkcommon_c > =================================================================== > RCS file: rk3588/patches/patch-tools_rkcommon_c > diff -N rk3588/patches/patch-tools_rkcommon_c > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ rk3588/patches/patch-tools_rkcommon_c 20 Mar 2024 22:34:35 -0000 > @@ -0,0 +1,23 @@ > +Add endian swaps for BE_ARCHS. > + > +Index: tools/rkcommon.c > +--- tools/rkcommon.c.orig > ++++ tools/rkcommon.c > +@@ -454,7 +454,7 @@ int rkcommon_verify_header(unsigned char *buf, int siz > + int ret; > + > + /* spl_hdr is abandon on header_v2 */ > +- if ((*(uint32_t *)buf) == RK_MAGIC_V2) > ++ if (le32_to_cpu(*(uint32_t *)buf) == RK_MAGIC_V2) > + return 0; > + > + ret = rkcommon_parse_header(buf, &header0, &img_spl_info); > +@@ -489,7 +489,7 @@ void rkcommon_print_header(const void *buf, struct ima > + uint8_t image_type; > + int ret, boot_size, init_size; > + > +- if ((*(uint32_t *)buf) == RK_MAGIC_V2) { > ++ if (le32_to_cpu(*(uint32_t *)buf) == RK_MAGIC_V2) { > + ret = rkcommon_parse_header_v2(buf, &header0_v2); > + > + if (ret < 0) { >