Skip to content

Commit

Permalink
size reduction of iso - 6.4G
Browse files Browse the repository at this point in the history
  • Loading branch information
phanes committed May 26, 2023
1 parent 2ce0b4f commit 93f40be
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 3 deletions.
1 change: 1 addition & 0 deletions project_config.sh
Expand Up @@ -69,3 +69,4 @@ if [ -n "$1" ]; then
fi

# EOF
COLORTERM="truecolor"
2 changes: 1 addition & 1 deletion rex.project/x86_64/components/livecd/welcome.bash
Expand Up @@ -44,5 +44,5 @@ echo -e "\e[31m$HORSE\e[0m"
echo
echo "Welcome to Pyrois, the build system for Dark Horse Linux."
echo
echo "LIVD CD GENERATOR"
echo "LIVE CD GENERATOR"
echo
2 changes: 1 addition & 1 deletion rex.project/x86_64/components/stage1/gcc.bash
Expand Up @@ -489,7 +489,7 @@ if \
[ "$MODE_BUILD_GCC_PASS1" != "true" ] && \
[ "$MODE_INSTALL_GCC_PASS1" != "true" ] && \
[ "$MODE_BUILD_GCC_PASS2" != "true" ] && \
[ "$MODE_INSTALL_PASS2" != "true" ] && \
[ "$MODE_INSTALL_GCC_PASS2" != "true" ] && \
[ "$MODE_BUILD_LIBSTDCXX_PASS1" != "true" ] && \
[ "$MODE_INSTALL_LIBSTDCXX_PASS1" != "true" ] && \
[ "$MODE_BUILD_LIBSTDCXX_PASS2" != "true" ] && \
Expand Down
82 changes: 82 additions & 0 deletions rex.project/x86_64/components/stage4/cleanup.bash
Expand Up @@ -41,6 +41,88 @@ logprint "Deleting temporary toolchain..."
find /usr -depth -name ${T_TRIPLET}\* | xargs rm -vrf
assert_zero $?

# almost directly lifted from LFS
logprint "Stripping Debuginfo..."
save_usrlib="$(cd /usr/lib; ls ld-linux*[^g])
libc.so.6
libthread_db.so.1
libquadmath.so.0.0.0
libstdc++.so.6.0.30
libitm.so.1.0.0
libatomic.so.1.2.0"

pushd /usr/lib

for LIB in $save_usrlib; do
logprint "Stripping LIB:\t$LIB"
objcopy --only-keep-debug $LIB $LIB.dbg
cp $LIB /tmp/$LIB
assert_zero $?
strip --strip-unneeded /tmp/$LIB
assert_zero $?
objcopy --add-gnu-debuglink=$LIB.dbg /tmp/$LIB
assert_zero $?
install -vm755 /tmp/$LIB /usr/lib
assert_zero $?
done

online_usrbin="bash find strip"
online_usrlib="libbfd-2.40.so
libsframe.so.0.0.0
libhistory.so.8.2
libncursesw.so.6.4
libm.so.6
libreadline.so.8.2
libz.so.1.2.13
$(cd /usr/lib; find libnss*.so* -type f)"

for BIN in $online_usrbin; do
logprint "Stripping BIN:\t$BIN"
cp /usr/bin/$BIN /tmp/$BIN
assert_zero $?
strip --strip-unneeded /tmp/$BIN
assert_zero $?
install -vm755 /tmp/$BIN /usr/bin
assert_zero $?
done

LIB=""
for LIB in $online_usrlib; do
logprint "Stripping LIB:\t$LIB"
cp /usr/lib/$LIB /tmp/$LIB
assert_zero $?
strip --strip-unneeded /tmp/$LIB
assert_zero $?
install -vm755 /tmp/$LIB /usr/lib
assert_zero $?
done

for i in $(find /usr/lib -type f -name \*.so* ! -name \*dbg) \
$(find /usr/lib -type f -name \*.a) \
$(find /usr/{bin,sbin,libexec} -type f); do
case "$online_usrbin $online_usrlib $save_usrlib" in
*$(basename $i)* )
;;
* ) strip --strip-unneeded $i
;;
esac
done



echo; echo; echo
logprint "Cleaning /tmp/"
rm -Rf /tmp/*
assert_zero $?

logprint "Cleanup .la files..."
find /usr/lib /usr/libexec -name \*.la -delete
assert_zero $?

logprint "Removing temporary tools..."
find /usr -depth -name "${T_TRIPLET}*" -exec rm -rf {} \;
assert_zero $?

# TODO better integrate test user lifecycle

logprint "Execution of ${APPNAME} completed."
1 change: 0 additions & 1 deletion rex.project/x86_64/components/stage4/shadow.bash
Expand Up @@ -198,7 +198,6 @@ mode_install() {
useradd -D --gid 999
assert_zero $?


logprint "Install operation complete."
}

Expand Down

0 comments on commit 93f40be

Please sign in to comment.