From efdf807990c3b58353286174e5e6bbd601a31c33 Mon Sep 17 00:00:00 2001 From: Emmanuel Vadot Date: Fri, 15 Jan 2021 15:28:46 +0100 Subject: Switch to the new device-tree vendor tree The old vendor tree was never fully merged and doing partial merge isn't supported with git subtree merge so a new one was created. Switch the build to use the new DTS from sys/contrib/device-tree This also bump the DTS used to be in sync with Linux 5.9 While here change the way to get the linux version, simply hardcode the value in sys/dts/freebsd-compatible.dts and use awk to get that to put it in the CFLAGS. As a bonus we now have the bindings docs available in sys/contrib/device-tree/Bindings/ so no need to link to the Linux repo or to the vendor tree. --- sys/conf/Makefile.arm | 4 ++-- sys/conf/Makefile.arm64 | 2 +- sys/conf/dtb.build.mk | 2 +- sys/conf/files.arm64 | 2 +- sys/dts/freebsd-compatible.dts | 2 +- sys/tools/fdt/make_dtb.sh | 6 ++---- sys/tools/fdt/make_dtbo.sh | 4 ++-- 7 files changed, 10 insertions(+), 12 deletions(-) diff --git a/sys/conf/Makefile.arm b/sys/conf/Makefile.arm index cc827e88c44f..31dc542e8e6c 100644 --- a/sys/conf/Makefile.arm +++ b/sys/conf/Makefile.arm @@ -30,9 +30,9 @@ S= ../../.. .endif .include "$S/conf/kern.pre.mk" -INCLUDES+= -I$S/contrib/libfdt -I$S/gnu/dts/include +INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include -LINUX_DTS_VERSION!= make -C $S/gnu/dts/ -V LINUX_DTS_VERSION +LINUX_DTS_VERSION!= awk '/freebsd,dts-version/ { sub(/;$$/,"", $$NF); print $$NF }' $S/dts/freebsd-compatible.dts CFLAGS += -DLINUX_DTS_VERSION=\"${LINUX_DTS_VERSION}\" .if !defined(DEBUG) && !defined(PROFLEVEL) diff --git a/sys/conf/Makefile.arm64 b/sys/conf/Makefile.arm64 index 08b5a5fc90b7..c7951872ca2d 100644 --- a/sys/conf/Makefile.arm64 +++ b/sys/conf/Makefile.arm64 @@ -25,7 +25,7 @@ S= ../../.. .endif .include "$S/conf/kern.pre.mk" -INCLUDES+= -I$S/contrib/libfdt -I$S/gnu/dts/include +INCLUDES+= -I$S/contrib/libfdt -I$S/contrib/device-tree/include # Use a custom SYSTEM_LD command to generate the elf kernel, so we can # set the text segment start address, and also strip the "arm mapping diff --git a/sys/conf/dtb.build.mk b/sys/conf/dtb.build.mk index edaa6db225c8..8d106615822f 100644 --- a/sys/conf/dtb.build.mk +++ b/sys/conf/dtb.build.mk @@ -32,7 +32,7 @@ DTB+= ${_dts:T:R:S/$/.dtb/} DTBO=${DTSO:T:R:S/$/.dtbo/} .SUFFIXES: .dtb .dts .dtbo .dtso -.PATH.dts: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/dts/${MACHINE} +.PATH.dts: ${SYSDIR}/contrib/device-tree/src/${MACHINE} ${SYSDIR}/dts/${MACHINE} .PATH.dtso: ${SYSDIR}/dts/${MACHINE}/overlays .export DTC ECHO diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 8ee422f23e26..fb001f95a672 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -34,7 +34,7 @@ arm/allwinner/aw_dwc3.c optional aw_dwc3 fdt arm/allwinner/aw_gpio.c optional gpio aw_gpio fdt arm/allwinner/aw_mmc.c optional mmc aw_mmc fdt | mmccam aw_mmc fdt arm/allwinner/aw_nmi.c optional aw_nmi fdt \ - compile-with "${NORMAL_C} -I$S/gnu/dts/include" + compile-with "${NORMAL_C} -I$S/contrib/device-tree/include" arm/allwinner/aw_pwm.c optional aw_pwm fdt arm/allwinner/aw_rsb.c optional aw_rsb fdt arm/allwinner/aw_rtc.c optional aw_rtc fdt diff --git a/sys/dts/freebsd-compatible.dts b/sys/dts/freebsd-compatible.dts index d977cb2b30c8..3621ac45901a 100644 --- a/sys/dts/freebsd-compatible.dts +++ b/sys/dts/freebsd-compatible.dts @@ -1,3 +1,3 @@ / { - freebsd,dts-version = LINUX_DTS_VERSION; + freebsd,dts-version = "5.9"; }; diff --git a/sys/tools/fdt/make_dtb.sh b/sys/tools/fdt/make_dtb.sh index 5c5968711661..09d0b3bd9f42 100755 --- a/sys/tools/fdt/make_dtb.sh +++ b/sys/tools/fdt/make_dtb.sh @@ -20,11 +20,9 @@ fi : "${ECHO:=echo}" : "${CPP:=cpp}" -LINUX_DTS_VERSION=$(make -C $S/gnu/dts -V LINUX_DTS_VERSION) - for d in ${dts}; do dtb="${dtb_path}/$(basename "$d" .dts).dtb" ${ECHO} "converting $d -> $dtb" - ${CPP} -DLINUX_DTS_VERSION=\"${LINUX_DTS_VERSION}\" -P -x assembler-with-cpp -I "$S/gnu/dts/include" -I "$S/dts/${MACHINE}" -I "$S/gnu/dts/${MACHINE}" -I "$S/gnu/dts/" -include "$d" -include "$S/dts/freebsd-compatible.dts" /dev/null | - ${DTC} -@ -O dtb -o "$dtb" -b 0 -p 1024 -i "$S/dts/${MACHINE}" -i "$S/gnu/dts/${MACHINE}" -i "$S/gnu/dts/" + ${CPP} -P -x assembler-with-cpp -I "$S/contrib/device-tree/include" -I "$S/dts/${MACHINE}" -I "$S/contrib/device-tree/src/${MACHINE}" -I "$S/contrib/device-tree/src/" -include "$d" -include "$S/dts/freebsd-compatible.dts" /dev/null | + ${DTC} -@ -O dtb -o "$dtb" -b 0 -p 1024 -i "$S/dts/${MACHINE}" -i "$S/contrib/device-tree/src/${MACHINE}" -i "$S/contrib/device-tree/src/" done diff --git a/sys/tools/fdt/make_dtbo.sh b/sys/tools/fdt/make_dtbo.sh index edc5d7fd8d41..1fcab87a6465 100755 --- a/sys/tools/fdt/make_dtbo.sh +++ b/sys/tools/fdt/make_dtbo.sh @@ -23,6 +23,6 @@ fi for d in ${dtso}; do dtb="${dtbo_path}/$(basename "$d" .dtso).dtbo" ${ECHO} "converting $d -> $dtb" - ${CPP} -P -x assembler-with-cpp -I "$S/gnu/dts/include" -I "$S/dts/${MACHINE}" -I "$S/gnu/dts/${MACHINE}" -include "$d" /dev/null | - ${DTC} -@ -O dtb -o "$dtb" -i "$S/dts/${MACHINE}" -i "$S/gnu/dts/${MACHINE}" + ${CPP} -P -x assembler-with-cpp -I "$S/contrib/device-tree/include" -I "$S/dts/${MACHINE}" -I "$S/contrib/device-tree/src/${MACHINE}" -include "$d" /dev/null | + ${DTC} -@ -O dtb -o "$dtb" -i "$S/dts/${MACHINE}" -i "$S/contrib/device-tree/src/${MACHINE}" done -- cgit v1.2.3