mrrl

Minimal Reliable Reproducible Linux
git clone https://ccx.te2000.cz/git/mrrl
Log | Files | Refs | Submodules | README

linux (4443B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.05cde6bebcef146cc4de9201c82e0ef427702cc3bfe1acb48c0587542ba53002
      3 #+busybox-modutils.ebb7b2cc2e280cc5c68f2c7ccd8dd75304de57061e314de8459057fb2b7c0209
      4 #+gnu-make.72c6cd66010255e26a13af335dd8220c935dfc6e811ca0f28226e35f6099ff15
      5 #+musl-cross-make.ef7f483eefcad5b8f2d6c8329e61a0acaca7864b88e9521cb839392c62f45676
      6 #+findutils.1edbb84f016e9dc61540b8396e85a2163570b9281a408f8787f17e404f685ce0
      7 #+diffutils.dbe0e2258153174e9bde5107bab7a436d8c4d8b88e9d74f35eb72b67cfc73148
      8 #+patch.1f7ab95c511ea31573c4b2e3338bd15925cd1b93631a0681388475e41678d93f
      9 #+flex.a0b530df71023dab46f59c8c0a6255bae4c6e8e8d88087364e36fcc86318f41b
     10 #+bison.50a879da42f360f6a461ecb3eaafaed1ee77389f064b469614f27328bbd15e44
     11 #+rsync.a3914e6a58e85cc838ef8c8cda9ec4ba6e49cdd7376d09a2d0c6b072c656c3e7
     12 #+zstd.38b14331a2c89a3fc5d568ddddc14918031315ba2a24b6ffa8bd874c6f54bbc1
     13 #+libelf.e0061547c78397275ebd62dfe0e0b0640c7b7c1efdb341dc7763ac5c926b5106
     14 #+pkgconf-pkg-config.035ed72618fdde9058d87fb11cd6374080eef9927f78b0cd97cfc5afdfc21388
     15 #+nawk.8521bf13f53618b7897b7f2e070a506a0101c985f6b9bb527d5eb15d8e8d4858
     16 #@untar:-J:sha256:2ca1f17051a430f6fed1196e4952717507171acfd97d96577212502703b25deb:.
     17 #@sha256:d9b01e4dac3dd140c394227603c8b3339bb2f1e10c97afd3607d84e3003ec75a:patch-6.1.34.xz
     18 #@sha256:cc2633ee136db0283d4faf7c27c890641e90cd835fc3adb19eaf0569e4078867:linux.config
     19 #@sha256:ff3ddd131d73fee6838b11a6c4773bdb85c5f60fdd4b9ac4120ced021c341417:noobjtool.patch
     20 
     21 
     22 # - build script start -
     23 
     24 
     25 prefix=/versions/$pthbs_package
     26 dest=${pthbs_destdir%/}${prefix}
     27 cd 'linux-6.1'
     28 
     29 unxz -c < '../patch-6.1.34.xz' | patch -p1 -N
     30 patch -p1 -N <../noobjtool.patch
     31 
     32 
     33 export CPATH="$pthbs_build_environment/include"
     34 
     35 cp -v ../linux.config .config
     36  make olddefconfig
     37 diff -u ../linux.config .config || true
     38 
     39 
     40 
     41  make -j${JOBS:-1} -l$((1+${JOBS:-1})) \
     42 	V=1 \
     43 	HOSTLDFLAGS="-static -L$pthbs_build_environment/library" \
     44 	HOSTCFLAGS="-L$pthbs_build_environment/library"
     45 
     46 
     47 mkdir -p "${dest}/doc/linux" "${dest}/boot"
     48 cp -v .config "${dest}/config"
     49 mv Documentation/* "${dest}/doc/linux"
     50  make modules_install install \
     51 	INSTALL_MOD_PATH="${dest}/kernel" \
     52 	INSTALL_MOD_STRIP=1 \
     53 	INSTALL_PATH="${dest}/boot" \
     54 	INSTALL_DTBS_PATH="${dest}/boot/dtbs"
     55 
     56 # remove dangling symlinks
     57 module_dir="${dest}/kernel/lib/modules/6.1.34"
     58 rm -f "$module_dir/build" "$module_dir/source"
     59 ls -lhA "$module_dir"
     60 
     61 
     62 
     63 
     64 
     65 cd "$pthbs_destdir/versions/$pthbs_package"
     66 find -type d -o -print | awk -F/ '
     67 BEGIN {
     68 	kernel_name="6.1.34"
     69 	x["./boot/vmlinuz"]=1
     70 	x["./boot/System.map"]=1
     71 	x["./kernel/lib/modules/" kernel_name "/modules.alias"]=1
     72 	x["./kernel/lib/modules/" kernel_name "/modules.builtin"]=1
     73 	x["./kernel/lib/modules/" kernel_name "/modules.dep"]=1
     74 	x["./kernel/lib/modules/" kernel_name "/modules.order"]=1
     75 	x["./kernel/lib/modules/" kernel_name "/modules.symbols"]=1
     76 }
     77 
     78 function r1(s) {
     79 	sub("^[.]/[^/]*", ".", s)
     80 	return s
     81 }
     82 function s1(repl, s) {
     83 	sub("^[.]/[^/]*", "./"repl, s)
     84 	return s
     85 }
     86 function link(src) {
     87 	x[$0]=0
     88 	printf "%s\t%s\n", $0, src
     89 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     90 }
     91 $1!="."{exit 1}
     92 
     93 
     94 $2 == "boot" { link($0); next }
     95 $2 == "lib" && $3 == "modules" { exit 3 }  # make sure kernel modules do not mix with userspace libraries
     96 function mod_path(s) {
     97 	sub("^[.]/kernel/lib/", "./kernel/", s)
     98 	return s
     99 }
    100 $2 == "kernel" && $3 == "lib" && $4 == "modules" { link(mod_path($0)); next }
    101 
    102 $2 == "config" { link($0); next }
    103 $2 == "keys" { link($0); next }
    104 $2 == "zsh" { link($0); next }
    105 $2 == "env" { link($0); next }
    106 $2 == "command" { link($0); next }
    107 $2 == "bin" { link(s1("command", $0)); next }
    108 
    109 $2 == "library.so" { link($0); next }
    110 $2 == "library" { link($0); next }
    111 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
    112 $2 == "lib" && $NF ~ /\.so(\..*)?$/ { link(s1("library.so", $0)); next }
    113 
    114 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
    115 
    116 $2 == "man" { link($0); next }
    117 $2 == "info" { link($0); next }
    118 $2 == "doc" { link($0); next }
    119 $2 == "icons" { link($0); next }
    120 $2 == "terminfo" { link($0); next }
    121 $2 == "data" { link($0); next }
    122 $2 == "include" { link($0); next }
    123 
    124 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
    125 
    126 END {
    127 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
    128 	for(fname in x) {
    129 		if(x[fname]) {
    130 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
    131 			exit 3
    132 		}
    133 	}
    134 }' >.install-links.new
    135 mv .install-links.new .install-links
    136