mrrl

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

busybox:modutils (1992B)


      1 #!/usr/bin/env pthbs-build
      2 #+linux.386e6e56b5ea98ccc349ca95e462261faec3c211aa25775f83eab57222e6e95b
      3 #+musl-cross-make.ef7f483eefcad5b8f2d6c8329e61a0acaca7864b88e9521cb839392c62f45676
      4 #+gnu-make.72c6cd66010255e26a13af335dd8220c935dfc6e811ca0f28226e35f6099ff15
      5 #+busybox.05cde6bebcef146cc4de9201c82e0ef427702cc3bfe1acb48c0587542ba53002
      6 #+busybox-findutils.2c87d98d861d724e141128f395bed58e70601468aee2a192d77d5791d83772b7
      7 #+busybox-diffutils.977bc00da27e0150d3b3d395fe42cf24e0364b03390cab81002f27b34158d9fc
      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'/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 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     22 	if test x '!=' "x$interp_info"; then
     23 		printf '%s\n' "Error: '$1' is a dynamic binary!"
     24 		exit 1
     25 	fi
     26 }
     27 
     28 prefix=/versions/$pthbs_package
     29 dest=${pthbs_destdir%/}${prefix}
     30 cd 'busybox'
     31 
     32 export CC="$pthbs_build_environment/command/x86_64-linux-musl-gcc"
     33 export CFLAGS="-D_GNU_SOURCE"
     34 export LDFLAGS="-static"
     35 # TODO: indirection via deps directory/symlink
     36 cat >>.config <<EOF
     37 CONFIG_DEFAULT_MODULES_DIR="/versions/linux.386e6e56b5ea98ccc349ca95e462261faec3c211aa25775f83eab57222e6e95b"
     38 EOF
     39 make oldconfig
     40 cat .config
     41 
     42 
     43 make V=1 CROSS_COMPILE=x86_64-linux-musl- LDFLAGS=-static HOSTLDFLAGS=-static \
     44       HOSTCC="$CC -static" CC="$CC -static" HOSTCFLAGS=-D_GNU_SOURCE -j${JOBS:-1}
     45 ./make_single_applets.sh
     46 mkdir -p "${dest}/command"
     47 
     48 for exe in depmod insmod lsmod modinfo modprobe rmmod; do
     49 	mv -v "busybox_$(printf '%s' $exe | tr '[a-z]' '[A-Z]')" "${dest}/command/${exe}"
     50 	check_static command/$exe
     51 	printf './command/%s\t./command/%s\n' "$exe" "$exe" \
     52 		>>"${dest}/.install-links.new"
     53 done
     54 
     55 
     56 
     57 
     58 cd "$pthbs_destdir/versions/$pthbs_package"
     59 mv .install-links.new .install-links
     60