2023-02-06 05:56:31 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
|
2022-04-13 00:08:29 +01:00
|
|
|
# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
|
2021-06-10 11:26:46 +01:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-11-28 00:48:44 +00:00
|
|
|
extract="linux-4.9.10/scripts linux-4.9.10/include linux-4.9.10/arch/x86/include linux-4.9.10/arch/x86/entry"
|
2022-10-10 12:22:31 +01:00
|
|
|
|
2021-06-10 11:26:46 +01:00
|
|
|
src_prepare() {
|
|
|
|
default
|
|
|
|
|
|
|
|
# Buggy headers/don't know how to account for
|
|
|
|
rm include/uapi/linux/pktcdvd.h \
|
|
|
|
include/uapi/linux/hw_breakpoint.h \
|
|
|
|
include/uapi/linux/eventpoll.h \
|
|
|
|
include/uapi/linux/atmdev.h \
|
|
|
|
include/uapi/asm-generic/fcntl.h \
|
|
|
|
arch/x86/include/uapi/asm/mman.h \
|
|
|
|
arch/x86/include/uapi/asm/auxvec.h
|
|
|
|
}
|
|
|
|
|
|
|
|
src_compile() {
|
|
|
|
gcc -o scripts/unifdef scripts/unifdef.c
|
|
|
|
}
|
|
|
|
|
|
|
|
src_install() {
|
2023-07-13 16:53:05 +01:00
|
|
|
base_dir="${PWD}"
|
2021-06-10 11:26:46 +01:00
|
|
|
# We "compile" the headers here because it is easier
|
|
|
|
for d in include/uapi arch/x86/include/uapi; do
|
|
|
|
cd "${d}"
|
2022-01-14 10:53:30 +00:00
|
|
|
find . -type d -exec mkdir "${DESTDIR}${PREFIX}/include/{}" -p \;
|
2021-06-10 11:26:46 +01:00
|
|
|
headers="$(find . -type f -name "*.h")"
|
|
|
|
cd "${base_dir}"
|
|
|
|
for h in ${headers}; do
|
2023-11-28 00:48:44 +00:00
|
|
|
path="$(dirname "${h}")"
|
|
|
|
scripts/headers_install.sh "${DESTDIR}${PREFIX}/include/${path}" "${d}/${path}" "$(basename "${h}")"
|
2021-06-10 11:26:46 +01:00
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
# Pick-and-choose asm-generic headers
|
2023-02-06 05:56:31 +00:00
|
|
|
for i in types ioctl termios termbits ioctls sockios socket param; do
|
2022-01-14 10:53:30 +00:00
|
|
|
cp "${DESTDIR}${PREFIX}/include/asm-generic/${i}.h" "${DESTDIR}${PREFIX}/include/asm/${i}.h"
|
2021-07-26 06:19:07 +01:00
|
|
|
done
|
2021-06-10 11:26:46 +01:00
|
|
|
|
|
|
|
# Generate asm/unistd_32.h
|
|
|
|
bash arch/x86/entry/syscalls/syscallhdr.sh \
|
|
|
|
arch/x86/entry/syscalls/syscall_32.tbl \
|
2022-01-14 10:53:30 +00:00
|
|
|
"${DESTDIR}${PREFIX}/include/asm/unistd_32.h" i386
|
2021-06-10 11:26:46 +01:00
|
|
|
|
|
|
|
# Generate linux/version.h
|
|
|
|
# Rules are from makefile
|
2023-11-28 00:48:44 +00:00
|
|
|
VERSION=4
|
|
|
|
PATCHLEVEL=9
|
|
|
|
SUBLEVEL=10
|
2022-05-09 19:55:26 +01:00
|
|
|
VERSION_CODE="$((VERSION * 65536 + PATCHLEVEL * 256 + SUBLEVEL))"
|
2021-06-10 11:26:46 +01:00
|
|
|
echo '#define LINUX_VERSION_CODE '"${VERSION_CODE}" \
|
2022-01-14 10:53:30 +00:00
|
|
|
> "${DESTDIR}${PREFIX}/include/linux/version.h"
|
2021-06-10 11:26:46 +01:00
|
|
|
echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))' \
|
2022-01-14 10:53:30 +00:00
|
|
|
>> "${DESTDIR}${PREFIX}/include/linux/version.h"
|
2021-08-04 03:46:00 +01:00
|
|
|
|
|
|
|
# Clear up storage space
|
|
|
|
cd ../..
|
|
|
|
rm -rf build src
|
2021-06-10 11:26:46 +01:00
|
|
|
}
|