From 3abf20cd709b0ec18280f836dabb5d7e48589211 Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 16 Oct 2019 15:33:33 -0500 Subject: Add initramfs and init recipes --- .../files/init-readonly-rootfs-overlay-boot.sh | 326 +++++++++++++++++++++ 1 file changed, 326 insertions(+) create mode 100755 recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh (limited to 'recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh') diff --git a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh new file mode 100755 index 0000000..6ec69ab --- /dev/null +++ b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh @@ -0,0 +1,326 @@ +#!/bin/bash +# fsck output of the upper file system (rw) is +# written to /dev/kmsg + +# Kernel arguments for this script: +# This script allows one to specify the root read-only device with +# kernel argument: +# root= +# What follows can be a PARTUUID, PARTLABEL, or some other mechanism +# understood by findfs, including the plain device name. +# +# The rw file system overlayed on top of root defaults to: +# rootrw='PARTLABEL=user_data' +# This is the first GPT partition found with the name user_data. +# +# Another file system can be specified by PARTUUID, or the +# plain device name, or anything understood by findfs. +# For instance: +# rootrw=/dev/mmcblk0p10 +# to use the SD card. +# +# fsck is not done to the root file system. It is assumed it cannot be +# corrupted. +# By default, fsck -p [rootrw device] is done. +# +# There are two kernel options governing fsck: +# +# fsck.repair=true|false|force +# false skips fsck, force adds the -f option. +# true is the default (fsck with no -f option) +# fsck.mode=preen|yes|no +# These represent -p, -y, and -n options. +# Preen (-p) is the default +# +# Additional options exist to specify the init program +# mount options, file system type. root_rwreset="yes" +# will cause the read/write file system to be erased. +# + + +# Enable strict shell mode +set -euo pipefail + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +MOUNT="/bin/mount" +UMOUNT="/bin/umount" + +INIT="/sbin/init" +ROOT_ROINIT="/sbin/init" + +ROOT_MOUNT="/mnt" +ROOT_RODEVICE="" +ROOT_RWDEVICE="" +ROOT_ROMOUNT="/run/media/rfs/ro" +ROOT_RWMOUNT="/run/media/rfs/rw" +ROOT_RWRESET="no" + +ROOT_ROFSTYPE="" +ROOT_ROMOUNTOPTIONS="bind" +ROOT_ROMOUNTOPTIONS_DEVICE="noatime,nodiratime,ro" + +ROOT_RWFSTYPE="" +ROOT_RWMOUNTOPTIONS="rw,noatime,mode=755 tmpfs" +ROOT_RWMOUNTOPTIONS_DEVICE="rw,noatime" + +# Arithmetic assignments of 0 are false, and then +# script uses set -e, so use let instead. +DO_FSCK=1 +DO_STOP=0 +FSCKOPT="-p" + + +finddevice() { + DEVICE="$1" + if dev=$(findfs "${DEVICE}") && ((${#dev})) ; then + # Replace the rootfs string with the findfs device result + log "Searched for ${DEVICE} and found $dev" + echo "$dev" + return 0 + fi + log "Could not find $DEVICE" + return 1 +} + +early_setup() { + mkdir -p /proc + mkdir -p /sys + $MOUNT -t proc proc /proc + $MOUNT -t sysfs sysfs /sys + grep -w "/dev" /proc/mounts >/dev/null || $MOUNT -t devtmpfs none /dev +} + +read_args() { + # Default is to do fsck with -p option on user_data partition. + [ -z "${CMDLINE+x}" ] && CMDLINE=`cat /proc/cmdline` + for arg in $CMDLINE; do + # Set optarg to option parameter, and '' if no parameter was + # given + optarg=`expr "x$arg" : 'x[^=]*=\(.*\)' || echo ''` + case $arg in + shinitramfs) + ((DO_STOP=1)) ;; + root=*) + ROOT_RODEVICE=$optarg + if rootdev=$(finddevice "${ROOT_RODEVICE}") ; then + # Replace the rootfs string with the findfs device result + ROOT_RODEVICE="${rootdev}" + fi + ;; + rootfstype=*) + ROOT_ROFSTYPE="$optarg" ;; + rootinit=*) + ROOT_ROINIT=$optarg ;; + rootoptions=*) + ROOT_ROMOUNTOPTIONS_DEVICE="$optarg" ;; + rootrw=*) + ROOT_RWDEVICE=$optarg + if rootrwdev="$(finddevice ${ROOT_RWDEVICE})" ; then + # Replace the rootfs string with the findfs device result + ROOT_RODEVICE="${rootrwdev}" + fi + ;; + rootrwfstype=*) + ROOT_RWFSTYPE="$optarg" ;; + rootrwreset=*) + ROOT_RWRESET=$optarg ;; + rootrwoptions=*) + ROOT_RWMOUNTOPTIONS_DEVICE="$optarg" ;; + init=*) + INIT=$optarg ;; + fsck.mode=*) + fsck_mode=$optarg + case $fsck_mode in + preen) + FSCKOPT="-p" ;; + yes) + FSCKOPT="-y" ;; + no) + FSCKOPT="-n" ;; + esac + ;; + fsck.repair=*) + fsck_repair=$optarg + case $fsck_repair in + force) + if ((${#FSCKOPT)) ; then + FSCKOPT+="f" + else + FSCKOPT="-f" + fi + DO_FSCK=1 + ;; + yes) + DO_FSCK=1 + ;; + no) + DO_FSCK=0 + ;; + esac + + ;; + esac + done +} + +fatal() { + echo "rorootfs-overlay: $1" >$CONSOLE + echo >$CONSOLE + exec bash +} + +log() { + echo "rorootfs-overlay: $1" >$CONSOLE +} + +early_setup + +[ -z "${CONSOLE+x}" ] && CONSOLE="/dev/console" + +read_args + +mount_and_boot() { + mkdir -p $ROOT_MOUNT $ROOT_ROMOUNT $ROOT_RWMOUNT + + # Build mount options for read only root file system. + # If no read-only device was specified via kernel command line, use + # current root file system via bind mount. + ROOT_ROMOUNTPARAMS_BIND="-o ${ROOT_ROMOUNTOPTIONS} /" + if [ -n "${ROOT_RODEVICE}" ]; then + ROOT_ROMOUNTPARAMS="-o ${ROOT_ROMOUNTOPTIONS_DEVICE} $ROOT_RODEVICE" + if [ -n "${ROOT_ROFSTYPE}" ]; then + ROOT_ROMOUNTPARAMS="-t $ROOT_ROFSTYPE $ROOT_ROMOUNTPARAMS" + fi + else + ROOT_ROMOUNTPARAMS="$ROOT_ROMOUNTPARAMS_BIND" + fi + + mountlog=$($MOUNT $ROOT_ROMOUNTPARAMS "$ROOT_ROMOUNT" 2>&1) + mountresult=$? + if ((mountresult != 0)) ; then + log "Failed root mount (result $mountresult): $mountlog" + log "mounts: $(cat /proc/mounts)" + else + log "Mounted ro root: $(grep "$ROOT_ROMOUNT" /proc/mounts)" + fi + + log "Mounted root: $(grep root /proc/mounts)" + + # If future init is the same as current file, use $ROOT_ROINIT + # Tries to avoid loop to infinity if init is set to current file via + # kernel command line + if cmp -s "$0" "$INIT"; then + INIT="$ROOT_ROINIT" + fi + + # find user_data + if [[ -z ${ROOT_RWDEVICE} ]] ; then + userdata=$(findfs PARTLABEL=user_data) + blkid_out=$(blkid $userdata) + if [[ -n $userdata ]] ; then + if [[ $blkid_out =~ TYPE=\"([^\"]+)\" ]]; then + log "Detected user_data partition with ${BASH_REMATCH[1]} file system" + else + log "Create new user_data partition ext4 file system" + mkfs.ext4 -O 64bit $userdata + fi + ROOT_RWDEVICE="$userdata" + fi # Found user_data GPT partition + fi # Empty ROOT_RWDEVICE + # Build mount options for read write root file system. + # If a read-write device was specified via kernel command line + # or partition table, use it, otherwise default to tmpfs. + if [ -n "${ROOT_RWDEVICE}" ]; then + ROOT_RWMOUNTPARAMS="-o $ROOT_RWMOUNTOPTIONS_DEVICE $ROOT_RWDEVICE" + if [ -n "${ROOT_RWFSTYPE}" ]; then + ROOT_RWMOUNTPARAMS="-t $ROOT_RWFSTYPE $ROOT_RWMOUNTPARAMS" + fi + else + ROOT_RWMOUNTPARAMS="-t tmpfs -o $ROOT_RWMOUNTOPTIONS" + fi + + if ((DO_FSCK == 1)) ; then + if log_result=$(fsck $FSCKOPT $ROOT_RWDEVICE 2>&1) ; then + log "OK fsck user_data: fsck $FSCKOPT $ROOT_RWDEVICE: $(fsck $FSCKOPT $ROOT_RWDEVICE 2>&1)" + echo "fsck user_data: $log_result" >/dev/kmsg + else + log "ERR fsck user_data: fsck $FSCKOPT $ROOT_RWDEVICE: $(fsck $FSCKOPT $ROOT_RWDEVICE 2>&1)" + log "$log_result" + # Write fsck to kernel log + echo "ERR fsck user_data: fsck $FSCKOPT $ROOT_RWDEVICE: $(fsck $FSCKOPT $ROOT_RWDEVICE 2>&1)" >/dev/kmsg + echo "$log_result" >/dev/kmsg + fi + fi + + # Mount read-write file system into initram root file system + if ! $MOUNT $ROOT_RWMOUNTPARAMS $ROOT_RWMOUNT ; then + fatal "Could not mount read-write rootfs" + fi + + # Reset read-write file system if specified + if [ "yes" == "$ROOT_RWRESET" -a -n "${ROOT_RWMOUNT}" ]; then + rm -rf $ROOT_RWMOUNT/* + fi + + # Determine which unification file system to use + union_fs_type="" + if grep -w "overlay" /proc/filesystems >/dev/null; then + union_fs_type="overlay" + elif grep -w "aufs" /proc/filesystems >/dev/null; then + union_fs_type="aufs" + else + union_fs_type="" + fi + + # Create/Mount overlay root file system + case $union_fs_type in + "overlay") + log "$(cat /proc/mounts)" + mkdir -p $ROOT_RWMOUNT/upperdir $ROOT_RWMOUNT/work + if ! $MOUNT -t overlay overlay \ + -o "$(printf "%s%s%s" \ + "lowerdir=$ROOT_ROMOUNT," \ + "upperdir=$ROOT_RWMOUNT/upperdir," \ + "workdir=$ROOT_RWMOUNT/work")" \ + $ROOT_MOUNT ; then + log "$MOUNT -t overlay overlay \ + -o \"$(printf \"%s%s%s\" \ + \"lowerdir=$ROOT_ROMOUNT,\" \ + \"upperdir=$ROOT_RWMOUNT/upperdir,\" \ + \"workdir=$ROOT_RWMOUNT/work\")\" \ + $ROOT_MOUNT" + fatal "Cound not mount overlay" + fi + ;; + "aufs") + $MOUNT -t aufs i\ + -o "dirs=$ROOT_RWMOUNT=rw:$ROOT_ROMOUNT=ro" \ + aufs $ROOT_MOUNT + ;; + "") + fatal "No overlay filesystem type available" + ;; + esac + + # Move read-only and read-write root file system into the overlay + # file system + mkdir -p $ROOT_MOUNT/$ROOT_ROMOUNT $ROOT_MOUNT/$ROOT_RWMOUNT + $MOUNT -n --move $ROOT_ROMOUNT ${ROOT_MOUNT}/$ROOT_ROMOUNT + $MOUNT -n --move $ROOT_RWMOUNT ${ROOT_MOUNT}/$ROOT_RWMOUNT + + $MOUNT -n --move /proc ${ROOT_MOUNT}/proc + $MOUNT -n --move /sys ${ROOT_MOUNT}/sys + $MOUNT -n --move /dev ${ROOT_MOUNT}/dev + log "overlay: $(grep 'overlay' ${ROOT_MOUNT}/proc/mounts)" + cd $ROOT_MOUNT + if ((DO_STOP)) ; then + fatal "Initramfs Shell mode selected -- bash shell" + fi + + # switch to actual init in the overlay root file system + exec switch_root $ROOT_MOUNT $INIT || + fatal "Couldn't chroot, dropping to shell" +} + +mount_and_boot -- cgit v1.2.3 From 12ee8f8d7c73aee8193ab2d1663aaf56a9beb8d5 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 28 Oct 2019 11:39:46 -0500 Subject: Fix up logging (/var/log/dmesg) and kernel parameters for initramfs --- .../files/init-readonly-rootfs-overlay-boot.sh | 63 +++++++++++++++------- 1 file changed, 43 insertions(+), 20 deletions(-) (limited to 'recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh') diff --git a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh index 6ec69ab..545da5c 100755 --- a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh +++ b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh @@ -33,9 +33,23 @@ # Preen (-p) is the default # # Additional options exist to specify the init program -# mount options, file system type. root_rwreset="yes" +# mount options, file system type. rootrwreset="yes" # will cause the read/write file system to be erased. # +# shintramfs starts a shell. To continue boot from +# shell: +# +# bash-4.4# export ROOT_MOUNT=/mnt +# bash-4.4# export INIT=/sbin/init +# bash-4.4# exec switch_root $ROOT_MOUNT $INIT +# +# +# U-Boot environment example to add an init overlay parameter: +# +# => printenv args_mmc +# args_mmc=run finduuid;setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype} +# +# => setenv args_mmc 'run finduuid;setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype} rootrwreset=yes' # Enable strict shell mode @@ -106,6 +120,7 @@ read_args() { if rootdev=$(finddevice "${ROOT_RODEVICE}") ; then # Replace the rootfs string with the findfs device result ROOT_RODEVICE="${rootdev}" + log "Actual root device to be used: $ROOT_RODEVICE" fi ;; rootfstype=*) @@ -144,7 +159,7 @@ read_args() { fsck_repair=$optarg case $fsck_repair in force) - if ((${#FSCKOPT)) ; then + if ((${#FSCKOPT})) ; then FSCKOPT+="f" else FSCKOPT="-f" @@ -171,15 +186,18 @@ fatal() { } log() { - echo "rorootfs-overlay: $1" >$CONSOLE + echo "rorootfs-overlay: ${BASH_LINENO[*]}: ${*-""}" >$CONSOLE } early_setup -[ -z "${CONSOLE+x}" ] && CONSOLE="/dev/console" +[ -z "${CONSOLE+x}" ] && CONSOLE="/dev/kmsg" +log "Kernel args are:" +log "$(cat /proc/cmdline)" read_args + mount_and_boot() { mkdir -p $ROOT_MOUNT $ROOT_ROMOUNT $ROOT_RWMOUNT @@ -193,6 +211,7 @@ mount_and_boot() { ROOT_ROMOUNTPARAMS="-t $ROOT_ROFSTYPE $ROOT_ROMOUNTPARAMS" fi else + log "ROOT_RODEVICE: empty: ${ROOT_RODEVICE}" ROOT_ROMOUNTPARAMS="$ROOT_ROMOUNTPARAMS_BIND" fi @@ -200,13 +219,11 @@ mount_and_boot() { mountresult=$? if ((mountresult != 0)) ; then log "Failed root mount (result $mountresult): $mountlog" - log "mounts: $(cat /proc/mounts)" else + log "Mounted root: $MOUNT $ROOT_ROMOUNTPARAMS "$ROOT_ROMOUNT": $mountlog" log "Mounted ro root: $(grep "$ROOT_ROMOUNT" /proc/mounts)" fi - log "Mounted root: $(grep root /proc/mounts)" - # If future init is the same as current file, use $ROOT_ROINIT # Tries to avoid loop to infinity if init is set to current file via # kernel command line @@ -214,7 +231,7 @@ mount_and_boot() { INIT="$ROOT_ROINIT" fi - # find user_data + # find user_data if [[ -z ${ROOT_RWDEVICE} ]] ; then userdata=$(findfs PARTLABEL=user_data) blkid_out=$(blkid $userdata) @@ -228,6 +245,7 @@ mount_and_boot() { ROOT_RWDEVICE="$userdata" fi # Found user_data GPT partition fi # Empty ROOT_RWDEVICE + # Build mount options for read write root file system. # If a read-write device was specified via kernel command line # or partition table, use it, otherwise default to tmpfs. @@ -242,25 +260,26 @@ mount_and_boot() { if ((DO_FSCK == 1)) ; then if log_result=$(fsck $FSCKOPT $ROOT_RWDEVICE 2>&1) ; then - log "OK fsck user_data: fsck $FSCKOPT $ROOT_RWDEVICE: $(fsck $FSCKOPT $ROOT_RWDEVICE 2>&1)" - echo "fsck user_data: $log_result" >/dev/kmsg + log "OK fsck user_data: fsck $FSCKOPT $ROOT_RWDEVICE:" + log "fsck user_data: $log_result" else - log "ERR fsck user_data: fsck $FSCKOPT $ROOT_RWDEVICE: $(fsck $FSCKOPT $ROOT_RWDEVICE 2>&1)" + log "ERR fsck user_data: fsck $FSCKOPT $ROOT_RWDEVICE:" log "$log_result" - # Write fsck to kernel log - echo "ERR fsck user_data: fsck $FSCKOPT $ROOT_RWDEVICE: $(fsck $FSCKOPT $ROOT_RWDEVICE 2>&1)" >/dev/kmsg - echo "$log_result" >/dev/kmsg fi fi + log "user_data: $MOUNT $ROOT_RWMOUNTPARAMS $ROOT_RWMOUNT" # Mount read-write file system into initram root file system if ! $MOUNT $ROOT_RWMOUNTPARAMS $ROOT_RWMOUNT ; then fatal "Could not mount read-write rootfs" fi # Reset read-write file system if specified - if [ "yes" == "$ROOT_RWRESET" -a -n "${ROOT_RWMOUNT}" ]; then + log "ROOT_RWRESET=$ROOT_RWRESET ROOT_RWMOUNT=$ROOT_RWMOUNT" + if [ "yes" == "$ROOT_RWRESET" -a -n "${ROOT_RWMOUNT}" ]; then # JAK + log "Removing user_data files" rm -rf $ROOT_RWMOUNT/* + log "Completed removal of user_data files" fi # Determine which unification file system to use @@ -276,7 +295,6 @@ mount_and_boot() { # Create/Mount overlay root file system case $union_fs_type in "overlay") - log "$(cat /proc/mounts)" mkdir -p $ROOT_RWMOUNT/upperdir $ROOT_RWMOUNT/work if ! $MOUNT -t overlay overlay \ -o "$(printf "%s%s%s" \ @@ -306,17 +324,22 @@ mount_and_boot() { # Move read-only and read-write root file system into the overlay # file system mkdir -p $ROOT_MOUNT/$ROOT_ROMOUNT $ROOT_MOUNT/$ROOT_RWMOUNT + $MOUNT -n --move $ROOT_ROMOUNT ${ROOT_MOUNT}/$ROOT_ROMOUNT $MOUNT -n --move $ROOT_RWMOUNT ${ROOT_MOUNT}/$ROOT_RWMOUNT + if ((DO_STOP)) ; then + fatal "Initramfs Shell mode selected -- bash shell" + fi + $MOUNT -n --move /proc ${ROOT_MOUNT}/proc $MOUNT -n --move /sys ${ROOT_MOUNT}/sys $MOUNT -n --move /dev ${ROOT_MOUNT}/dev - log "overlay: $(grep 'overlay' ${ROOT_MOUNT}/proc/mounts)" + + CONSOLE="${ROOT_MOUNT}/dev/kmsg" + log "Mounted filesystems:" + log "$(cat ${ROOT_MOUNT}/proc/mounts)" cd $ROOT_MOUNT - if ((DO_STOP)) ; then - fatal "Initramfs Shell mode selected -- bash shell" - fi # switch to actual init in the overlay root file system exec switch_root $ROOT_MOUNT $INIT || -- cgit v1.2.3 From bbdf318b3fe7a16eec94aa527531f1f93e4dee86 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 2 Dec 2019 09:59:17 -0600 Subject: Fix ROOT_RWDEVICE when rootrw is specified as a kernel parameter --- recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh') diff --git a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh index 545da5c..fccb40f 100755 --- a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh +++ b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh @@ -133,7 +133,7 @@ read_args() { ROOT_RWDEVICE=$optarg if rootrwdev="$(finddevice ${ROOT_RWDEVICE})" ; then # Replace the rootfs string with the findfs device result - ROOT_RODEVICE="${rootrwdev}" + ROOT_RWDEVICE="${rootrwdev}" fi ;; rootrwfstype=*) -- cgit v1.2.3 From 5beaf22becf61256e257c0f252692d36ec3b9df2 Mon Sep 17 00:00:00 2001 From: Mykyta Dorokhin Date: Tue, 3 Dec 2019 14:43:56 +0000 Subject: create additional .persistent directory on user_data partition and bind-mount it as /var/persistent. --- .../initrdscripts/files/init-readonly-rootfs-overlay-boot.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh') diff --git a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh index fccb40f..7cc23bf 100755 --- a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh +++ b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh @@ -328,6 +328,13 @@ mount_and_boot() { $MOUNT -n --move $ROOT_ROMOUNT ${ROOT_MOUNT}/$ROOT_ROMOUNT $MOUNT -n --move $ROOT_RWMOUNT ${ROOT_MOUNT}/$ROOT_RWMOUNT + + # Create persistent storage directory and bind-mount it as /var/persistent. + # The directory name starts with "." so "rm -rf" will skip it on read-write file system reset. + mkdir -p ${ROOT_MOUNT}/$ROOT_RWMOUNT/.persistent + mkdir -p ${ROOT_MOUNT}/var/persistent + $MOUNT -n --bind ${ROOT_MOUNT}/$ROOT_RWMOUNT/.persistent ${ROOT_MOUNT}/var/persistent + if ((DO_STOP)) ; then fatal "Initramfs Shell mode selected -- bash shell" fi -- cgit v1.2.3 From 64a0f98292a50db63febbc459b242a1fbbfb1708 Mon Sep 17 00:00:00 2001 From: Mike Nicholson Date: Fri, 27 Mar 2020 14:09:48 -0500 Subject: Add discard, nodiratime to maximize longevity --- recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh') diff --git a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh index 7cc23bf..199fc17 100755 --- a/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh +++ b/recipes-core/initrdscripts/files/init-readonly-rootfs-overlay-boot.sh @@ -72,11 +72,11 @@ ROOT_RWRESET="no" ROOT_ROFSTYPE="" ROOT_ROMOUNTOPTIONS="bind" -ROOT_ROMOUNTOPTIONS_DEVICE="noatime,nodiratime,ro" +ROOT_ROMOUNTOPTIONS_DEVICE="noatime,nodiratime,discard,ro" ROOT_RWFSTYPE="" ROOT_RWMOUNTOPTIONS="rw,noatime,mode=755 tmpfs" -ROOT_RWMOUNTOPTIONS_DEVICE="rw,noatime" +ROOT_RWMOUNTOPTIONS_DEVICE="rw,noatime,nodiratime,discard" # Arithmetic assignments of 0 are false, and then # script uses set -e, so use let instead. -- cgit v1.2.3