mrrl

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

linux (4461B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.d2d7aa00eac6ec561a10d126b1866f22e226a1276307466251e80fd8a4a1ebc7
      3 #+busybox-modutils.95945d9c074dc63a024f634518b98fb6060ebf274465cd2ecfcab9a899debf5f
      4 #+gnu-make.75a726f6c19f7bc10b95a84da3ce72fb785ebdf587504430c6b74cfb6610b728
      5 #+musl-cross-make.e4735d8572f9b6654a7381ebdfbd62e665d1d1da5e06a56923e89274cc6a510f
      6 #+findutils.f7e98e991b4780b47ce6d2ab429158d542f7185606022a40324ecbb4e4057b5e
      7 #+diffutils.156555a911f29226b4808f1cf6a96ba5b0f8f0bc6b0807c8dce0304797940ea5
      8 #+patch.f68185f5f766e7ba981276f806b05c1b549d908db89557d83873e53100c3a74f
      9 #+flex.8d55075854419dc463afd7f07f87a549edeef87b98da674548d2c5c511521357
     10 #+bison.4d593c48fa3d4403c468571fa999dacc4e7ee9e92bf546d1b792b2b8ec0df3bc
     11 #+rsync.c5cc99cab95e21c4d120f3cec027a3544b92f42016d43fb064458794fd7971dc
     12 #+zstd.9736e321b1b8e6549f338d427549f01301473de674823230efeaeb274d899796
     13 #+libelf.5874304fa5c4a27a5a7b2da474d530e1c80fdf28e2f0bc6d44e64bcd498eafd1
     14 #+pkgconf-pkg-config.2af12027cd145d8e8d3961bf73608011ba873a8f7ee9646708ac87d0fcb055c9
     15 #+nawk.20e61757d30ba2271f207e142d393eb446a3ce4af79060fea9822a996e9eee29
     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=/home/ccx/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/home/ccx/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