logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>

pass1.sh (2190B)


  1. # SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
  2. # SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
  3. #
  4. # SPDX-License-Identifier: GPL-3.0-or-later
  5. extract="linux-4.14.336/scripts linux-4.14.336/include linux-4.14.336/arch/x86/include linux-4.14.336/arch/x86/entry"
  6. src_prepare() {
  7. default
  8. # Buggy headers/don't know how to account for
  9. rm include/uapi/linux/pktcdvd.h \
  10. include/uapi/linux/hw_breakpoint.h \
  11. include/uapi/linux/eventpoll.h \
  12. include/uapi/linux/atmdev.h \
  13. include/uapi/asm-generic/fcntl.h \
  14. arch/x86/include/uapi/asm/mman.h \
  15. arch/x86/include/uapi/asm/auxvec.h
  16. }
  17. src_compile() {
  18. gcc -o scripts/unifdef scripts/unifdef.c
  19. }
  20. src_install() {
  21. base_dir="${PWD}"
  22. # We "compile" the headers here because it is easier
  23. for d in include/uapi arch/x86/include/uapi; do
  24. cd "${d}"
  25. find . -type d -exec mkdir "${DESTDIR}${PREFIX}/include/{}" -p \;
  26. headers="$(find . -type f -name "*.h")"
  27. cd "${base_dir}"
  28. for h in ${headers}; do
  29. path="$(dirname "${h}")"
  30. scripts/headers_install.sh "${DESTDIR}${PREFIX}/include/${path}" "${d}/${path}" "$(basename "${h}")"
  31. done
  32. done
  33. # Pick-and-choose asm-generic headers
  34. for i in types ioctl termios termbits ioctls sockios socket param; do
  35. cp "${DESTDIR}${PREFIX}/include/asm-generic/${i}.h" "${DESTDIR}${PREFIX}/include/asm/${i}.h"
  36. done
  37. # Generate asm/unistd_32.h
  38. bash arch/x86/entry/syscalls/syscallhdr.sh \
  39. arch/x86/entry/syscalls/syscall_32.tbl \
  40. "${DESTDIR}${PREFIX}/include/asm/unistd_32.h" i386
  41. # Generate linux/version.h
  42. # Rules are from makefile
  43. VERSION=4
  44. PATCHLEVEL=14
  45. SUBLEVEL=336
  46. VERSION_CODE="$((VERSION * 65536 + PATCHLEVEL * 256 + SUBLEVEL))"
  47. echo '#define LINUX_VERSION_CODE '"${VERSION_CODE}" \
  48. > "${DESTDIR}${PREFIX}/include/linux/version.h"
  49. echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))' \
  50. >> "${DESTDIR}${PREFIX}/include/linux/version.h"
  51. # Clear up storage space
  52. cd ../..
  53. rm -rf build src
  54. }