add logging and other things

This commit is contained in:
Hedy88 2026-08-28 23:24:19 +01:00
commit 067cadbe0f
No known key found for this signature in database
10 changed files with 870 additions and 98 deletions

View file

@ -4,6 +4,7 @@
# service NAME /path/to/exe [args...]
# user = ... | group = ... | class = ... | respawn = ... | crash-threshold = ...
# crash-window = ... | setenv = ... | cwd = ... | seclabel = ...
# logfile = ... | depends = ...
# oneshot | disabled | console (flag options, no value)
#
# on TRIGGER
@ -16,10 +17,12 @@
# write PATH CONTENT
# symlink TARGET LINK
# mount SOURCE TARGET FSTYPE
# setprop KEY VALUE | getprop KEY
# log message...
#
# standard trigger sequence run at boot: early-init, init, boot.
# future: property:<key>=<value>, service-started:<name>.
# property:<key>=<value> actions fire when `setprop KEY VALUE` runs;
# service-started:<name> is on the roadmap.
on early-init
mount proc /proc proc
@ -33,8 +36,12 @@ on early-init
on init
exec /sbin/modprobe virtio_rng
write /proc/sys/kernel/hostname bajia
setprop config.ready 1
log **** bajia init on-line ****
on property:config.ready=1
log configuration is ready
on boot
start console
start watchdog
@ -46,9 +53,11 @@ service console /sbin/getty -L ttyS0 115200 vt100
user = root
# a long-lived example daemon. respawning is the default (always).
# logfile captures its stdout+stderr (parent dir /run exists via early-init).
service watchdog /usr/sbin/watchdog
class = core
respawn = always
logfile = /run/watchdog.log
# a one-shot job: runs once, exits, never respawns.
service boot-logo /usr/bin/show-boot-logo

19
etc/initramfs.rc Normal file
View file

@ -0,0 +1,19 @@
# bajia initramfs.rc - first-stage init config for a classic two-stage boot.
#
# adjust the root device path below to match your hardware/rootfs setup.
on early-init
mount proc /proc proc
mount sysfs /sys sysfs
mount devtmpfs /dev devtmpfs
on init
# mount the real root filesystem (reuse `mount SOURCE TARGET FSTYPE`).
# typical alternatives: `mount /dev/mmcblk0p2 /mnt/root ext4`,
# an NFS root, or cryptsetup/LVM set up by earlier `exec` commands.
mkdir /mnt/root 0755
mount /dev/sda1 /mnt/root ext4
# the last trigger: pivot onto the real root and exec the real init.
on boot
switch_root /mnt/root /sbin/init /etc/bajia/init.rc