logo

live-bootstrap

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

pass1.sh (2394B)


  1. # SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
  2. # SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
  3. # SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
  4. #
  5. # SPDX-License-Identifier: GPL-3.0-or-later
  6. dirname=linux-4.14.336
  7. src_unpack() {
  8. mkdir "linux-4.14.336"
  9. default || true # Predictable link errors - not a problem
  10. rm "${DISTFILES}/linux-4.14.336.tar.xz"
  11. }
  12. generate_autoconf_h() {
  13. # generate include/linux/autoconf.h -- we do not have gperf rn to do it the normal way
  14. mkdir -p include/generated
  15. # Transform each of the CONFIG_* options that are =y into header
  16. grep -E '=y$' .config | sed 's/=y$/ 1/' | sed 's/^/#define /' >> include/generated/autoconf.h
  17. # Transform each of the CONFIG_* options that are unset into headers
  18. grep -E ' is not set$' .config | sed 's/ is not set$//' | sed 's/#/#undef/' >> include/generated/autoconf.h
  19. # Transform each of the non-boolean options into headers
  20. grep -E '=.*$' .config | grep -v -E '=y$' | sed 's/=/ /' | sed 's/^/#define /' >> include/generated/autoconf.h
  21. }
  22. src_prepare() {
  23. default
  24. mv config .config
  25. mkdir -p include/config
  26. cp .config include/config/auto.conf
  27. generate_autoconf_h
  28. # Remove shipped files
  29. find . -name "*_shipped*" -delete
  30. # Remove documentation to save space
  31. rm -rf Documentation
  32. }
  33. src_compile() {
  34. cp .config include/config/auto.conf
  35. rm include/generated/autoconf.h
  36. generate_autoconf_h
  37. # Allow use of patched initramfs_list.sh (which is required anyway)
  38. make "${MAKEJOBS}" ARCH=i386 prepare
  39. # Build just the vmlinux, because a full build will not fit our ramdisk
  40. PATH="${PWD}/usr:${PATH}" make "${MAKEJOBS}" ARCH=i386 vmlinux
  41. # Clear up more space
  42. find . -name '*.o' -not -path './drivers/firmware/efi/libstub/*' -delete
  43. # Now that we have space, build bzImage, taking care not to rebuild what we've just deleted
  44. PATH="${PWD}/usr:${PATH}" make "${MAKEJOBS}" ARCH=i386 -o vmlinux bzImage
  45. # Clear up one more time
  46. find . -name '*.o' -delete
  47. rm vmlinux
  48. }
  49. src_install() {
  50. install -D -m 644 arch/i386/boot/bzImage "${DESTDIR}/boot/vmlinuz"
  51. install -D -m 755 usr/gen_init_cpio "${DESTDIR}${PREFIX}/bin/gen_init_cpio"
  52. install -D -m 755 scripts/gen_initramfs_list.sh "${DESTDIR}${PREFIX}/bin/gen_initramfs_list.sh"
  53. }