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