added finit init system support
This commit is contained in:
@@ -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
|
||||
#--------------------------------------
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#DNSD_ARGS="-t 120 -s -v"
|
||||
@@ -0,0 +1 @@
|
||||
DNSMASQ_ARGS="-u root"
|
||||
@@ -0,0 +1,3 @@
|
||||
DROPBEAR_PORT=22
|
||||
DROPBEAR_EXTRA_ARGS="-E -R -B -m -F"
|
||||
ENABLE_ROOT_LOGIN="yes"
|
||||
@@ -0,0 +1 @@
|
||||
HTTPD_ARGS="-h /srv/www"
|
||||
@@ -0,0 +1 @@
|
||||
service [2345] log env:-/etc/default/dnsd $DNSD_ARGS -- DNS daemon
|
||||
@@ -0,0 +1 @@
|
||||
service env:-/etc/default/dnsmasq <pid/syslogd> [S12345] dnsmasq -k $DNSMASQ_ARGS -- DHCP/DNS proxy
|
||||
@@ -0,0 +1 @@
|
||||
service [2345] env:/etc/default/dropbear dropbear $DROPBEAR_EXTRA_ARGS -p$DROPBEAR_PORT -- Dropbear SSH daemon
|
||||
@@ -0,0 +1,3 @@
|
||||
# Consoles to start getty on when system is up
|
||||
tty [12345] /dev/ttyS0 noclear nowait
|
||||
tty [12345] /dev/tty1 noclear nowait
|
||||
@@ -0,0 +1 @@
|
||||
run [123456789] hostname -F /etc/hostname -- Set up hostname
|
||||
@@ -0,0 +1 @@
|
||||
service log env:-/etc/default/httpd pid:/run/httpd.pid <!> [2345] httpd -f $HTTPD_ARGS -- HTTP daemon
|
||||
@@ -0,0 +1 @@
|
||||
service [2345] inetd -f -- Internet super server
|
||||
@@ -0,0 +1,16 @@
|
||||
# cat syslogd.conf
|
||||
# BusyBox syslogd + klogd
|
||||
# Use <pid/syslogd> as barrier for other system tasks and service that
|
||||
# rely on modules, firmware, and device nodes to be ready.
|
||||
|
||||
# We want syslogd to always run, never be stopped, regardless of runlevel
|
||||
# so it can send to any remote syslog server the user has set up.
|
||||
service if:udevd nowarn env:-/etc/default/syslogd <!run/udevadm:5/success> \
|
||||
[S0123456789] syslogd -n $SYSLOGD_ARGS -- System log daemon
|
||||
service if:mdev nowarn env:-/etc/default/syslogd <!run/coldplug/success> \
|
||||
[S0123456789] syslogd -n $SYSLOGD_ARGS -- System log daemon
|
||||
service if:mdevd nowarn env:-/etc/default/syslogd <!run/coldplug/success> \
|
||||
[S0123456789] syslogd -n $SYSLOGD_ARGS -- System log daemon
|
||||
|
||||
# klogd depends on syslogd, but BusyBox syslogd doesn't create a PID file to sync with
|
||||
service [S0123456789] <!pid/syslogd> klogd -n -- Kernel log daemon
|
||||
@@ -0,0 +1,5 @@
|
||||
# cat telnetd.conf
|
||||
# Note: telnetd also runs from inetd, see /etc/inetd.conf
|
||||
#service [2345] <!> :23 telnetd -F -p 23 -- Telnet daemon on port 23
|
||||
#service [2345] <!> :2323 telnetd -F -p 2323 -- Telnet daemon on port 2323
|
||||
service [2345] <!> telnetd -F -- Telnet daemon
|
||||
@@ -0,0 +1 @@
|
||||
../available/dropbear.conf
|
||||
@@ -0,0 +1 @@
|
||||
../available/getty.conf
|
||||
@@ -0,0 +1 @@
|
||||
../available/hostname.conf
|
||||
@@ -0,0 +1 @@
|
||||
../available/inetd.conf
|
||||
@@ -0,0 +1 @@
|
||||
../available/syslogd.conf
|
||||
@@ -0,0 +1 @@
|
||||
../available/telnetd.conf
|
||||
@@ -0,0 +1 @@
|
||||
/dev/sda / ext4 rw,relatime 0 0
|
||||
@@ -0,0 +1 @@
|
||||
simple
|
||||
@@ -0,0 +1,3 @@
|
||||
127.0.0.1 localhost
|
||||
::1 localhost
|
||||
127.0.1.1 simple.localdomain simple
|
||||
@@ -0,0 +1 @@
|
||||
21 stream tcp nowait root /sbin/ftpd /sbin/ftpd -S -A -w /srv/ftp
|
||||
@@ -0,0 +1 @@
|
||||
\n \r (\l)
|
||||
@@ -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
@@ -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
|
||||
#--------------------------------------
|
||||
|
||||
@@ -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/*
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user