shithub: riscv

Download patch

ref: be1789d78bcf1be0cc48cd036942969824dacfa5
parent: 28709be9a68beaff12f7227f49fae1fc49be0660
author: Jacob Moody <moody@posixcafe.org>
date: Tue Jun 14 04:16:57 EDT 2022

kernel: bootrc: add bootloop=

--- a/sys/man/8/plan9.ini
+++ b/sys/man/8/plan9.ini
@@ -712,6 +712,12 @@
 prompt and use
 .I value
 as the answer instead.
+.SS \fLbootloop=\fIvalue\fP
+Always use
+.I value
+as the answer to the
+.L bootargs
+prompt, retrying if unsuccessful.
 .SS \fLrootdir=\fB/root/\fIdir\fP
 .SS \fLrootspec=\fIspec\fP
 Changes the mount arguments for the root file server
--- a/sys/src/9/boot/bootrc
+++ b/sys/src/9/boot/bootrc
@@ -68,6 +68,11 @@
 fn main{
 	mp=()
 	while(~ $#mp 0){
+		if(! ~ $#bootloop 0){
+			nobootprompt=$bootloop
+			# 'flatten' for the next boot
+			echo -n $bootloop > '#ec/bootloop'
+		}
 		if(~ $#nobootprompt 0){
 			echo
 			showlocaldevs
--- a/sys/src/9/boot/reboot.rc
+++ b/sys/src/9/boot/reboot.rc
@@ -32,6 +32,7 @@
 
 		# set new kernel parameters
 		echo -n $bootargs > '#ec/bootargs'
+		rm -f '#ec/bootloop'
 
 		# remove part of our temporary root
 		/mnt/broot/$cputype/bin/unmount /$cputype/bin /bin