This commit is contained in:
wt
2026-02-26 13:40:18 +07:00
parent ac7cb03d8e
commit 446ae02775
28 changed files with 140 additions and 86 deletions
+4
View File
@@ -22,6 +22,7 @@
. ./scripts/wpa_supplicant.sh
. ./scripts/lrzsz.sh
. ./scripts/tcc.sh
. ./scripts/zlib.sh
case $1 in
build)
@@ -88,6 +89,9 @@ case $1 in
tcc)
tcc_build
;;
zlib)
zlib
;;
*)
printf "$UYELLOW** $0 script using: $0 {clean|build|download|rootfs}\n$RESET"
exit 1
+3
View File
@@ -24,6 +24,9 @@ busybox_rootfs() {
printf "$UGREEN** Building busybox\n$RESET"
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- $makeflags # &>> $fulllogfile
check $? "Build busybox all logs in .log"
cp -v busybox $rootfspath/usr/bin # &>> $fulllogfile
cd $rootfspath/usr/bin
for i in $(cat $BUSYBOX_LIST_FILE); do ln -sv busybox $i; done
}
#--------------------------------------------------
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
set -x
. ./scripts/colors.sh
. ./scripts/funcs.sh
. ./scripts/config.sh
cleanup_rootfs() {
if [ "${TCC_C_COMPILER_ENABLE}" = "n" ]; then
find $rootfspath -type f -name "*.a" -delete
find $rootfspath -type f -name "*.la" -delete
rm -rv $rootfspath/usr/include
rm -rv $rootfspath/usr/share/man
rm -rv $rootfspath/usr/lib/pkgconfig
fi
STRIP_FILES=$(file --mime-type $(find $rootfspath -type f) | grep "application/x-executable\|application/x-sharedlib\|application/x-pie-executable" | sed 's/:.*$//')
# echo $STRIP_FILES
for i in $STRIP_FILES; do
${CROSS_COMPILE}-strip $i
echo $i
done
}
+9 -9
View File
@@ -28,14 +28,14 @@ curl() {
make $makeflags
check $? "Build ${pkgname}"
make DESTDIR=$rootfspath install
rm \
-rv \
$rootfspath/usr/include \
$rootfspath/usr/share/aclocal \
$rootfspath/usr/share/man \
$rootfspath/usr/lib/*.a \
$rootfspath/usr/lib/*.la \
$rootfspath/usr/lib/pkgconfig
$CROSS_COMPILE-strip --strip-unneeded $rootfspath/usr/bin/curl $rootfspath/usr/lib/libcurl.so.4.8.0
# rm \
# -rv \
# $rootfspath/usr/include \
# $rootfspath/usr/share/aclocal \
# $rootfspath/usr/share/man \
# $rootfspath/usr/lib/*.a \
# $rootfspath/usr/lib/*.la \
# $rootfspath/usr/lib/pkgconfig
# $CROSS_COMPILE-strip --strip-unneeded $rootfspath/usr/bin/curl $rootfspath/usr/lib/libcurl.so.4.8.0
check $? "Installing to rootfs ${pkgname}"
}
+3 -3
View File
@@ -14,8 +14,8 @@ dnsmasq() {
cd ${pkgname}-${pkgver}
make CC=${CROSS_COMPILE}-gcc ${makeflags}
check $? "Build ${pkgname}"
${CROSS_COMPILE}-strip src/$pkgname
check $? "Stripping ${pkgname} binary"
# ${CROSS_COMPILE}-strip src/$pkgname
# check $? "Stripping ${pkgname} binary"
cp -v src/$pkgname $rootfspath/usr/bin/$pkgname
check $? "Install to rootfs ${pkgname}"
}
}
+7 -7
View File
@@ -10,25 +10,25 @@ dropbear() {
zlib
fi
printf "$GREEN** Building and installing dropbear\n$RESET"
[ -d $build/dropbear ] && return 0
# [ -d $build/dropbear ] && return 0
mkdir $build/dropbear
cd $build/dropbear
tar -xvf $root/downloads/DROPBEAR_2024.86.tar.gz
tar -xvf $root/downloads/DROPBEAR_2025.89.tar.gz
check $? "Extract dropbear"
cd dropbear-DROPBEAR_2024.86
cd dropbear-DROPBEAR_2025.89
./configure \
--prefix=/usr \
--host=$CROSS_COMPILE \
--with-zlib=$build/rootfs/usr
--with-zlib=$build/rootfs/usr/include
# CC=${CROSS_COMPILE}gcc ./configure --prefix=/usr --shared
check $? "Configure dropbear"
make $makeflags
check $? "Build dropbear"
make DESTDIR=$rootfspath install
check $? "Installing to rootfs dropbear"
[ "$SFTP_SERVER_ENABLE" = "n" ] && rm -rv $rootfspath/usr/include $rootfspath/usr/share/man $rootfspath/usr/lib/{pkgconfig,libz.a}
${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/bin/*
# [ "$SFTP_SERVER_ENABLE" = "n" ] && rm -rv $rootfspath/usr/include $rootfspath/usr/share/man $rootfspath/usr/lib/{pkgconfig,libz.a}
# ${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/bin/*
mkdir -pv $build/rootfs/etc/dropbear
# check $? "Installing to rootfs zlib"
rm -rvf $rootfspath/usr/share/man
# rm -rvf $rootfspath/usr/share/man
}
+16 -16
View File
@@ -69,20 +69,20 @@ finit_init() {
make DESTDIR=$rootfspath install
check $? "Installing to rootfs finit"
find $rootfspath -name "*.la" -delete
find $rootfspath -name "*.a" -delete
rm -rv \
$rootfspath/usr/lib/pkgconfig \
$rootfspath/lib/pkgconfig \
$rootfspath/usr/include \
$rootfspath/usr/share/man \
$rootfspath/usr/share/doc
$CROSS_COMPILE-strip --strip-unneeded \
$rootfspath/usr/lib/libite.so.5.4.0 \
$rootfspath/usr/lib/libuev.so.3.0.0 \
$rootfspath/sbin/finit \
$rootfspath/sbin/initctl \
$rootfspath/libexec/finit/* \
$rootfspath/lib/libsystemd.so.0.0.0 \
$rootfspath/lib/finit/plugins/*
# find $rootfspath -name "*.la" -delete
# find $rootfspath -name "*.a" -delete
# rm -rv \
# $rootfspath/usr/lib/pkgconfig \
# $rootfspath/lib/pkgconfig \
# $rootfspath/usr/include \
# $rootfspath/usr/share/man \
# $rootfspath/usr/share/doc
# $CROSS_COMPILE-strip --strip-unneeded \
# $rootfspath/usr/lib/libite.so.5.4.0 \
# $rootfspath/usr/lib/libuev.so.3.0.0 \
# $rootfspath/sbin/finit \
# $rootfspath/sbin/initctl \
# $rootfspath/libexec/finit/* \
# $rootfspath/lib/libsystemd.so.0.0.0 \
# $rootfspath/lib/finit/plugins/*
}
+1 -1
View File
@@ -27,6 +27,6 @@ git_build() {
make $makeflags
check $? "Build ${pkgname}"
make DESTDIR=$rootfspath install
$CROSS_COMPILE-strip --strip-unneeded $rootfspath/usr/bin/* $rootfspath/libexec/git-core/*
# $CROSS_COMPILE-strip --strip-unneeded $rootfspath/usr/bin/* $rootfspath/libexec/git-core/*
printf "$GREEN** SUCCESS: Building and installing ${pkgname}\n$RESET"
}
+6 -6
View File
@@ -24,11 +24,11 @@ iptables() {
check $? "Build ${pkgname}"
make install DESTDIR=$rootfspath
check $? "Install to rootfs ${pkgname}"
${CROSS_COMPILE}-strip \
$rootfspath/usr/bin/* \
$rootfspath/usr/sbin/* \
$rootfspath/usr/lib/* \
$rootfspath/usr/lib/xtables/*
rm -rv $rootfspath/usr/share/man
# ${CROSS_COMPILE}-strip \
# $rootfspath/usr/bin/* \
# $rootfspath/usr/sbin/* \
# $rootfspath/usr/lib/* \
# $rootfspath/usr/lib/xtables/*
# rm -rv $rootfspath/usr/share/man
printf "$GREEN** SUCCESS: Building and installing ${pkgname}\n$RESET"
}
+2 -2
View File
@@ -18,8 +18,8 @@ iw() {
PKG_CONFIG_PATH=/opt/toolchains/$CROSS_COMPILE/$CROSS_COMPILE/sysroot/usr/lib/pkgconfig \
make ${makeflags}
check $? "Build ${pkgname}"
${CROSS_COMPILE}-strip iw
check $? "Stripping ${pkgname} binary"
# ${CROSS_COMPILE}-strip iw
# check $? "Stripping ${pkgname} binary"
cp -v iw $rootfspath/usr/bin/iw
check $? "Install to rootfs ${pkgname}"
}
+3 -1
View File
@@ -41,7 +41,7 @@ kernel_modules() {
gzip -9 $i;
done
check $? "Install Linux Kernel modules"
rm -v $rootfspath/usr/lib/modules/$KERNEL_VERSION/{source,build}
# rm -v $rootfspath/usr/lib/modules/$KERNEL_VERSION/{source,build}
} # kernel_modules
#-----------------------------------------------------------
@@ -74,4 +74,6 @@ kernel_headers() {
cd linux-$KERNEL_VERSION
make ARCH=$ARCH headers
check $? "Build kernel headers"
make INSTALL_HDR_PATH=$rootfspath/usr headers_install
check $? "Install kernel headers to rootfs"
}
+2 -2
View File
@@ -24,8 +24,8 @@ libnl() {
make $makeflags
check $? "Build ${pkgname}"
make DESTDIR=$(pwd)/bin install
rm -rv $(pwd)/bin/opt/toolchains/$CROSS_COMPILE/$CROSS_COMPILE/sysroot/usr/lib/{pkgconfig,*.la}
${CROSS_COMPILE}-strip $(pwd)/bin/opt/toolchains/$CROSS_COMPILE/$CROSS_COMPILE/sysroot/usr/lib/*
# rm -rv $(pwd)/bin/opt/toolchains/$CROSS_COMPILE/$CROSS_COMPILE/sysroot/usr/lib/{pkgconfig,*.la}
# ${CROSS_COMPILE}-strip $(pwd)/bin/opt/toolchains/$CROSS_COMPILE/$CROSS_COMPILE/sysroot/usr/lib/*
cd $(pwd)/bin/opt/toolchains/$CROSS_COMPILE/$CROSS_COMPILE/sysroot/usr/lib
tar -czvf /tmp/${pkgname}.tar.gz .
check $? "Archived libs"
+5 -5
View File
@@ -21,9 +21,9 @@ libsqlite3() {
check $? "Build ${pkgname}"
make DESTDIR=$rootfspath install
check $? "Installing to rootfs ${pkgname}"
${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/lib/*
rm -rvf $rootfspath/usr/lib/pkgconfig
find $rootfspath -type f -name "*.a" -delete
find $rootfspath -type f -name "*.la" -delete
rm -rvf $rootfspath/usr/include $rootfspath/usr/share/man $rootfspath/usr/share/doc
# ${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/lib/*
# rm -rvf $rootfspath/usr/lib/pkgconfig
# find $rootfspath -type f -name "*.a" -delete
# find $rootfspath -type f -name "*.la" -delete
# rm -rvf $rootfspath/usr/include $rootfspath/usr/share/man $rootfspath/usr/share/doc
}
+3 -3
View File
@@ -12,7 +12,7 @@ lm_sensors() {
git clone https://github.com/lm-sensors/lm-sensors.git
cd lm-sensors
make CC=$CROSS_COMPILE-gcc PREFIX=/usr DESTDIR=$rootfspath install -j$(nproc)
rm -rf $rootfspath/usr/man $rootfspath/usr/include
find $rootfspath -type f -name "*.a" -delete
${CROSS_COMPILE}-strip $rootfspath/usr/bin/* $rootfspath/usr/lib/* $rootfspath/usr/sbin/*
# rm -rf $rootfspath/usr/man $rootfspath/usr/include
# find $rootfspath -type f -name "*.a" -delete
# ${CROSS_COMPILE}-strip $rootfspath/usr/bin/* $rootfspath/usr/lib/* $rootfspath/usr/sbin/*
}
+1 -1
View File
@@ -20,6 +20,6 @@ lrzsz-build() {
check $? "Build ${pkgname}"
make DESTDIR=$rootfspath install
# rm -rv $rootfspath/usr/include $rootfspath/usr/share/man $rootfspath/usr/lib/{pkgconfig,libz.a}
${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/bin/{lsx,lrb,lrx,lrz,lsz,lsb}
# ${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/bin/{lsx,lrb,lrx,lrz,lsz,lsb}
check $? "Installing to rootfs ${pkgname}"
}
+2 -2
View File
@@ -25,8 +25,8 @@ openssl() {
check $? "Configure ${pkgname}"
make ${makeflags}
check $? "Build ${pkgname}"
${CROSS_COMPILE}-strip libcrypto.so.3 libssl.so.3
check $? "Stripping ${pkgname} binary"
# ${CROSS_COMPILE}-strip libcrypto.so.3 libssl.so.3
# check $? "Stripping ${pkgname} binary"
cp -v libcrypto.so.3 libssl.so.3 $rootfspath/usr/lib/
ln -sv libcrypto.so.3 $rootfspath/usr/lib/libcrypto.so
ln -sv libssl.so.3 $rootfspath/usr/lib/libssl.so
+15 -5
View File
@@ -26,6 +26,7 @@
. ./scripts/wpa_supplicant.sh
. ./scripts/lrzsz.sh
. ./scripts/tcc.sh
. ./scripts/cleanup_rootfs.sh
#----------- Building rootfs ----------------------
rootfs() {
@@ -59,14 +60,14 @@ BUILD_ID="$distro_build_id"
EOF
busybox_rootfs
cp -v $build/busybox/busybox-${BUSYBOX_VERSION}/busybox $rootfspath/usr/bin # &>> $fulllogfile
cd $rootfspath/usr/bin
for i in $(cat $BUSYBOX_LIST_FILE); do ln -sv busybox $i; done
# cp -v $build/busybox/busybox-${BUSYBOX_VERSION}/busybox $rootfspath/usr/bin # &>> $fulllogfile
# cd $rootfspath/usr/bin
# for i in $(cat $BUSYBOX_LIST_FILE); do ln -sv busybox $i; done
# cp -v $root/rootfs/init.in $rootfspath/init
kernel_headers
uclibc
kernel
kernel_modules
# kernel
# kernel_modules
if [ "$FINIT_INIT_ENABLE" = "y" ]; then
finit_init
# cp -rv $root/rootfs/overlay/* $rootfspath
@@ -112,5 +113,14 @@ EOF
chmod 644 $rootfspath/etc/{passwd,group,hostname,hosts,fstab,shells,issue} $rootfspath/etc/network/interfaces
check $? "Build rootfs"
cleanup_rootfs
kernel
kernel_modules
if [ "${board}" = "orangepi_pc" ] && [ "${TCC_C_COMPILER_ENABLE}" = "y" ]
then
cd $rootfspath
patch -p1 < $root/board/board/uclibc-1.0.56-byteswap-common.h.patch
cd -
fi
} # rootfs
#--------------------------------------------------
+2 -2
View File
@@ -23,12 +23,12 @@ sftp_server() {
--prefix=/usr \
--host=$CROSS_COMPILE \
--without-openssl \
--with-zlib=$rootfspath/usr
--with-zlib=$rootfspath/usr/include
check $? "Configure openssh"
make sftp-server $makeflags # &>> $fulllogfile
check $? "Build sftp-server"
cp -v sftp-server $rootfspath/usr/bin/
$CROSS_COMPILE-strip $rootfspath/usr/bin/sftp-server
# $CROSS_COMPILE-strip $rootfspath/usr/bin/sftp-server
check $? "Install sftp-server to rootfs directory"
check $? "Build and install sftp-server to rootfs directory"
}
+4 -4
View File
@@ -25,9 +25,9 @@ tcc_build() {
make $makeflags
check $? "Build ${pkgname}"
make DESTDIR=$rootfspath install
${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/bin/tcc $rootfspath/usr/lib/libtcc.so
# ${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/bin/tcc $rootfspath/usr/lib/libtcc.so
check $? "Installing to rootfs ${pkgname}"
find $rootfspath -type f -name "*.a" -delete
find $rootfspath -type f -name "*.la" -delete
rm -rvf $rootfspath/usr/share/{info,man,doc}
# find $rootfspath -type f -name "*.a" -delete
# find $rootfspath -type f -name "*.la" -delete
# rm -rvf $rootfspath/usr/share/{info,man,doc}
}
+7 -7
View File
@@ -24,13 +24,13 @@ uclibc() {
sed -i 's/constexpr/is_constant/g' extra/scripts/unifdef.c
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- DESTDIR=$rootfspath install # &>> $fulllogfile
check $? "Install ${pkgname} to rootfs"
cd $rootfspath
find -name \*.a -delete # &>> $fulllogfile
find -name \*.o -delete
rm -v $rootfspath/usr/lib/libc.so
${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/lib/* $rootfspath/usr/bin/* # &>> $fulllogfile $rootfspath/usr/lib/*
rm -rv $rootfspath/usr/include
cd $root
# cd $rootfspath
# find -name \*.a -delete # &>> $fulllogfile
# find -name \*.o -delete
# rm -v $rootfspath/usr/lib/libc.so
# ${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/lib/* $rootfspath/usr/bin/* # &>> $fulllogfile $rootfspath/usr/lib/*
# rm -rv $rootfspath/usr/include
# cd $root
check $? "Build and install ${pkgname}"
}
#-----------------------------------------------------------
+2 -2
View File
@@ -22,8 +22,8 @@ build_wpa_supplicant() {
PKG_CONFIG_PATH=/opt/toolchains/$CROSS_COMPILE/$CROSS_COMPILE/sysroot/usr/lib/pkgconfig \
make ${makeflags} BINDIR=/usr/bin LIBDIR=/usr/lib
check $? "Build ${pkgname}"
${CROSS_COMPILE}-strip wpa_cli wpa_passphrase wpa_supplicant
check $? "Stripping ${pkgname} binary"
# ${CROSS_COMPILE}-strip wpa_cli wpa_passphrase wpa_supplicant
# check $? "Stripping ${pkgname} binary"
cp -v wpa_cli wpa_passphrase wpa_supplicant $rootfspath/usr/bin/
check $? "Install to rootfs ${pkgname}"
}
+4 -4
View File
@@ -19,9 +19,9 @@ zlib() {
check $? "Build ${pkgname}"
make DESTDIR=$rootfspath install
# rm -rv $rootfspath/usr/include $rootfspath/usr/share/man $rootfspath/usr/lib/{pkgconfig,libz.a}
${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/lib/libz.so.${pkgver}
# ${CROSS_COMPILE}-strip --strip-unneeded $rootfspath/usr/lib/libz.so.${pkgver}
check $? "Installing to rootfs ${pkgname}"
rm -rvf $rootfspath/usr/lib/pkgconfig
find $rootfspath -type f -name "*.a" -delete
find $rootfspath -type f -name "*.la" -delete
# rm -rvf $rootfspath/usr/lib/pkgconfig
# find $rootfspath -type f -name "*.a" -delete
# find $rootfspath -type f -name "*.la" -delete
}