linux-qubasis
linux oasis port as a qubes template
git clone https://9o.is/git/linux-qubasis.git
gen.sh
(1836B)
1 curl \
2 https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.12.tar.xz \
3 b1a2562be56e42afb3f8489d4c2a7ac472ac23098f1ef1c1e40da601f54625eb \
4 'linux-*/Makefile' \
5 'linux-*/arch/*/include/uapi/' \
6 'linux-*/arch/*/entry/syscalls/' \
7 'linux-*/include/uapi/' \
8 'linux-*/scripts/unifdef.c'
9
10 case $TARGET_ARCH in
11 x86_64) linux_headers_arch=x86;;
12 *) error "Unsupported arch $TARGET_ARCH";;
13 esac
14
15 rule linux_header 'sed -E -f $dir/header.sed $in >$out.tmp && { $hostdir/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $out.tmp >$out; [ $$? -le 1 ]; } && rm $out.tmp'
16 bind description 'LINUX HEADER $out'
17
18 rule linux_wrapper 'printf "#include <asm-generic/%s>\n" $file >$out'
19 bind description 'LINUX HEADER $out'
20
21 uapi_header() {
22 out=$hdrdir/${1#*/uapi/}
23 linux_header $out $1
24 include $out
25 }
26
27 asm_header() {
28 out=$hdrdir/asm/$1
29 linux_wrapper $out
30 bind file $1
31 include $out
32 }
33
34 unistd_header() {
35 out=$hdrdir/asm/$1
36 awk $out $2 '|' $dir/unistd.awk
37 bind expr "-f $dir/unistd.awk -v arch=x86 -v file=$1 -v spec=${4-} -v abi='$3'"
38 include $out
39 }
40
41 # base gen: find include/uapi/* -name '*.h' | LC_COLLATE=C sort
42 foreach base uapi_header
43
44 # mandatory gen: cat include/uapi/asm-generic/Kbuild | grep -E '^mandatory-y' | sed 's|^mandatory-y += ||'
45 foreach mandatory asm_header
46
47 awk $hdrdir/linux/version.h Makefile '|' $dir/version.awk
48 bind expr '-f $dir/version.awk'
49 include $hdrdir/linux/version.h
50
51 if [ $linux_headers_arch = x86 ]; then
52 # x86 gen: find arch/x86/include/uapi/* -name '*.h' | LC_COLLATE=C sort
53 foreach x86 uapi_header
54
55 unistd_header unistd_32.h arch/x86/entry/syscalls/syscall_32.tbl i386
56 unistd_header unistd_x32.h arch/x86/entry/syscalls/syscall_64.tbl common"'\"|\"'"x32 __X32_SYSCALL_BIT
57 unistd_header unistd_64.h arch/x86/entry/syscalls/syscall_64.tbl common"'\"|\"'"64
58 fi
59
60 host() {
61 exe unifdef scripts/unifdef.c
62 }