Skip to contentSkip to conversation

scripts: Explain the difference between linux-headers and standard-headers

PATCH In review Thomas Huth 2 participants 3 messages Dec 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: Explain the difference between linux-headers and standard-headers

If you don't know it, it's hard to figure out the difference between the linux-headers folder and the include/standard-headers folder. So let's add a short explanation to clarify the difference.

---
 scripts/update-linux-headers.sh | 7 +++++++
 1 file changed, 7 insertions(+)
scripts/update-linux-headers.sh +7 -0
index fea4d6eb65..96c7daef94 100755
@@ -9,6 +9,13 @@
 #
 # This work is licensed under the terms of the GNU GPL version 2.
 # See the COPYING file in the top-level directory.
+#
+# The script will copy the headers into two target folder:
+#
+# - linux-headers/ for file that are required for compiling on a Linux host
+#
+# - include/standard-headers/ for files that are used for guest device emulation
+#
 
 tmpdir=$(mktemp -d)
 linux="$1"
Signature · 1 line
2.27.0
#1 lore raw
Quoted 15 lines · Thomas Huth

If you don't know it, it's hard to figure out the difference between the linux-headers folder and the include/standard-headers folder. So let's add a short explanation to clarify the difference.

---
 scripts/update-linux-headers.sh | 7 +++++++
 1 file changed, 7 insertions(+)
scripts/update-linux-headers.sh +0 -0
index fea4d6eb65..96c7daef94 100755

scripts/update-linux-headers.sh line 13

Quoted 5 lines
scripts/update-linux-headers.sh +2 -0
@@ -9,6 +9,13 @@
 #
 # This work is licensed under the terms of the GNU GPL version 2.
 # See the COPYING file in the top-level directory.
+#
+# The script will copy the headers into two target folder:

"folders"

scripts/update-linux-headers.sh line 15

Quoted 2 lines
scripts/update-linux-headers.sh +2 -0
+#
+# - linux-headers/ for file that are required for compiling on a Linux host

"files"

scripts/update-linux-headers.sh line 18

Quoted 3 lines
scripts/update-linux-headers.sh +3 -0
+#
+# - include/standard-headers/ for files that are used for guest device emulation
+#

We could expand on this a little if you like, eg:

- linux-headers/ for files that are required for compiling on a Linux host. Generally we have these so we can use kernel structs and defines that are more recent than the headers that might be in /usr/include/linux on the host system. Usually this script can do simple file copies for these headers.

- include/standard-headers/ for files that are used for guest device emulation and are required on all hosts. For instance, we get our definitions of the virtio structures from the Linux kernel headers, but we need those definitions regardless of which host OS we are building on. This script has to be careful to sanitize the headers to remove any use of Linux-specifics such as types like "__u64". This work is done in the cp_portable function.

-- PMM

#2 lore raw
Quoted 42 lines · Peter Maydell
Quoted 15 lines · Thomas Huth

If you don't know it, it's hard to figure out the difference between the linux-headers folder and the include/standard-headers folder. So let's add a short explanation to clarify the difference.

---
  scripts/update-linux-headers.sh | 7 +++++++
  1 file changed, 7 insertions(+)
scripts/update-linux-headers.sh +0 -0
index fea4d6eb65..96c7daef94 100755

scripts/update-linux-headers.sh line 13

Quoted 5 lines
scripts/update-linux-headers.sh +2 -0
@@ -9,6 +9,13 @@
  #
  # This work is licensed under the terms of the GNU GPL version 2.
  # See the COPYING file in the top-level directory.
+#
+# The script will copy the headers into two target folder:

"folders"

scripts/update-linux-headers.sh line 15

Quoted 2 lines
scripts/update-linux-headers.sh +2 -0
+#
+# - linux-headers/ for file that are required for compiling on a Linux host

"files"

scripts/update-linux-headers.sh line 18

Quoted 3 lines
scripts/update-linux-headers.sh +3 -0
+#
+# - include/standard-headers/ for files that are used for guest device emulation
+#

We could expand on this a little if you like, eg:

- linux-headers/ for files that are required for compiling on a Linux host. Generally we have these so we can use kernel structs and defines that are more recent than the headers that might be in /usr/include/linux on the host system. Usually this script can do simple file copies for these headers.

Quoted 6 lines

- include/standard-headers/ for files that are used for guest device emulation and are required on all hosts. For instance, we get our definitions of the virtio structures from the Linux kernel headers, but we need those definitions regardless of which host OS we are building on. This script has to be careful to sanitize the headers to remove any use of Linux-specifics such as types like "__u64". This work is done in the cp_portable function.

Sounds like a very good idea! Could you please send this as a patch (since this wouldn't be my own words anymore)?

Thomas