Browse Source

bangBMC/init only mount the jffs2 rwfs is explicitly asked to do so on the cli.

Auto mounting runs a very realy danger of damaging an fs that isn't layed out the way we expect (aka openbmc)
tags/alpha-Talos-II
Jonathan Currier 1 year ago
parent
commit
d5dbb42f4d
1 changed files with 24 additions and 9 deletions
  1. +24
    -9
      board/bangBMC/overlay/init

+ 24
- 9
board/bangBMC/overlay/init View File

@@ -1,5 +1,5 @@
#!/bin/sh
echo "Initrd"
echo "init: prepping filesystem for busybox init"
# This will hide the overlay internals once
# the rootfs has been switched
mount -t tmpfs scratch /mnt
@@ -10,25 +10,40 @@ mkdir -p \
/mnt/dev-data \
/mnt/rwfs

mount --bind / /mnt/root

lowerdirs="/mnt/root"

mount --bind / /mnt/root
mount -t devtmpfs dev /dev
mount -t proc proc /proc

[ -n "$(cat /proc/cmdline | grep "bangBMC\.skip-rwfs")" ] && skip_rwfs=true
for entry in $(cat /proc/cmdline) ; do
# we only care about bangBMC arguments
# cut needs us to ensure there is delimiter otherwise it will throw
# an error.
[ "$(echo ${entry}. | cut -f 1 -d '.')" = "bangBMC" ] || continue
cmd="$(echo ${entry}= | cut -f 1 -d '=' |cut -f 2 -d '.')"
arg="$(echo ${entry}= | sed -e 's/^[^=]\+=//' )"
case $cmd in
#skip-rwfs is a legacy option, it will be removed soon.
skip-rwfs)
skip_rwfs=true
;;
do-jffs-mount)
do_jffs_mount=true
;;
*)
continue
;;
esac
done

if mount -t squashfs /dev/mtdblock1 /mnt/dev-data ; then
have_dev_data=true
have_layers=true

lowerdirs="/mnt/dev-data:${lowerdirs}"
fi

# if the cmdline asked us to skip the peristen storage, then don't mount it
if [ -z "${skip_rwfs}" ] && mount -t jffs2 /dev/mtdblock5 /mnt/rwfs ; then
have_rwfs=true
# if the cmdline asked us to skip the persistent storage, then don't mount it
if [ -z "${skip_rwfs}" ] && [ -n "${do_jffs_mount}" ] && mount -t jffs2 /dev/mtdblock5 /mnt/rwfs ; then
have_layers=true
mkdir -p /mnt/rwfs/root /mnt/rwfs/work
upperdir_cmd=',upperdir=/mnt/rwfs/root,workdir=/mnt/rwfs/work'


Loading…
Cancel
Save