dgibson / dtc

Device Tree Compiler
235 stars 134 forks source link

how can I download the archive inside debootstrap environment #120

Closed d2nikolic closed 1 year ago

d2nikolic commented 1 year ago

I see no clear link to use curl and download dtc-main archive. Only a link for .zip download, but debootstrap has no 'unzip' command in it. Any chance you can tell me how to pull tgz using curl? Thank you, Dragan

dgibson commented 1 year ago

I have no idea what archive you're looking at that has .zip downloads. The primary download archive for dtc is at https://mirrors.edge.kernel.org/pub/software/utils/dtc/ which is all .tar.gz.

d2nikolic commented 1 year ago

What used to work in bullseye Debian 11.7 is the following:

curl -kL https://github.com/RedPitaya/dtc/archive/overlays.tar.gz -o dtc.tar.gz tar zxvf dtc.tar.gz cd dtc-overlays

Fix duplicate declaration of yylloc

sed -i -e '/YYLTYPE yylloc/d' dtc-lexer.l make make install PREFIX=/usr

But now, in Debian Bookworm, this fails with an error:

In file included from fdtdump.c:12: In function ‘fdt_set_magic’, inlined from ‘main’ at fdtdump.c:310:3: libfdt/libfdt.h:235:28: error: array subscript ‘struct fdt_header[0]’ is partly outside array bounds of ‘unsigned char[4]’ [-Werror=array-bounds] 235 | fdth->name = cpu_to_fdt32(val); \ | ~~~^~~~~~~ libfdt/libfdt.h:237:1: note: in expansion of macro ‘fdt_set_hdr’ 237 | fdt_set_hdr(magic); | ^~~~~ fdtdump.c: In function ‘main’: fdtdump.c:306:31: note: object ‘smagic’ of size 4 306 | unsigned char smagic[FDT_MAGIC_SIZE]; | ^~ cc1: all warnings being treated as errors make: *** [Makefile:316: fdtdump.o] Error 1

forums point to 'fdtdump.c' and suggest that 'fdt_set_magic' in there should be replaced with 'fdt32_st'

Fix 'libfdt/libfdt.h:256:28: error: array subscript ‘struct fdt_header[0]’' .... error

sed -i -e 's/fdt_set_magic/fdt32_st/g' fdtdump.c

Unfortunately, that triggers another error

fdtdump.c: In function ‘main’: fdtdump.c:310:17: error: implicit declaration of function ‘fdt32_st’ [-Werror=implicit-function-declaration] 310 | fdt32_st(smagic, FDT_MAGIC); | ^~~~ fdtdump.c:310:17: error: nested extern declaration of ‘fdt32_st’ [-Werror=nested-externs] cc1: all warnings being treated as errors make: *** [Makefile:316: fdtdump.o] Error 1

my gcc is the following

gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/12/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 12.2.0-14' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-12 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-12-bTRWOB/gcc-12-12.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-12-bTRWOB/gcc-12-12.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.2.0 (Debian 12.2.0-14)

Any help on how to prevent 'fdtdump.c' throwing the aforementioned error is appreciated

dgibson commented 1 year ago

That's a third party fork of dtc by someone else ("Red Pitaya", whoever they are), itself based on another fork of dtc. It's not my archive, and it's a modified version of my code, so I really can't answer anything about it. You'll need to contact Red Pitaya.