Skip to contentSkip to conversation

meson: allow use of installed uapi headers

PATCH Superseded Evan Gates 2 participants 7 messages Mar 2, 2022 – Mar 10, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore

Evan Gates

author
#0 lore raw

PATCH 1/1 meson: allow use of installed uapi headers

Commit c70a9d9d536aefcf6574328aaac0fcc86f9ab0f7 added a test for $UAPI/include/uapi/evl that was meant to ensure the given $UAPI path was correct. That test meant that $UAPI had to point to a linux-evl source directory and could not point to installed headers in e.g. /usr/include. The script had previously allowed the use of installed headers, using the existence of $UAPI/Kbuild as an hueristic to decide whether $UAPI pointed to linux-evl source or to installed headers.

Rewrite the script to check for the existence of all three required directories (asm, asm-generic, evl) in two possible locations ($UAPI, $UAPI/include/uapi). This once again allows the use of installed headers, and gets rid of the heuristic, instead testing for the actual directories.

Fixes c70a9d9 (build: tighten consistency check for uapi)
---
 meson/setup-uapi.sh | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
meson/setup-uapi.sh +12 -14
index 1b43c02..bb96e86 100644
@@ -1,19 +1,17 @@
 #! /bin/sh
 
-if test \! -d $UAPI/include/uapi/evl; then
-    echo "meson: path given to -Duapi does not look right ($UAPI/include/uapi/evl is missing)"
-    exit 1
-fi
+set evl asm asm-generic
 
-mkdir -p $O_UAPI
-rm -f $O_UAPI/asm $O_UAPI/asm-generic $O_UAPI/evl
+for uapi in $UAPI/include/uapi $UAPI; do
+	for d do test -d $uapi/$d || continue 2; done
+	found=1
+	break
+done
 
-if test -r $UAPI/Kbuild; then
-    ln -s $UAPI/arch/$ARCH/include/uapi/asm $O_UAPI/asm
-    ln -s $UAPI/include/uapi/asm-generic $O_UAPI/asm-generic
-    ln -s $UAPI/include/uapi/evl $O_UAPI/evl
-elif test \! -L	$O_UAPI/asm; then
-    ln -s $UAPI/asm $O_UAPI/asm
-    ln -s $UAPI/asm-generic $O_UAPI/asm-generic
-    ln -s $UAPI/evl $O_UAPI/evl
+if [ ! "$found" ]; then
+	echo meson: path given to -Duapi does not look right
+	exit 1
 fi
+
+mkdir -p $O_UAPI
+for d do ln -sf $uapi/$d $O_UAPI/$d; done
Signature · 1 line
2.33.0
#1 lore raw
Quoted 8 lines · Evan Gates via Xenomai

Commit c70a9d9d536aefcf6574328aaac0fcc86f9ab0f7 added a test for $UAPI/include/uapi/evl that was meant to ensure the given $UAPI path was correct. That test meant that $UAPI had to point to a linux-evl source directory and could not point to installed headers in e.g. /usr/include. The script had previously allowed the use of installed headers, using the existence of $UAPI/Kbuild as an hueristic to decide whether $UAPI pointed to linux-evl source or to installed headers.

Quoted 6 lines

Rewrite the script to check for the existence of all three required directories (asm, asm-generic, evl) in two possible locations ($UAPI, $UAPI/include/uapi). This once again allows the use of installed headers, and gets rid of the heuristic, instead testing for the actual directories.

Fixes c70a9d9 (build: tighten consistency check for uapi)

Thanks for this patch. We still need to merge a solution for both possible use cases though, as such the changes do enable back picking /usr/include as the uapi path, but now breaks the setup when -Duapi points at a full kernel tree.

The issue is with uapi/asm, in this case, the source path is $UAPI/arch/$ARCH/include/uapi/asm, not $UAPI/asm.

Quoted 40 lines
---
 meson/setup-uapi.sh | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
meson/setup-uapi.sh +12 -14
index 1b43c02..bb96e86 100644
@@ -1,19 +1,17 @@
 #! /bin/sh
 
-if test \! -d $UAPI/include/uapi/evl; then
-    echo "meson: path given to -Duapi does not look right ($UAPI/include/uapi/evl is missing)"
-    exit 1
-fi
+set evl asm asm-generic
 
-mkdir -p $O_UAPI
-rm -f $O_UAPI/asm $O_UAPI/asm-generic $O_UAPI/evl
+for uapi in $UAPI/include/uapi $UAPI; do
+	for d do test -d $uapi/$d || continue 2; done
+	found=1
+	break
+done
 
-if test -r $UAPI/Kbuild; then
-    ln -s $UAPI/arch/$ARCH/include/uapi/asm $O_UAPI/asm
-    ln -s $UAPI/include/uapi/asm-generic $O_UAPI/asm-generic
-    ln -s $UAPI/include/uapi/evl $O_UAPI/evl
-elif test \! -L	$O_UAPI/asm; then
-    ln -s $UAPI/asm $O_UAPI/asm
-    ln -s $UAPI/asm-generic $O_UAPI/asm-generic
-    ln -s $UAPI/evl $O_UAPI/evl
+if [ ! "$found" ]; then
+	echo meson: path given to -Duapi does not look right
+	exit 1
 fi
+
+mkdir -p $O_UAPI
+for d do ln -sf $uapi/$d $O_UAPI/$d; done
Signature · 1 line
Philippe.
author
#2 lore raw
Quoted 8 lines · Philippe Gerum

Thanks for this patch. We still need to merge a solution for both possible use cases though, as such the changes do enable back picking /usr/include as the uapi path, but now breaks the setup when -Duapi points at a full kernel tree.

The issue is with uapi/asm, in this case, the source path is $UAPI/arch/$ARCH/include/uapi/asm, not $UAPI/asm.

Oh wow, you're absolutely right. I'm not sure how I missed that. And now I'm doubting my sanity because I thought I got a build working pointing to the kernel tree. I'll put together a v2.

Thanks,
Evan

author
#3 lore raw

PATCH v2 1/1 meson: allow use of installed uapi headers

In reply to Evan Gates

Commit c70a9d9d536aefcf6574328aaac0fcc86f9ab0f7 added a test for $UAPI/include/uapi/evl that was meant to ensure the given $UAPI path was correct. That test meant that $UAPI had to point to a linux-evl source directory and could not point to installed headers in e.g. /usr/include. The script had previously allowed the use of installed headers, using the existence of $UAPI/Kbuild as an heuristic to decide whether $UAPI pointed to linux-evl source or to installed headers.

Rewrite the script to check for the existence of all three required directories in either location. This allows the use of installed headers again.

Fixes c70a9d9 (build: tighten consistency check for uapi)

---

Changes in v2:

- Switch back to Kbuild heuristic in order to check/set the correct path for the asm directory

- Add the missing directory back to the error message

- Actually test with both setups, not sure how I messed that up last time

 meson/setup-uapi.sh | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
meson/setup-uapi.sh +14 -14
index 1b43c02..f27a07e 100644
@@ -1,19 +1,19 @@
 #! /bin/sh
 
-if test \! -d $UAPI/include/uapi/evl; then
-    echo "meson: path given to -Duapi does not look right ($UAPI/include/uapi/evl is missing)"
-    exit 1
+if test -r $UAPI/Kbuild; then
+	set \
+		$UAPI/arch/$ARCH/include/uapi/asm \
+		$UAPI/include/uapi/asm-generic \
+		$UAPI/include/uapi/evl
+else
+	set $UAPI/asm $UAPI/asm-generic $UAPI/evl
 fi
 
-mkdir -p $O_UAPI
-rm -f $O_UAPI/asm $O_UAPI/asm-generic $O_UAPI/evl
+for d do
+	test -d $d && continue
+	echo "meson: path given to -Duapi does not look right ($d is missing)"
+	exit 1
+done
 
-if test -r $UAPI/Kbuild; then
-    ln -s $UAPI/arch/$ARCH/include/uapi/asm $O_UAPI/asm
-    ln -s $UAPI/include/uapi/asm-generic $O_UAPI/asm-generic
-    ln -s $UAPI/include/uapi/evl $O_UAPI/evl
-elif test \! -L	$O_UAPI/asm; then
-    ln -s $UAPI/asm $O_UAPI/asm
-    ln -s $UAPI/asm-generic $O_UAPI/asm-generic
-    ln -s $UAPI/evl $O_UAPI/evl
-fi
+mkdir -p $O_UAPI
+for d do ln -sf $d $O_UAPI/; done
Signature · 1 line
2.33.0
#4 lore raw
Quoted 8 lines · Evan Gates via Xenomai

Commit c70a9d9d536aefcf6574328aaac0fcc86f9ab0f7 added a test for $UAPI/include/uapi/evl that was meant to ensure the given $UAPI path was correct. That test meant that $UAPI had to point to a linux-evl source directory and could not point to installed headers in e.g. /usr/include. The script had previously allowed the use of installed headers, using the existence of $UAPI/Kbuild as an heuristic to decide whether $UAPI pointed to linux-evl source or to installed headers.

Quoted 6 lines

Rewrite the script to check for the existence of all three required directories in either location. This allows the use of installed headers again.

Fixes c70a9d9 (build: tighten consistency check for uapi)

---

Works nicely against a full kernel tree now, thanks. Please send v3 with a sign-off line added to the commit log so that your patch may be merged.

Signature · 1 line
Philippe.
author
#5 lore raw

PATCH v3 1/1 meson: allow use of installed uapi headers

In reply to Evan Gates

Commit c70a9d9d536aefcf6574328aaac0fcc86f9ab0f7 added a test for $UAPI/include/uapi/evl that was meant to ensure the given $UAPI path was correct. That test meant that $UAPI had to point to a linux-evl source directory and could not point to installed headers in e.g. /usr/include. The script had previously allowed the use of installed headers, using the existence of $UAPI/Kbuild as an heuristic to decide whether $UAPI pointed to linux-evl source or to installed headers.

Rewrite the script to check for the existence of all three required directories in either location. This allows the use of installed headers again.

Fixes c70a9d9 (build: tighten consistency check for uapi)

---

Changes in v3:

- Add Signed-off-by trailer

Changes in v2:

- Switch back to Kbuild heuristic in order to check/set the correct path for the asm directory

- Add the missing directory back to the error message

- Actually test with both setups, not sure how I messed that up last time

 meson/setup-uapi.sh | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
meson/setup-uapi.sh +14 -14
index 1b43c02..f27a07e 100644
@@ -1,19 +1,19 @@
 #! /bin/sh
 
-if test \! -d $UAPI/include/uapi/evl; then
-    echo "meson: path given to -Duapi does not look right ($UAPI/include/uapi/evl is missing)"
-    exit 1
+if test -r $UAPI/Kbuild; then
+	set \
+		$UAPI/arch/$ARCH/include/uapi/asm \
+		$UAPI/include/uapi/asm-generic \
+		$UAPI/include/uapi/evl
+else
+	set $UAPI/asm $UAPI/asm-generic $UAPI/evl
 fi
 
-mkdir -p $O_UAPI
-rm -f $O_UAPI/asm $O_UAPI/asm-generic $O_UAPI/evl
+for d do
+	test -d $d && continue
+	echo "meson: path given to -Duapi does not look right ($d is missing)"
+	exit 1
+done
 
-if test -r $UAPI/Kbuild; then
-    ln -s $UAPI/arch/$ARCH/include/uapi/asm $O_UAPI/asm
-    ln -s $UAPI/include/uapi/asm-generic $O_UAPI/asm-generic
-    ln -s $UAPI/include/uapi/evl $O_UAPI/evl
-elif test \! -L	$O_UAPI/asm; then
-    ln -s $UAPI/asm $O_UAPI/asm
-    ln -s $UAPI/asm-generic $O_UAPI/asm-generic
-    ln -s $UAPI/evl $O_UAPI/evl
-fi
+mkdir -p $O_UAPI
+for d do ln -sf $d $O_UAPI/; done
Signature · 1 line
2.35.1
#6 lore raw
Quoted 11 lines · Evan Gates via Xenomai

Commit c70a9d9d536aefcf6574328aaac0fcc86f9ab0f7 added a test for $UAPI/include/uapi/evl that was meant to ensure the given $UAPI path was correct. That test meant that $UAPI had to point to a linux-evl source directory and could not point to installed headers in e.g. /usr/include. The script had previously allowed the use of installed headers, using the existence of $UAPI/Kbuild as an heuristic to decide whether $UAPI pointed to linux-evl source or to installed headers.

Rewrite the script to check for the existence of all three required directories in either location. This allows the use of installed headers again.

Merged, thanks.

Signature · 1 line
Philippe.