linux (2975B)
1 {%- set src_dir='linux-' + tarball_version -%} 2 {% extends "genlinks" %} 3 {%- block template_deps -%} 4 #+{{pkg_install_name("busybox")}} 5 #+{{pkg_install_name("busybox-modutils")}} 6 #+{{pkg_install_name("gnu-make")}} 7 #+{{pkg_install_name("musl-cross-make")}} 8 #+{{pkg_install_name("findutils")}} 9 #+{{pkg_install_name("diffutils")}} 10 #+{{pkg_install_name("patch")}} 11 #+{{pkg_install_name("flex")}} 12 #+{{pkg_install_name("bison")}} 13 #+{{pkg_install_name("rsync")}} 14 #+{{pkg_install_name("zstd")}} 15 #+{{pkg_install_name("libelf")}} 16 #+{{pkg_install_name("pkgconf-pkg-config")}} 17 #+{{pkg_install_name("nawk")}} 18 {%- endblock template_deps %} 19 {%- block source_deps %} 20 #@untar:-J:sha256:{{ assertion(tarball_shasum) }}:. 21 {% if patch_version -%} 22 #@sha256:{{ assertion(patch_shasum) }}:patch-{{ patch_version }}.xz 23 {% endif -%} 24 #@sha256:{{files["lh_bootstrap-x86_64-config"]}}:linux.config 25 #@sha256:{{files["noobjtool.patch"]}}:noobjtool.patch 26 {% endblock source_deps %} 27 {%- block prepare %} 28 {{ super() }} 29 {% if patch_version -%} 30 unxz -c < '../patch-{{ patch_version }}.xz' | patch -p1 -N 31 {% endif -%} 32 patch -p1 -N <../noobjtool.patch 33 {% endblock prepare %} 34 {%- block configure %} 35 export CPATH="$pthbs_build_environment/include" 36 37 cp -v ../linux.config .config 38 {{ linux_arch_personality|default('') }} make olddefconfig 39 diff -u ../linux.config .config || true 40 41 {% endblock configure %} 42 {%- block build %} 43 {{ linux_arch_personality|default('') }} {{make}} \ 44 V=1 \ 45 HOSTLDFLAGS="-static -L$pthbs_build_environment/library" \ 46 HOSTCFLAGS="-L$pthbs_build_environment/library" 47 48 {% endblock build %} 49 {%- block install %} 50 mkdir -p "${dest}/doc/linux" "${dest}/boot" 51 cp -v .config "${dest}/config" 52 mv Documentation/* "${dest}/doc/linux" 53 {{ linux_arch_personality|default('') }} make modules_install install \ 54 INSTALL_MOD_PATH="${dest}/kernel" \ 55 INSTALL_MOD_STRIP=1 \ 56 INSTALL_PATH="${dest}/boot" \ 57 INSTALL_DTBS_PATH="${dest}/boot/dtbs" 58 59 # remove dangling symlinks 60 module_dir="${dest}/kernel/lib/modules/{{ assertion(patch_version|default(tarball_version + ".0", True)) }}" 61 rm -f "$module_dir/build" "$module_dir/source" 62 ls -lhA "$module_dir" 63 64 {% endblock install %} 65 {% block genlinks_rules %} 66 $2 == "boot" { link($0); next } 67 $2 == "lib" && $3 == "modules" { exit 3 } # make sure kernel modules do not mix with userspace libraries 68 function mod_path(s) { 69 sub("^[.]/kernel/lib/", "./kernel/", s) 70 return s 71 } 72 $2 == "kernel" && $3 == "lib" && $4 == "modules" { link(mod_path($0)); next } 73 {% endblock genlinks_rules -%} 74 {% block genlinks_begin %} 75 kernel_name="{{ assertion(patch_version|default(tarball_version + ".0", True)) }}" 76 x["./boot/vmlinuz"]=1 77 x["./boot/System.map"]=1 78 x["./kernel/lib/modules/" kernel_name "/modules.alias"]=1 79 x["./kernel/lib/modules/" kernel_name "/modules.builtin"]=1 80 x["./kernel/lib/modules/" kernel_name "/modules.dep"]=1 81 x["./kernel/lib/modules/" kernel_name "/modules.order"]=1 82 x["./kernel/lib/modules/" kernel_name "/modules.symbols"]=1 83 {% endblock genlinks_begin %}