#!/bin/sh
# Copyright (C) 2011 O.S. Systems Software LTDA.
# Licensed on MIT
rootfs_enabled() {
return 0
}
e2fsck_check() {
if [ -n "`which e2fsck`" ]; then
fsckout=`e2fsck -p -v ${1}`
fsckret=$?
# Avoid empty newline after summary
echo "e2fsck: ${fsckout}" >/dev/kmsg
# Return code >= 4 means uncorrected / operational error
## TODO: force boot into a recovery mode or similar, as there is really not
## much we can do in case the fs is corrupted in a bad way
if [ "${fsckret}" -ge "4" ]; then
echo "e2fsck: WARNING: file system errors left uncorrected: ret ${fsckret}" >/dev/kmsg
fi
fi
}
rootfs_run() {
if [ -z "$ROOTFS_DIR" ]; then
return
fi
C=0
delay=${bootparam_rootdelay:-1}
timeout=${bootparam_roottimeout:-5}
while ! mountpoint -q $ROOTFS_DIR; do
if [ $(( $C * $delay )) -gt $timeout ]; then
fatal "root '$bootparam_root' doesn't exist or does not contain a /dev."
fi
if [ -n "$bootparam_root" ]; then
debug "No e2fs compatible filesystem has been mounted, mounting $bootparam_root..."
# Explicitly set the correct PARTUUID here
if [ "$bootparam_root" = "PARTUUID=765186fb-02" ]; then
bootparam_root="/dev/disk/by-partuuid/765186fb-02"
fi
if [ -e "$bootparam_root" ]; then
e2fsck_check ${bootparam_root}
flags=""
if [ -n "$bootparam_ro" ] && ! echo "$bootparam_rootflags" | grep -w -q "ro"; then
if [ -n "$bootparam_rootflags" ]; then
bootparam_rootflags="$bootparam_rootflags,"
fi
bootparam_rootflags="${bootparam_rootflags}ro"
fi
if [ -n "$bootparam_rootflags" ]; then
flags="$flags -o$bootparam_rootflags"
fi
if [ -n "$bootparam_rootfstype" ]; then
flags="$flags -t$bootparam_rootfstype"
fi
mount $flags $bootparam_root $ROOTFS_DIR
if mountpoint -q $ROOTFS_DIR; then
debug "Root filesystem successfully mounted."
break
else
# It is unlikely to change, but keep trying anyway.
# Perhaps we pick a different device next time.
debug "Failed to mount $bootparam_root. Retrying..."
umount $ROOTFS_DIR
fi
fi
fi
debug "Sleeping for $delay second(s) to wait root to settle..."
sleep $delay
C=$(( $C + 1 ))
done
}
this is the rootfs script that i am using when i boot the board this error keeps showing
/init: [ 4.686699] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000200
/init.d/90-rootfs: line 68: syntax error: unexpected "done" (expe[ 4.694894] CPU: 2 PID: 1 Comm: init Not tainted 5.15.148-6.7.0-devel+git.bfdbfb2c85fb #1
cting "fi")
i tried over an over to find the missing "fi " but i couldn’t
in case this is the rest of the boot logs:
/init: [ 4.686699] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000200
/init.d/90-rootfs: line 68: syntax error: unexpected "done" (expe[ 4.694894] CPU: 2 PID: 1 Comm: init Not tainted 5.15.148-6.7.0-devel+git.bfdbfb2c85fb #1
cting "fi")
[ 4.708700] Hardware name: Toradex Apalis iMX8QM V1.1 on Apalis Evaluation Board (DT)
[ 4.717657] Call trace:
[ 4.720098] dump_backtrace+0x0/0x1f0
[ 4.723784] show_stack+0x18/0x40
[ 4.727102] dump_stack_lvl+0x68/0x84
[ 4.730777] dump_stack+0x18/0x34
[ 4.734095] panic+0x18c/0x34c
[ 4.737152] do_exit+0x964/0x9b0
[ 4.740384] do_group_exit+0x38/0xa0
[ 4.743964] __arm64_sys_exit_group+0x18/0x20
[ 4.748334] invoke_syscall+0x48/0x114
[ 4.752095] el0_svc_common.constprop.0+0x44/0xfc
[ 4.756816] do_el0_svc+0x28/0xa0
[ 4.760140] el0_svc+0x28/0x80
[ 4.763198] el0t_64_sync_handler+0xa4/0x130
[ 4.767473] el0t_64_sync+0x1a0/0x1a4
[ 4.771152] SMP: stopping secondary CPUs
[ 4.775085] Kernel Offset: disabled
[ 4.778577] CPU features: 0x4,000820b1,20000846
[ 4.783110] Memory Limit: none
[ 4.786178] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000200 ]---