added finit init system support

This commit is contained in:
wt
2025-08-16 22:51:03 +07:00
parent f8325e328f
commit a605476c80
30 changed files with 173 additions and 23 deletions
+5 -1
View File
@@ -16,6 +16,7 @@
. ./scripts/openssl.sh
. ./scripts/iptables.sh
. ./scripts/8821au_ko.sh
. ./scripts/finit_init.sh
case $1 in
build)
@@ -23,7 +24,7 @@ case $1 in
download_sources
fi
rootfs
if [ "$IMAGE_USABLE_ENABLE" = "true" ]; then
if [ "$IMAGE_USABLE_ENABLE" = "y" ]; then
sdroot_usable
fi
sdroot
@@ -53,6 +54,9 @@ case $1 in
iptables)
iptables
;;
finit_init)
finit_init
;;
ko8821au)
ko8821au
;;
+16 -11
View File
@@ -2,12 +2,16 @@
#------------ config ------------------
export PATH=$PATH:/opt/toolchains/arm-buildroot-linux-uclibcgnueabihf/bin
export PKG_CONFIG_PATH=/opt/toolchains/arm-buildroot-linux-uclibcgnueabihf/arm-buildroot-linux-uclibcgnueabihf/sysroot/usr/lib/pkgconfig
export version=0.0.1 # script version
export root=$(pwd) # root build directory
# disk="sdz" # disk to write install image
export distro_name="Simple" # distro name
export distro_name="Simple Linux" # distro name
export distro_pretty_name="Simple Linux"
export distro_id="simple"
export distro_build_id="rolling"
export distro_desc="Simple linux distro" # distro desctiption
export distro_codename="zero_zero_one" # distro codename
export distro_codename="zero_zero_one" # distro codename
# hyperv_support="false" # hyperv support for kernel image
export BOARD_NAME=orangepi_pc
export out=$root/out # output directory
@@ -37,13 +41,14 @@ export CURL_ENABLE=n
export BASH_ENABLE=n
export GIT_ENABLE=n
export GITEA_ENABLE=n
export LIBNL_ENABLE=y
export IW_ENABLE=y
export WIRELES_TOOLS_ENABLE=y
export WPA_SUPPLICANT_ENABLE=y
export HOSTAPD_ENABLE=y
export OPENSSL_ENABLE=y
export DNSMASQ_ENABLE=y
export IPTABLES_ENABLE=y
export KO8821AU_ENABLE=y
export LIBNL_ENABLE=n
export IW_ENABLE=n
export WIRELES_TOOLS_ENABLE=n
export WPA_SUPPLICANT_ENABLE=n
export HOSTAPD_ENABLE=n
export OPENSSL_ENABLE=n
export DNSMASQ_ENABLE=n
export IPTABLES_ENABLE=n
export KO8821AU_ENABLE=n
export FINIT_INIT_ENABLE=y
#--------------------------------------
+72
View File
@@ -0,0 +1,72 @@
#!/bin/sh
. ./scripts/colors.sh
. ./scripts/funcs.sh
. ./scripts/config.sh
finit_init() {
printf "$GREEN** Building and installing finit\n$RESET"
mkdir -pv $build/finit
cd $build/finit
git clone https://github.com/troglobit/libite
check $? "Download libite"
git clone https://github.com/troglobit/libuev
check $? "Download libuev"
git clone https://github.com/troglobit/finit
check $? "Download finit"
cd libite
./autogen.sh
check $? "Autogen libite"
./configure --host=$CROSS_COMPILE --prefix=/usr
check $? "Configure libite"
make $makeflags
check $? "Build libite"
make DESTDIR=$rootfspath install
check $? "Installing to rootfs libite"
cd ../libuev
./autogen.sh
check $? "Autogen libuev"
./configure --host=$CROSS_COMPILE --prefix=/usr
check $? "Configure libuev"
make $makeflags
check $? "Build libuev"
make DESTDIR=$rootfspath install
check $? "Installing to rootfs libuev"
cd ../finit
./autogen.sh
check $? "Autogen finit"
./configure \
--host=$CROSS_COMPILE \
--prefix=/usr \
--exec-prefix= \
--sysconfdir=/etc \
--localstatedir=/var \
--with-watchdog \
--with-keventd \
--with-sulogin
check $? "Configure finit"
make $makeflags
check $? "Build finit"
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/*
}
+14
View File
@@ -20,6 +20,7 @@
. ./scripts/dnsmasq.sh
. ./scripts/iptables.sh
. ./scripts/8821au_ko.sh
. ./scripts/finit_init.sh
#----------- Building rootfs ----------------------
rootfs() {
@@ -45,6 +46,13 @@ rootfs() {
rm -rv initscripts
ln -sv /proc/mounts etc/mtab # &>> $fulllogfile
cat <<EOF > $rootfspath/etc/os-release
NAME="$distro_name"
PRETTY_NAME="$distro_pretty_name"
ID="$distro_id"
BUILD_ID="$distro_build_id"
EOF
busybox_rootfs
cp -v $build/busybox/busybox-1.36.1/busybox $rootfspath/usr/bin # &>> $fulllogfile
cd $rootfspath/usr/bin
@@ -54,6 +62,12 @@ rootfs() {
uclibc
kernel
kernel_modules
if [ "$FINIT_INIT_ENABLE" = "y" ]; then
finit_init
cp -rv $root/rootfs/overlay/* $rootfspath
rm $rootfspath/init
ln -sv usr/bin/finit $rootfspath/init
fi
[ "$ZLIB_ENABLE" = "y" ] && zlib
[ "$OPENSSL_ENABLE" = "y" ] && openssl
[ "$DNSMASQ_ENABLE" = "y" ] && dnsmasq
+1
View File
@@ -20,6 +20,7 @@ uclibc() {
check $? "Configure ${pkgname}"
make ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE- $makeflags # &>> $fulllogfile
check $? "Build ${pkgname}"
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