mrrl

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

busybox:modutils (2077B)


      1 #!/usr/bin/env pthbs-build
      2 #+linux-qemu-guest.f5cf5cc08b4d758267e22341c09328d19b17f4ee84c8e040315e04fed18a2243
      3 #+musl-cross-make.e4735d8572f9b6654a7381ebdfbd62e665d1d1da5e06a56923e89274cc6a510f
      4 #+gnu-make.75a726f6c19f7bc10b95a84da3ce72fb785ebdf587504430c6b74cfb6610b728
      5 #+busybox.d2d7aa00eac6ec561a10d126b1866f22e226a1276307466251e80fd8a4a1ebc7
      6 #+busybox-findutils.85b2328981df683d1ae7597eebdf3a332aa4241b936c0030fe3618cec1f4841a
      7 #+busybox-diffutils.24775f761d337796ffe81623350e4bf2f039067f593411146bfeb9c80567d182
      8 #@sha256:ccb459010923e1a9b49cb39d45bc93d0fc8749acea6efd7b19cfb00e76a5562e:busybox/.config
      9 #@git:3621595939e43a831d66f6b757d4f410029bff95:busybox
     10 
     11 
     12 # - build script start -
     13 
     14 check_static() {
     15 	local exe || true
     16 	exe=$pthbs_destdir'/home/ccx/versions'/$pthbs_package/$1
     17 	if ! test -f $exe; then
     18 		printf '%s\n' "Error: file '$1' doesn't exist!"
     19 		exit 1
     20 	fi
     21 	local interp_info || true
     22 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     23 	if test x '!=' "x$interp_info"; then
     24 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     25 		exit 1
     26 	fi
     27 }
     28 
     29 prefix=/home/ccx/versions/$pthbs_package
     30 dest=${pthbs_destdir%/}${prefix}
     31 cd 'busybox'
     32 
     33 export CC="$pthbs_build_environment/command/x86_64-linux-musl-gcc"
     34 export CFLAGS="-D_GNU_SOURCE"
     35 export LDFLAGS="-static"
     36 # TODO: indirection via deps directory/symlink
     37 cat >>.config <<EOF
     38 CONFIG_DEFAULT_MODULES_DIR="/home/ccx/versions/linux-qemu-guest.f5cf5cc08b4d758267e22341c09328d19b17f4ee84c8e040315e04fed18a2243"
     39 EOF
     40 make oldconfig
     41 cat .config
     42 
     43 
     44 make V=1 CROSS_COMPILE=x86_64-linux-musl- LDFLAGS=-static HOSTLDFLAGS=-static \
     45       HOSTCC="$CC -static" CC="$CC -static" HOSTCFLAGS=-D_GNU_SOURCE -j${JOBS:-1}
     46 ./make_single_applets.sh
     47 mkdir -p "${dest}/command"
     48 
     49 for exe in depmod insmod lsmod modinfo modprobe rmmod; do
     50 	mv -v "busybox_$(printf '%s' $exe | tr '[a-z]' '[A-Z]')" "${dest}/command/${exe}"
     51 	check_static command/$exe
     52 	printf './command/%s\t./command/%s\n' "$exe" "$exe" \
     53 		>>"${dest}/.install-links.new"
     54 done
     55 
     56 
     57 
     58 
     59 cd "$pthbs_destdir/home/ccx/versions/$pthbs_package"
     60 mv .install-links.new .install-links
     61