Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
#!/bin/sh
DAEMON=/usr/sbin/crond
NAME=crond
DESC="Busybox Periodic Command Scheduler"
ARGS="-c /etc/cron/crontabs"
test -f $DAEMON || exit 0
set -e
case "$1" in
start)
echo -n "starting $DESC: $NAME... "
start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
echo "done."
;;
stop)
echo -n "stopping $DESC: $NAME... "
start-stop-daemon -K -n $NAME
echo "done."
;;
restart)
echo -n "restarting $DESC: $NAME... "
$0 stop
$0 start
echo "done."
;;
reload)
echo -n "reloading $DESC: $NAME... "
killall -HUP $(basename ${DAEMON})
echo "done."
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac
exit 0
+44
View File
@@ -0,0 +1,44 @@
#!/bin/sh
DAEMON=/usr/sbin/httpd
NAME=httpd
DESC="Busybox HTTP Daemon"
HTTPROOT="/srv/www"
ARGS="-h $HTTPROOT"
test -f $DAEMON || exit 0
set -e
case "$1" in
start)
echo -n "starting $DESC: $NAME... "
if [ ! -d $HTTPROOT ]; then
echo "$HTTPROOT is missing."
exit 1
fi
start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
echo "done."
;;
stop)
echo -n "stopping $DESC: $NAME... "
start-stop-daemon -K -n $NAME
echo "done."
;;
restart)
echo "restarting $DESC: $NAME... "
$0 stop
$0 start
echo "done."
;;
reload)
echo -n "reloading $DESC: $NAME... "
killall -HUP $(basename ${DAEMON})
echo "done."
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac
exit 0
@@ -0,0 +1,8 @@
[Unit]
Description=Kernel Logging Service
[Service]
ExecStart=@base_sbindir@/klogd -n
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,25 @@
#OPTIONS="-C"
# The above option means syslogd will log to 16K shm circular buffer.
# You could use `logread' to read it.
# All available options are:
# -O FILE : Log to FILE (default:/var/log/messages)
# -l N : Log only messages more urgent than prio N (1-8)
# -S : Smaller output
# -s SIZE : Max size (KB) before rotation (default:200KB, 0=off)
# -b N : N rotated logs to keep (default:1, max=99, 0=purge)
# -R HOST[:PORT]: Log to HOST:PORT (default PORT:514)
# -L : Log locally and via network
# -D : Drop duplicates
# -C[size_kb] : Log to shared mem buffer (use logread to read it)
# -f FILE : Use FILE as config (default:/etc/syslog.conf)
# -m MIN : Minutes between mark lines (default:20, 0=off)
# -K : Log to kernel printk buffer (use dmesg to read it)
# Example 1:
# Log to local file /var/log/mylog
# OPTIONS="-O /var/log/mylog"
#
# Example 2:
# Log to remote host
# OPTIONS="-R 192.168.1.1:601"
@@ -0,0 +1,13 @@
[Unit]
Description=System Logging Service
Wants=busybox-klogd.service
[Service]
EnvironmentFile=-/etc/default/busybox-syslog
ExecStart=@base_sbindir@/syslogd -n $OPTIONS
Sockets=syslog.socket
[Install]
WantedBy=multi-user.target
Also=busybox-klogd.service
Alias=syslog.service
+43
View File
@@ -0,0 +1,43 @@
#!/bin/sh
DAEMON=/usr/sbin/udhcpd
NAME=udhcpd
DESC="Busybox UDHCP Server"
ARGS="/etc/udhcpd.conf"
test -f $DAEMON || exit 1
set -e
case "$1" in
start)
echo -n "starting $DESC: $NAME... "
if [ ! -f /etc/udhcpd.conf ]; then
echo "error: /etc/udhcpd.conf is missing."
exit 1
fi
/sbin/start-stop-daemon -S -b -n $NAME -a $DAEMON -- $ARGS
echo "done."
;;
stop)
echo -n "stopping $DESC: $NAME... "
/sbin/start-stop-daemon -K -n $NAME
echo "done."
;;
restart)
echo "restarting $DESC: $NAME... "
$0 stop
$0 start
echo "done."
;;
reload)
echo -n "reloading $DESC: $NAME... "
killall -HUP $(basename ${DAEMON})
echo "done."
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
;;
esac
exit 0
@@ -0,0 +1,4 @@
#!/bin/sh
exec run-parts -a "$1" /etc/udhcpc.d
@@ -0,0 +1,6 @@
#!/bin/sh
if grep -q "input:.*-e0.*,3,.*a0,1,\|ads7846" /sys/class/$MDEV/device/modalias ; then
ln -sf /dev/$MDEV /dev/input/touchscreen0
fi
@@ -0,0 +1,83 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: hwclock
# Required-Start:
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Set system clock
# Description: Set system clock to hardware clock, according to the UTC
# setting in /etc/default/rcS (see also rcS(5)).
### END INIT INFO
#
# WARNING: If your hardware clock is not in UTC/GMT, this script
# must know the local time zone. This information is
# stored in /etc/localtime. This might be a problem if
# your /etc/localtime is a symlink to something in
# /usr/share/zoneinfo AND /usr isn't in the root
# partition! The workaround is to define TZ either
# in /etc/default/rcS, or in the proper place below.
[ ! -x /sbin/hwclock ] && exit 0
[ -f /etc/default/rcS ] && . /etc/default/rcS
[ "$UTC" = "yes" ] && tz="--utc" || tz="--localtime"
case "$1" in
start)
if [ "$VERBOSE" != no ]
then
echo "System time was `date`."
echo "Setting the System Clock using the Hardware Clock as reference..."
fi
if [ "$HWCLOCKACCESS" != no ]
then
if [ -z "$TZ" ]
then
hwclock $tz --hctosys
else
TZ="$TZ" hwclock $tz --hctosys
fi
fi
if [ "$VERBOSE" != no ]
then
echo "System Clock set. System local time is now `date`."
fi
;;
stop|restart|reload|force-reload)
#
# Updates the Hardware Clock with the System Clock time.
# This will *override* any changes made to the Hardware Clock.
#
# WARNING: If you disable this, any changes to the system
# clock will not be carried across reboots.
#
if [ "$VERBOSE" != no ]
then
echo "Saving the System Clock time to the Hardware Clock..."
fi
if [ "$HWCLOCKACCESS" != no ]
then
hwclock $tz --systohc
fi
if [ "$VERBOSE" != no ]
then
echo "Hardware Clock updated to `date`."
fi
exit 0
;;
show)
if [ "$HWCLOCKACCESS" != no ]
then
hwclock $tz --show
fi
;;
*)
echo "Usage: hwclock.sh {start|stop|show|reload|restart}" >&2
echo " start sets kernel (system) clock from hardware (RTC) clock" >&2
echo " stop and reload set hardware (RTC) clock from kernel (system) clock" >&2
exit 1
;;
esac
@@ -0,0 +1,33 @@
#!/bin/sh
#
# start/stop inetd super server.
if ! [ -x /usr/sbin/inetd ]; then
exit 0
fi
case "$1" in
start)
echo -n "Starting internet superserver:"
echo -n " inetd" ; start-stop-daemon -S -x /usr/sbin/inetd > /dev/null
echo "."
;;
stop)
echo -n "Stopping internet superserver:"
echo -n " inetd" ; start-stop-daemon -K -x /usr/sbin/inetd > /dev/null
echo "."
;;
restart)
echo -n "Restarting internet superserver:"
echo -n " inetd "
killall -HUP inetd
echo "."
;;
*)
echo "Usage: /etc/init.d/inetd {start|stop|restart}"
exit 1
;;
esac
exit 0
@@ -0,0 +1,20 @@
# /etc/inetd.conf: see inetd(8) for further informations.
#
# Internet server configuration database
#
# If you want to disable an entry so it isn't touched during
# package updates just comment it out with a single '#' character.
#
# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
#
#:INTERNAL: Internal services
#echo stream tcp nowait root internal
#echo dgram udp wait root internal
#chargen stream tcp nowait root internal
#chargen dgram udp wait root internal
#discard stream tcp nowait root internal
#discard dgram udp wait root internal
#daytime stream tcp nowait root internal
#daytime dgram udp wait root internal
#time stream tcp nowait root internal
#time dgram udp wait root internal
@@ -0,0 +1,28 @@
# This is run first except when booting in single-user mode.
# Startup the system
::sysinit:/bin/mount -t proc proc /proc
::sysinit:/bin/mount -t sysfs sysfs /sys
::sysinit:/bin/mount -t devtmpfs devtmpfs /dev
::sysinit:/bin/mount -o remount,rw /
::sysinit:/bin/mkdir -p /dev/pts
::sysinit:/bin/mount -t devpts devpts /dev/pts
::sysinit:/bin/mount -a
::sysinit:/sbin/swapon -a
null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
# set hostname
null::sysinit:/bin/busybox hostname -F /etc/hostname
::sysinit:/etc/init.d/rcS
# Stuff to do before rebooting
#::ctrlaltdel:/sbin/reboot
::shutdown:/etc/init.d/rcK
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r
# Stuff to do when restarting the init process
::restart:/sbin/init
+43
View File
@@ -0,0 +1,43 @@
#!/bin/sh
#
# Run the mdev daemon
#
DAEMON="mdev"
PIDFILE="/var/run/$DAEMON.pid"
start() {
echo -n "Starting $DAEMON... "
start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df
[ $? -eq 0 ] && echo "OK" || echo "ERROR"
# coldplug modules
find /sys/ -name modalias -print0 | \
xargs -0 sort -u | \
tr '\n' '\0' | \
xargs -0 modprobe -abq
}
stop() {
echo -n "Stopping $DAEMON... "
start-stop-daemon -K -p $PIDFILE
[ $? -eq 0 ] && echo "OK" || echo "ERROR"
}
restart() {
stop
start
}
case "$1" in
start|stop|restart)
"$1"
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $?
@@ -0,0 +1,63 @@
#!/bin/sh
MDEV_AUTOMOUNT=y
MDEV_AUTOMOUNT_ROOT=/run/media
[ -f /etc/default/mdev ] && . /etc/default/mdev
if [ "${MDEV_AUTOMOUNT}" = "n" ] ; then
exit 0
fi
case "$ACTION" in
add|"")
ACTION="add"
# check if already mounted
if grep -q "^/dev/${MDEV} " /proc/mounts ; then
# Already mounted
exit 0
fi
DEVBASE=`expr substr $MDEV 1 3`
if [ "${DEVBASE}" = "mmc" ] ; then
DEVBASE=`expr substr $MDEV 1 7`
fi
# check for "please don't mount it" file
if [ -f "/dev/nomount.${DEVBASE}" ] ; then
# blocked
exit 0
fi
# check for full-disk partition
if [ "${DEVBASE}" = "${MDEV}" ] ; then
if [ -f /sys/block/${DEVBASE}/${DEVBASE}*1/partition ] ; then
# Partition detected, just quit
exit 0
fi
if [ ! -f /sys/block/${DEVBASE}/size ] ; then
# No size at all
exit 0
fi
if [ "`cat /sys/block/${DEVBASE}/size`" = "0" ] ; then
# empty device, bail out
exit 0
fi
fi
# first allow fstab to determine the mountpoint
if ! mount /dev/$MDEV > /dev/null 2>&1
then
MOUNTPOINT="${MDEV_AUTOMOUNT_ROOT}/$MDEV"
mkdir -p "$MOUNTPOINT"
mount -t auto /dev/$MDEV "$MOUNTPOINT" || rmdir "$MOUNTPOINT"
fi
;;
remove)
MOUNTPOINT=`grep "^/dev/$MDEV\s" /proc/mounts | cut -d' ' -f 2`
if [ ! -z "$MOUNTPOINT" ]
then
umount "$MOUNTPOINT"
rmdir "$MOUNTPOINT"
else
umount /dev/$MDEV
fi
;;
*)
# Unexpected keyword
exit 1
;;
esac
@@ -0,0 +1,44 @@
$MODALIAS=.* 0:0 660 @modprobe "$MODALIAS"
console 0:0 0600
cpu_dma_latency 0:0 0660
fb0:0 44 0660
full 0:0 0666
initctl 0:0 0600
ircomm[0-9].* 0:20 0660
kmem 0:15 0640
kmsg 0:0 0660
log 0:0 0666
loop[0-9].* 0:6 0640
mem 0:15 0640
network_latency 0:0 0660
network_throughput 0:0 0660
null 0:0 0666
port 0:15 0640
ptmx 0:5 0666
ram[0-9].* 0:6 0640
random 0:0 0666
sda 0:6 0640
tty 0:5 0666
tty.* 0:0 0620
urandom 0:0 0666
usbdev.* 0:0 0660 */etc/mdev/usb.sh
vcs.* 0:5 0660
zero 0:0 0666
snd/pcm.* 0:0 0660
snd/control.* 0:0 0660
snd/timer 0:0 0660
snd/seq 0:0 0660
snd/mini.* 0:00 0660
input/event.* 0:0 0660 @/etc/mdev/find-touchscreen.sh
input/mice 0:0 0660
input/mouse.* 0:0 0660
tun[0-9]* 0:0 0660 =net/
[hs]d[a-z][0-9]? 0:0 660 */etc/mdev/mdev-mount.sh
mmcblk[0-9]rpmb 0:0 660
mmcblk[0-9]boot[0-9] 0:0 660
mmcblk[0-9].* 0:0 660 */etc/mdev/mdev-mount.sh
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
# Stop all init scripts in /etc/rc6.d
# executing them in numerical order.
#
for i in /etc/rc6.d/K??*; do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set stop
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i stop
;;
esac
done
+27
View File
@@ -0,0 +1,27 @@
#!/bin/sh
# Start all init scripts in /etc/rcS.d and /etc/rc5.d
# executing them in numerical order.
#
for i in /etc/rcS.d/S??* /etc/rc5.d/S??* ;do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
done
@@ -0,0 +1,31 @@
#
# Defaults for the boot scripts in /etc/rcS.d
#
# Time files in /tmp are kept in days.
TMPTIME=0
# Set to yes if you want sulogin to be spawned on bootup
SULOGIN=no
# Set to no if you want to be able to login over telnet/rlogin
# before system startup is complete (as soon as inetd is started)
DELAYLOGIN=no
# Assume that the BIOS clock is set to UTC time (recommended)
UTC=yes
# Set VERBOSE to "no" if you would like a more quiet bootup.
VERBOSE=no
# Set EDITMOTD to "no" if you don't want /etc/motd to be edited automatically
EDITMOTD=no
# Whether to fsck root on boot
ENABLE_ROOTFS_FSCK=no
# Set FSCKFIX to "yes" if you want to add "-y" to the fsck at startup.
FSCKFIX=yes
# Set TICKADJ to the correct tick value for this specific machine
#TICKADJ=10000
# Enable caching in populate-volatile.sh
VOLATILE_ENABLE_CACHE=yes
# Indicate whether the rootfs is intended to be read-only or not.
# Setting ROOTFS_READ_ONLY to yes and rebooting will give you a read-only rootfs.
# Normally you should not change this value.
ROOTFS_READ_ONLY=no
# Indicate init system type
INIT_SYSTEM=busybox
@@ -0,0 +1,9 @@
#!/bin/sh
current_path=$(readlink -f $0)
export bindir=$(dirname $current_path)
export PATH=$bindir/bin:$PATH
export SKIP_KNOWN_BUGS=1
cd testsuite || exit 1
LANG=C.UTF-8 ./runtest -v | sed -r 's/^(SKIPPED|UNTESTED):/SKIP:/'
@@ -0,0 +1,88 @@
#!/bin/sh
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_CONF="/etc/resolv.conf"
[ -n "$subnet" ] && NETMASK="netmask $subnet"
# return 0 if root is mounted on a network filesystem
root_is_nfs() {
sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts |
grep -q "^/ \(nfs\|smbfs\|ncp\|coda\)$"
}
have_bin_ip=0
if [ -x /SBIN_DIR/ip ]; then
have_bin_ip=1
BROADCAST="broadcast +"
fi
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
case "$1" in
deconfig)
if [ -x /SBIN_DIR/resolvconf ]; then
/SBIN_DIR/resolvconf -d "${interface}.udhcpc"
fi
if ! root_is_nfs ; then
if [ $have_bin_ip -eq 1 ]; then
/SBIN_DIR/ip -4 addr flush dev $interface
/SBIN_DIR/ip link set dev $interface up
else
/SBIN_DIR/ifconfig $interface 0.0.0.0
fi
fi
;;
renew|bound)
if [ $have_bin_ip -eq 1 ]; then
/SBIN_DIR/ip addr add dev $interface local $ip/$mask $BROADCAST
else
/SBIN_DIR/ifconfig $interface $ip $BROADCAST $NETMASK
fi
if [ -n "$router" ] ; then
if ! root_is_nfs ; then
if [ $have_bin_ip -eq 1 ]; then
while /SBIN_DIR/ip route del default dev $interface 2>/dev/null ; do
:
done
else
while /SBIN_DIR/route del default gw 0.0.0.0 dev $interface 2>/dev/null ; do
:
done
fi
fi
metric=10
for i in $router ; do
if [ $have_bin_ip -eq 1 ]; then
/SBIN_DIR/ip route add default via $i metric $metric dev $interface
else
/SBIN_DIR/route add default gw $i dev $interface metric $metric 2>/dev/null
fi
metric=$(($metric + 1))
done
fi
# Update resolver configuration file
R=""
[ -n "$domain" ] && R="domain $domain
"
for i in $dns; do
echo "$0: Adding DNS $i"
R="${R}nameserver $i
"
done
if [ -x /SBIN_DIR/resolvconf ]; then
echo -n "$R" | /SBIN_DIR/resolvconf -a "${interface}.udhcpc"
else
echo -n "$R" > "$RESOLV_CONF"
fi
;;
esac
exit 0
@@ -0,0 +1,97 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: sysklogd
# Required-Start: $remote_fs $time
# Required-Stop: $remote_fs $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: System logger
### END INIT INFO
set -e
if [ -f /etc/syslog-startup.conf ]; then
. /etc/syslog-startup.conf
LOG_LOCAL=0
LOG_REMOTE=0
for D in $DESTINATION; do
if [ "$D" = "buffer" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -C$BUFFERSIZE"
LOG_LOCAL=1
elif [ "$D" = "file" ]; then
if [ -n "$LOGFILE" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -O $LOGFILE"
fi
if [ -n "$ROTATESIZE" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -s $ROTATESIZE"
fi
if [ -n "$ROTATEGENS" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -b $ROTATEGENS"
fi
LOG_LOCAL=1
elif [ "$D" = "remote" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -R $REMOTE"
LOG_REMOTE=1
fi
done
if [ "$LOG_LOCAL" = "1" -a "$LOG_REMOTE" = "1" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -L"
fi
if [ "$REDUCE" = "yes" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -S"
fi
if [ "$DROPDUPLICATES" = "yes" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -D"
fi
if [ -n "$LOGLEVEL" ]; then
SYSLOG_ARGS="$SYSLOG_ARGS -l $LOGLEVEL"
fi
else
# default: log to 16K shm circular buffer
SYSLOG_ARGS="-C"
fi
waitpid ()
{
pid=$1
# Give pid a chance to exit before we restart with a 5s timeout in 1s intervals
if [ -z "$pid" ]; then
return
fi
timeout=5;
while [ $timeout -gt 0 ]
do
timeout=$(( $timeout-1 ))
kill -0 $pid 2> /dev/null || break
sleep 1
done
}
case "$1" in
start)
echo -n "Starting syslogd/klogd: "
start-stop-daemon -S -b -n syslogd -a /sbin/syslogd -- -n $SYSLOG_ARGS
start-stop-daemon -S -b -n klogd -a /sbin/klogd -- -n
echo "done"
;;
stop)
echo -n "Stopping syslogd/klogd: "
start-stop-daemon -K -n syslogd
start-stop-daemon -K -n klogd
echo "done"
;;
restart)
pid1=`pidof syslogd`
pid2=`pidof klogd`
$0 stop
waitpid $pid1
waitpid $pid2
$0 start
;;
*)
echo "Usage: syslog { start | stop | restart }" >&2
exit 1
;;
esac
exit 0
@@ -0,0 +1,13 @@
# This configuration file is used by the busybox syslog init script,
# /etc/init.d/syslog[.busybox] to set syslog configuration at start time.
DESTINATION=file # log destinations (buffer file remote)
LOGFILE=/var/log/messages # where to log (file)
REMOTE=loghost:514 # where to log (syslog remote)
REDUCE=no # reduce-size logging
DROPDUPLICATES=no # whether to drop duplicate log entries
#ROTATESIZE=0 # rotate log if grown beyond X [kByte]
#ROTATEGENS=3 # keep X generations of rotated logs
BUFFERSIZE=64 # size of circular buffer [kByte]
FOREGROUND=no # run in foreground (don't use!)
#LOGLEVEL=5 # local log level (between 1 and 8)
@@ -0,0 +1 @@
# /etc/syslog.conf Configuration file for busybox's syslogd utility