Step2: enhanced with sysvinit

- Add libxcrypt.
- Add sysvinit.
- Update target-finalize to support sysvinit.

Signed-off-by: Chen Wang <wangchen20@iscas.ac.cn>
This commit is contained in:
Chen Wang
2025-12-05 14:08:12 +08:00
committed by Chen Wang
parent d35682f2b7
commit cb9441ee2a
8 changed files with 162 additions and 1 deletions

43
package/libxcrypt/make.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/bash
source $(dirname "$0")/../common.sh
PKGNAME=libxcrypt
PKGVERSION=4.4.38
PKGSOURCE_DIR=libxcrypt
PKGSOURCE=libxcrypt-4.4.38.tar.xz
PKGURL=https://github.com/besser82/libxcrypt/releases/download/v4.4.38/libxcrypt-4.4.38.tar.xz
PKGBUILDNAME=${PKGNAME}
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
echo "----> Building ${PKGBUILDNAME} ..."
stamp_downloaded
step_start extract
mkdir -p ${PKGBUILD_DIR}
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
chmod -R +rw ${PKGBUILD_DIR}
step_end extract
stamp_patched autotools
step_start configure
(cd ${PKGBUILD_DIR} && rm -rf config.cache && eval "${TARGET_CONFIGURE_OPTS} CXX=no ac_cv_lbl_unaligned_fail=yes ac_cv_func_mmap_fixed_mapped=yes ac_cv_func_memcmp_working=yes ac_cv_have_decl_malloc=yes gl_cv_func_malloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes ac_cv_func_calloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes lt_cv_sys_lib_search_path_spec=\"\" ac_cv_c_bigendian=no CONFIG_SITE=/dev/null ./configure --target=${GNU_TARGET_NAME} --host=${GNU_TARGET_NAME} --build=x86_64-pc-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --localstatedir=/var --program-prefix=\"\" --disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --with-xmlto=no --with-fop=no --disable-dependency-tracking --enable-ipv6 --disable-nls --disable-static --enable-shared --disable-werror --disable-obsolete_api")
step_end configure
step_start build
eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} -C ${PKGBUILD_DIR}"
step_end build
step_start install-staging
eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} DESTDIR=${STAGING_DIR} install -C ${PKGBUILD_DIR}"
step_end install-staging
step_start install-target
eval "${TARGET_MAKE_ENV} /usr/bin/make -j${MAXNUM_CPUS} DESTDIR=${TARGET_DIR} install -C ${PKGBUILD_DIR}"
step_end install-target
stamp_installed
echo "<---- ${PKGBUILDNAME} build complete."

View File

@@ -0,0 +1,33 @@
From 0759f3f9bb2850df455599e7c82eda4ec804e3b6 Mon Sep 17 00:00:00 2001
From: Peter Seiderer <ps.report@gmx.net>
Date: Wed, 10 Mar 2021 22:57:50 +0100
Subject: [PATCH] Makefile: disable stack-protector-strong
Fixes:
.../aarch64-buildroot-linux-uclibc/bin/ld: runlevel.o: in function `main':
runlevel.c:(.text.startup+0x4): undefined reference to `__stack_chk_guard'
.../aarch64-buildroot-linux-uclibc/bin/ld: cannot find -lssp_nonshared
.../aarch64-buildroot-linux-uclibc/bin/ld: cannot find -lssp
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
src/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Makefile b/src/Makefile
index 1b368dc..1985929 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -10,7 +10,7 @@
CPPFLAGS =
CFLAGS ?= -O2
-override CFLAGS += -ansi -fomit-frame-pointer -fstack-protector-strong -W -Wall -Wunreachable-code -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -D_XOPEN_SOURCE -D_GNU_SOURCE -DVERSION=\"$(VERSION)\"
+override CFLAGS += -ansi -fomit-frame-pointer -W -Wall -Wunreachable-code -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -D_XOPEN_SOURCE -D_GNU_SOURCE -DVERSION=\"$(VERSION)\"
override CFLAGS += $(shell getconf LFS_CFLAGS)
STATIC =
MANDB := s@^\('\\\\\"\)[^\*-]*-\*- coding: [^[:blank:]]\+ -\*-@\1@
--
2.30.1

32
package/sysvinit/inittab Normal file
View File

@@ -0,0 +1,32 @@
# /etc/inittab
#
# This inittab is a basic inittab sample for sysvinit, which mimics
# Buildroot's default inittab for BusyBox.
id:3:initdefault:
si0::sysinit:/bin/mount -t proc proc /proc
si1::sysinit:/bin/mount -o remount,rw /
si2::sysinit:/bin/mkdir -p /dev/pts /dev/shm
si3::sysinit:/bin/mount -a
si4::sysinit:/bin/mkdir -p /run/lock/subsys
si5::sysinit:/sbin/swapon -a
si6::sysinit:/bin/ln -sf /proc/self/fd /dev/fd 2>/dev/null
si7::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin 2>/dev/null
si8::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout 2>/dev/null
si9::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr 2>/dev/null
si10::sysinit:/bin/hostname -F /etc/hostname
rcS:12345:wait:/etc/init.d/rcS
# S0:1:respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL
# Stuff to do for the 3-finger salute
#ca::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
shd0:06:wait:/etc/init.d/rcK
shd1:06:wait:/sbin/swapoff -a
shd2:06:wait:/bin/umount -a -r
# The usual halt or reboot actions
hlt0:0:wait:/sbin/halt -dhp
reb0:6:wait:/sbin/reboot

45
package/sysvinit/make.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/usr/bin/bash
source $(dirname "$0")/../common.sh
PKGNAME=sysvinit
PKGVERSION=3.14
PKGSOURCE_DIR=sysvinit
PKGSOURCE=sysvinit-3.14.tar.xz
PKGURL=https://github.com/slicer69/sysvinit/releases/download/3.14/sysvinit-3.14.tar.xz
PKGBUILDNAME=${PKGNAME}
PKGBUILD_DIR=${BUILD_DIR}/${PKGBUILDNAME}-${PKGVERSION}
echo "----> Building ${PKGBUILDNAME} ..."
stamp_downloaded
step_start extract
mkdir -p ${PKGBUILD_DIR}
xzcat ${DL_DIR}/${PKGSOURCE_DIR}/${PKGSOURCE} | tar --strip-components=1 -C ${PKGBUILD_DIR} -xf -
chmod -R +rw ${PKGBUILD_DIR}
step_end extract
step_start patch
TAR="tar" PATH=${HOST_DIR}/bin:$PATH ${PROJECT_DIR}/support/scripts/apply-patches.sh ${PKGBUILD_DIR} ${PROJECT_DIR}/package/${PKGNAME} \*.patch
step_end patch
stamp_configured
step_start build
eval "${TARGET_CONFIGURE_OPTS} CXX=no /usr/bin/make -j${MAXNUM_CPUS} SYSROOT=${STAGING_DIR} VERSION=3.14 -C ${PKGBUILD_DIR}/src"
step_end build
step_start install-target
for x in halt init shutdown killall5; do
/usr/bin/install -D -m 0755 ${PKGBUILD_DIR}/src/$x ${TARGET_DIR}/sbin/$x || exit 1;
done
/usr/bin/install -D -m 0644 ${PROJECT_DIR}/package/sysvinit/inittab ${TARGET_DIR}/etc/inittab
ln -sf /sbin/halt ${TARGET_DIR}/sbin/reboot
ln -sf /sbin/halt ${TARGET_DIR}/sbin/poweroff
ln -sf killall5 ${TARGET_DIR}/sbin/pidof
step_end install-target
stamp_installed
echo "<---- ${PKGBUILDNAME} build complete."

View File

@@ -21,7 +21,7 @@ echo ">>> Installing urandom-scripts"
/usr/bin/install -D -m 0755 ${PROJECT_DIR}/package/${PKGNAME}/urandom-scripts/S01seedrng ${TARGET_DIR}/etc/init.d/S01seedrng
echo ">>> Finalizing target directory"
/usr/bin/sed -i -e '/# GENERIC_SERIAL$/s~^.*#~console::respawn:/sbin/getty -L console 0 vt100 #~' ${TARGET_DIR}/etc/inittab
/usr/bin/sed -i -e '/# GENERIC_SERIAL$/s~^.*#~sole::respawn:/sbin/getty -L console 0 vt100 #~' ${TARGET_DIR}/etc/inittab
/usr/bin/sed -i -e '/^#.*-o remount,rw \/$/s~^#\+~~' ${TARGET_DIR}/etc/inittab
if grep -q CONFIG_ASH=y ${BUILD_DIR}/busybox-1.37.0/.config; then grep -qsE '^/bin/ash$' ${TARGET_DIR}/etc/shells || echo "/bin/ash" >> ${TARGET_DIR}/etc/shells; fi
if grep -q CONFIG_HUSH=y ${BUILD_DIR}/busybox-1.37.0/.config; then grep -qsE '^/bin/hush$' ${TARGET_DIR}/etc/shells || echo "/bin/hush" >> ${TARGET_DIR}/etc/shells; fi