mrrl

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

linux-qemu-guest (4308B)


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