Skip to content

Commit 02e613e

Browse files
committed
add script to fix libfdt headers when using buildroot local override
Signed-off-by: Michel-FK <[email protected]>
1 parent 05020b9 commit 02e613e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

fix_libfdt_headers.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/sh
2+
3+
# Fixup inclusion of libfdt headers, which can fail in older u-boot versions
4+
# when libfdt-devel is installed system-wide.
5+
# The core change is equivalent to upstream commit
6+
# e0d20dc1521e74b82dbd69be53a048847798a90a (first in v2018.03). However, the fixup
7+
# is complicated by the fact that the underlying u-boot code changed multiple
8+
# times in history:
9+
# - The directory scripts/dtc/libfdt only exists since upstream commit
10+
# c0e032e0090d6541549b19cc47e06ccd1f302893 (first in v2017.11). For earlier
11+
# versions, create a dummy scripts/dtc/libfdt directory with symlinks for the
12+
# fdt-related files. This allows to use the same -I<path> option for both
13+
# cases.
14+
# - The variable 'srctree' used to be called 'SRCTREE' before upstream commit
15+
# 01286329b27b27eaeda045b469d41b1d9fce545a (first in v2014.04).
16+
# - The original location for libfdt, 'lib/libfdt/', used to be simply
17+
# 'libfdt' before upstream commit 0de71d507157c4bd4fddcd3a419140d2b986eed2
18+
# (first in v2010.06). Make the 'lib' part optional in the substitution to
19+
# handle this.
20+
21+
if [ ! -d scripts/dtc/libfdt ]; then
22+
mkdir -p scripts/dtc/libfdt
23+
cd scripts/dtc/libfdt
24+
ln -s ../../../include/fdt.h .
25+
ln -s ../../../include/libfdt*.h .
26+
ln -s ../../../lib/libfdt/libfdt_internal.h .
27+
fi
28+
sed -i -e 's%-I\ *\$(srctree)/lib/libfdt%-I$(srctree)/scripts/dtc/libfdt%; s%-I\ *\$(SRCTREE)\(/lib\)\?/libfdt%-I$(SRCTREE)/scripts/dtc/libfdt%' tools/Makefile

0 commit comments

Comments
 (0)