Skip to content

Commit 5dbaf53

Browse files
spl237XECDesign
authored andcommitted
Changes for new /boot directory structure
1 parent 4287c3c commit 5dbaf53

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

raspi-config

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
INTERACTIVE=True
77
ASK_TO_REBOOT=0
88
BLACKLIST=/etc/modprobe.d/raspi-blacklist.conf
9-
CONFIG=/boot/config.txt
9+
10+
if [ -e /boot/firmware/config.txt ] ; then
11+
FIRMWARE=/firmware
12+
else
13+
FIRMWARE=
14+
fi
15+
CONFIG=/boot${FIRMWARE}/config.txt
1016

1117
USER=${SUDO_USER:-$(who -m | awk '{ print $1 }')}
1218
INIT="$(ps --no-headers -o comm 1)"
@@ -24,7 +30,7 @@ if is_pi ; then
2430
if [ -e /proc/device-tree/chosen/os_prefix ]; then
2531
PREFIX="$(cat /proc/device-tree/chosen/os_prefix)"
2632
fi
27-
CMDLINE="/boot/${PREFIX}cmdline.txt"
33+
CMDLINE="/boot${FIRMWARE}/${PREFIX}cmdline.txt"
2834
else
2935
CMDLINE=/proc/cmdline
3036
fi
@@ -148,17 +154,17 @@ can_configure() {
148154
if ! is_pi; then
149155
return 0
150156
fi
151-
if [ ! -e /boot/start_x.elf ]; then
157+
if [ ! -e /boot${FIRMWARE}/start_x.elf ]; then
152158
return 1
153159
fi
154160
if [ -e $CONFIG ] && grep -q "^device_tree=$" $CONFIG; then
155161
return 1
156162
fi
157-
if ! mountpoint -q /boot; then
163+
if ! mountpoint -q /boot${FIRMWARE}; then
158164
return 1
159165
fi
160-
if [ ! -e /boot/config.txt ]; then
161-
touch /boot/config.txt
166+
if [ ! -e $CONFIG ]; then
167+
touch $CONFIG
162168
fi
163169
return 0
164170
}
@@ -821,7 +827,7 @@ No other symbols, punctuation characters, or blank spaces are permitted.\
821827
}
822828

823829
do_memory_split() { # Memory Split
824-
if [ -e /boot/start_cd.elf ]; then
830+
if [ -e /boot${FIRMWARE}/start_cd.elf ]; then
825831
# New-style memory split setting
826832
## get current memory split from /boot/config.txt
827833
arm=$(vcgencmd get_mem arm | cut -d '=' -f 2 | cut -d 'M' -f 1)
@@ -877,7 +883,7 @@ get_current_memory_split() {
877883
AVAILABLE_SPLITS="128 192 224 240"
878884
MEMSPLIT_DESCRIPTION=""
879885
for SPLIT in $AVAILABLE_SPLITS;do
880-
if [ -e /boot/arm${SPLIT}_start.elf ] && cmp /boot/arm${SPLIT}_start.elf /boot/start.elf >/dev/null 2>&1;then
886+
if [ -e /boot${FIRMWARE}/arm${SPLIT}_start.elf ] && cmp /boot${FIRMWARE}/arm${SPLIT}_start.elf /boot${FIRMWARE}/start.elf >/dev/null 2>&1;then
881887
CURRENT_MEMSPLIT=$SPLIT
882888
MEMSPLIT_DESCRIPTION="Current: ${CURRENT_MEMSPLIT}MiB for ARM, $((256 - CURRENT_MEMSPLIT))MiB for VideoCore"
883889
break
@@ -886,7 +892,7 @@ get_current_memory_split() {
886892
}
887893

888894
set_memory_split() {
889-
cp -a /boot/arm${1}_start.elf /boot/start.elf
895+
cp -a /boot${FIRMWARE}/arm${1}_start.elf /boot${FIRMWARE}/start.elf
890896
sync
891897
}
892898

@@ -1999,7 +2005,7 @@ get_camera() {
19992005
}
20002006

20012007
do_camera() {
2002-
if [ $(deb_ver) -le 10 ] && [ ! -e /boot/start_x.elf ]; then
2008+
if [ $(deb_ver) -le 10 ] && [ ! -e /boot${FIRMWARE}/start_x.elf ]; then
20032009
whiptail --msgbox "Your firmware appears to be out of date (no start_x.elf). Please update" 20 60 2
20042010
return 1
20052011
fi
@@ -2151,7 +2157,7 @@ do_legacy() {
21512157
}
21522158

21532159
do_gldriver() {
2154-
if [ ! -e /boot/overlays/vc4-kms-v3d.dtbo ]; then
2160+
if [ ! -e /boot${FIRMWARE}/overlays/vc4-kms-v3d.dtbo ]; then
21552161
whiptail --msgbox "Driver and kernel not present on your system. Please update" 20 60 2
21562162
return 1
21572163
fi
@@ -2888,12 +2894,12 @@ get_overlay_conf() {
28882894
}
28892895

28902896
get_bootro_now() {
2891-
findmnt /boot | grep -q " ro,"
2897+
findmnt /boot${FIRMWARE} | grep -q " ro,"
28922898
echo $?
28932899
}
28942900

28952901
get_bootro_conf() {
2896-
grep /boot /etc/fstab | grep -q "defaults.*,ro[ ,]"
2902+
grep /boot${FIRMWARE} /etc/fstab | grep -q "defaults.*,ro[ ,]"
28972903
echo $?
28982904
}
28992905

@@ -2907,7 +2913,7 @@ enable_overlayfs() {
29072913

29082914
# mount the boot partition as writable if it isn't already
29092915
if [ $(get_bootro_now) -eq 0 ] ; then
2910-
if ! mount -o remount,rw /boot 2>/dev/null ; then
2916+
if ! mount -o remount,rw /boot${FIRMWARE} 2>/dev/null ; then
29112917
echo "Unable to mount boot partition as writable - cannot enable"
29122918
return 1
29132919
fi
@@ -2985,16 +2991,16 @@ EOF
29852991
# there is now a modified initramfs ready for use...
29862992

29872993
# modify config.txt
2988-
sed -i /boot/config.txt -e "/initramfs.*/d"
2989-
echo initramfs "$INITRD" >> /boot/config.txt
2994+
sed -i $CONFIG -e "/initramfs.*/d"
2995+
echo initramfs "$INITRD" >> $CONFIG
29902996

29912997
# modify command line
29922998
if ! grep -q "boot=overlay" $CMDLINE ; then
29932999
sed -i $CMDLINE -e "s/^/boot=overlay /"
29943000
fi
29953001

29963002
if [ "$BOOTRO" = "yes" ] ; then
2997-
if ! mount -o remount,ro /boot 2>/dev/null ; then
3003+
if ! mount -o remount,ro /boot${FIRMWARE} 2>/dev/null ; then
29983004
echo "Unable to remount boot partition as read-only"
29993005
fi
30003006
fi
@@ -3004,7 +3010,7 @@ disable_overlayfs() {
30043010
KERN=$(uname -r)
30053011
# mount the boot partition as writable if it isn't already
30063012
if [ $(get_bootro_now) -eq 0 ] ; then
3007-
if ! mount -o remount,rw /boot 2>/dev/null ; then
3013+
if ! mount -o remount,rw /boot${FIRMWARE} 2>/dev/null ; then
30083014
echo "Unable to mount boot partition as writable - cannot disable"
30093015
return 1
30103016
fi
@@ -3014,14 +3020,14 @@ disable_overlayfs() {
30143020
fi
30153021

30163022
# modify config.txt
3017-
sed -i /boot/config.txt -e "/initramfs.*/d"
3023+
sed -i $CONFIG -e "/initramfs.*/d"
30183024
update-initramfs -d -k "${KERN}-overlay"
30193025

30203026
# modify command line
30213027
sed -i $CMDLINE -e "s/\(.*\)boot=overlay \(.*\)/\1\2/"
30223028

30233029
if [ "$BOOTRO" = "yes" ] ; then
3024-
if ! mount -o remount,ro /boot 2>/dev/null ; then
3030+
if ! mount -o remount,ro /boot${FIRMWARE} 2>/dev/null ; then
30253031
echo "Unable to remount boot partition as read-only"
30263032
fi
30273033
fi
@@ -3032,15 +3038,15 @@ enable_bootro() {
30323038
echo "Overlay in use; cannot update fstab"
30333039
return 1
30343040
fi
3035-
sed -i /etc/fstab -e "s/\(.*\/boot.*\)defaults\(.*\)/\1defaults,ro\2/"
3041+
sed -i /etc/fstab -e "s#\(.*/boot$FIRMWARE.*\)defaults\(.*\)#\1defaults,ro\2#"
30363042
}
30373043

30383044
disable_bootro() {
30393045
if [ $(get_overlay_now) -eq 0 ] ; then
30403046
echo "Overlay in use; cannot update fstab"
30413047
return 1
30423048
fi
3043-
sed -i /etc/fstab -e "s/\(.*\/boot.*\)defaults,ro\(.*\)/\1defaults\2/"
3049+
sed -i /etc/fstab -e "s#\(.*/boot$FIRMWARE.*\)defaults,ro\(.*\)#\1defaults\2#"
30443050
}
30453051

30463052
do_overlayfs() {
@@ -3312,7 +3318,6 @@ do_display_menu() {
33123318
if is_pi ; then
33133319
if is_wayfire; then
33143320
FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Display Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \
3315-
"D2 Underscan" "Remove black border around screen" \
33163321
"D4 Screen Blanking" "Enable/disable screen blanking" \
33173322
"D5 VNC Resolution" "Set resolution for headless use" \
33183323
"D6 Composite" "Set options for composite output" \

0 commit comments

Comments
 (0)