mrrl

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

linux (3725B)


      1 #!/usr/bin/env pthbs-build
      2 #+busybox.f4ef3d511c029095beda8d21dd48f7730bec63fb09792ca951402d6620338089
      3 #+gnu-make.444e811a68f4f16724e21354b710fad3592e53a2dbf7c0c78658f3d4e7c8e465
      4 #+musl-cross-make.d0431fc0def788be03da43136972361827de52c8e6f0a6f3890dc57fe32e8ecc
      5 #+diffutils.3624d5d708d8d0c246f53189fddbc8008971f0c085ba8ab2e2d4e177d6dc7940
      6 #+patch.9d8b2c370a0ccf6e5ad48c27070ff1da2d30d41327fd5711a76cf570b34ae523
      7 #+flex.42bdab01fb2083e92a4417d5fb289c468b9a1a5b8092904b965455b74559262f
      8 #+bison.d9992ea20119a82e24982f67479e65e94ec0fdc686f024f0ed04e87c83a00ef0
      9 #+rsync.ba5e1b943d7caedd402b472208d5450dd417de7bd509aac5bf46f94d73bbc907
     10 #+zstd.a83f72c5953bd6b7afc171528a503710b3144bf9197961833fd27926b0a18137
     11 #+libelf.b129c20086c9a39a997886caaa57b3f7c5be24fd0ceb34289b62e794ff722ed0
     12 #+pkgconf-pkg-config.ea4d3fe0fca073b8e3eb3b731df4d36c062498864ee04f68ce000a6f282b5621
     13 #@untar:-J:sha256:2ca1f17051a430f6fed1196e4952717507171acfd97d96577212502703b25deb:.
     14 #@sha256:d9b01e4dac3dd140c394227603c8b3339bb2f1e10c97afd3607d84e3003ec75a:patch-6.1.34.xz
     15 #@sha256:cc2633ee136db0283d4faf7c27c890641e90cd835fc3adb19eaf0569e4078867:linux.config
     16 #@sha256:ff3ddd131d73fee6838b11a6c4773bdb85c5f60fdd4b9ac4120ced021c341417:noobjtool.patch
     17 
     18 printf '%s\n' "TODO: fix paths"; exit 1
     19 export CPATH="$pthbs_build_environment/include"
     20 
     21 cd 'linux-6.1'
     22 unxz -c < '../patch-6.1.34.xz' | patch -p1 -N
     23 patch -p1 -N <../noobjtool.patch
     24 cp -v ../linux.config .config
     25  make olddefconfig
     26 diff -u ../linux.config .config || true
     27  make -j${JOBS:-1} -l$((1+${JOBS:-1})) \
     28 	V=1 \
     29 	HOSTLDFLAGS="-static -L$pthbs_build_environment/library" \
     30 	HOSTCFLAGS="-L$pthbs_build_environment/library"
     31 
     32 installdir="$pthbs_destdir//versions/$pthbs_package"
     33 mkdir -p "$installdir/doc/linux" "$installdir/boot"
     34 cp -v .config "$installdir/config"
     35 mv Documentation/* "$installdir/doc/linux"
     36  make modules_install install \
     37 	INSTALL_MOD_PATH="$installdir" \
     38 	INSTALL_MOD_STRIP=1 \
     39 	INSTALL_PATH="$installdir"/boot \
     40 	INSTALL_DTBS_PATH="$installdir/boot/dtbs"
     41 
     42 cd "$pthbs_destdir/versions/$pthbs_package"
     43 find -type d -o -print | awk -F/ '
     44 BEGIN {
     45 	kernel_name="6.1.34"
     46 	x["./boot/vmlinuz"]=1
     47 	x["./boot/System.map"]=1
     48 	x["./lib/modules/" kernel_name "/modules.alias"]=1
     49 	x["./lib/modules/" kernel_name "/modules.builtin"]=1
     50 	x["./lib/modules/" kernel_name "/modules.dep"]=1
     51 	x["./lib/modules/" kernel_name "/modules.order"]=1
     52 	x["./lib/modules/" kernel_name "/modules.symbols"]=1
     53 }
     54 
     55 function r1(s) {
     56 	sub("^[.]/[^/]*", ".", s)
     57 	return s
     58 }
     59 function s1(repl, s) {
     60 	sub("^[.]/[^/]*", "./"repl, s)
     61 	return s
     62 }
     63 function link(src) {
     64 	x[$0]=0
     65 	printf "%s\t%s\n", $0, src
     66 	printf "genlinks >>%s\t%s<<\n", $0, src >>"/dev/stderr"
     67 }
     68 $1!="."{exit 1}
     69 
     70 
     71 $2 == "boot" { link($0); next }
     72 $2 == "lib" && $3 == "modules" { exit 3 }  # TODO move to better location
     73 $2 == "command" { link($0); next }
     74 $2 == "bin" { link(s1("command", $0)); next }
     75 
     76 $2 == "library.so" { link($0); next }
     77 $2 == "library" { link($0); next }
     78 $2 == "lib" && $NF ~ /\.l?a$/ { link(s1("library", $0)); next }
     79 $2 == "lib" && $NF ~ /\.so(|\..*)$/ { link(s1("library.so", $0)); next }
     80 
     81 $2 == "share" && $3 ~ /^(info|man|doc|icons|terminfo)$/ { link(r1($0)); next }
     82 
     83 $2 == "man" { link($0); next }
     84 $2 == "info" { link($0); next }
     85 $2 == "doc" { link($0); next }
     86 $2 == "icons" { link($0); next }
     87 $2 == "terminfo" { link($0); next }
     88 $2 == "data" { link($0); next }
     89 $2 == "include" { link($0); next }
     90 
     91 { printf "genlinks ##%s## skipped\n", $0 >>"/dev/stderr" }
     92 
     93 END {
     94 	for(fname in x) { printf "DEBUG: x[\"%s\"]=\"%s\"\n", fname, x[fname] >"/dev/stderr" }
     95 	for(fname in x) {
     96 		if(x[fname]) {
     97 			printf "ERROR: missing expected file \"%s\"\n", fname >"/dev/stderr"
     98 			exit 3
     99 		}
    100 	}
    101 }' >.install-links.new
    102 mv .install-links.new .install-links