diff options
author | Matthias Hentges <oe@hentges.net> | 2006-04-17 19:21:34 +0000 |
---|---|---|
committer | OpenEmbedded Project <openembedded-devel@lists.openembedded.org> | 2006-04-17 19:21:34 +0000 |
commit | 6a23a1d754a1d081aee5687ffbfaecb805fa8db5 (patch) | |
tree | 77980626a7320c4647d19671b67d83c217983c20 /packages/altboot/files/altboot-menu/Advanced | |
parent | 059820ddf64d15cbb63c6cf6984c0da2b4e205f0 (diff) |
altboot: Add initial support for kexec, reworked parts of the menu code
Diffstat (limited to 'packages/altboot/files/altboot-menu/Advanced')
3 files changed, 309 insertions, 62 deletions
diff --git a/packages/altboot/files/altboot-menu/Advanced/35-kexec b/packages/altboot/files/altboot-menu/Advanced/35-kexec deleted file mode 100644 index 41b193a379..0000000000 --- a/packages/altboot/files/altboot-menu/Advanced/35-kexec +++ /dev/null @@ -1,62 +0,0 @@ -# !/bin/sh -M_TITLE="init=/bin/sh" - -exit 0 - -# Only kernel 2.6 offers kexec support -uname -r | grep -q "^2.6" || exit 0 - -run_module() { - - test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!" - - test -z "$KEXEC_KERNEL_DIR" && KEXEC_KERNEL_DIR="/boot" - test -x "$KEXEC_BIN" || die "kexec-tools not found [$KEXEC_BIN]" - - # Mount /proc, etc - init_rootfs - - if test "`find "$KEXEC_KERNEL_DIR" -type f -name "*zImage*" | wc -l | tr -d " "`" -gt 1 - then - echo "Please choose a kernel to boot:" - cd "$KEXEC_KERNEL_DIR" - - cnt=1 - for f in `ls -1 "$KEXEC_KERNEL_DIR"` - do - echo "[$cnt] $f" - let cnt=$cnt+1 - done - - while true - do - echo -n "Boot kernel: " - read junk - - if test -n "$junk" - then - cnt=1 - for f in `ls -1 "$KEXEC_KERNEL_DIR"` - do - if test "$cnt" = "$junk" - then - KEXEC_KERNEL="$f" - break - fi - let cnt=$cnt+1 - done - fi - done - - echo "kernel dir:[$KEXEC_KERNEL_DIR]" - echo "Using kernel: [$KEXEC_KERNEL]" - - - for -} - -case "$1" in -title) echo "$M_TITLE";; -run) run_module;; -esac - diff --git a/packages/altboot/files/altboot-menu/Advanced/70-setKernel b/packages/altboot/files/altboot-menu/Advanced/70-setKernel new file mode 100644 index 0000000000..3479637ba1 --- /dev/null +++ b/packages/altboot/files/altboot-menu/Advanced/70-setKernel @@ -0,0 +1,65 @@ +# !/bin/sh +M_TITLE="Choose kernel for next boot" + + + +# Only kernel 2.6 offers kexec support +uname -r | grep -q "^2.6" || exit 0 + +run_module() { + + test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!" + + test -z "$KEXEC_KERNEL_DIR" && KEXEC_KERNEL_DIR="/boot" + test -x "$KEXEC_BIN" || die "kexec-tools not found [$KEXEC_BIN]" + + # Mount /proc, etc + # init_rootfs + + if test `ls -1 $KEXEC_KERNEL_DIR | grep -v "kexec.cfg" | wc -l | tr -d " "` -gt 1 + then + echo -e "\nSelect the kernel for use of the next boot:\n" + + cnt=1 ; reset_pref "kexec_klist" + for k in `ls -1 $KEXEC_KERNEL_DIR/zImage* | grep -v "kexec.cfg" ` + do + echo -e "\t[$cnt] $k" + set_pref "kexec_klist" "$cnt" "$k" + + let cnt=$cnt+1 + done + + echo "" + + while true + do + echo -n "Select a kernel: " + read junk + + #echo_pref kexec_klist + + get_pref "kexec_klist" "$junk" KEXEC_SELECTED_KERNEL && break + + done + + echo "Using [$KEXEC_SELECTED_KERNEL]" + fi + + if ! test -e "$KEXEC_SELECTED_KERNEL.kexec.cfg" + then + echo -e "\nWARNING: This kernel has not been configured." + echo -e "It will only boot correctly if CMDLINE is compiled in.\n" + fi + + export USE_KEXEC_ON_NEXT_BOOT=yes + export KEXEC_SELECTED_KERNEL + show_menu +} + + + +case "$1" in +title) echo "$M_TITLE";; +run) run_module;; +esac + diff --git a/packages/altboot/files/altboot-menu/Advanced/80-configure-kexec b/packages/altboot/files/altboot-menu/Advanced/80-configure-kexec new file mode 100644 index 0000000000..9418e30dcf --- /dev/null +++ b/packages/altboot/files/altboot-menu/Advanced/80-configure-kexec @@ -0,0 +1,244 @@ +# !/bin/sh +M_TITLE="Configure kexec CMDLINE" + + + +# Only kernel 2.6 offers kexec support +uname -r | grep -q "^2.6" || exit 0 + +run_module() { + + test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!" + + test -z "$KEXEC_KERNEL_DIR" && KEXEC_KERNEL_DIR="/boot" + test -x "$KEXEC_BIN" || die "kexec-tools not found [$KEXEC_BIN]" + + # Mount /proc, etc + init_rootfs + + if test `ls -1 $KEXEC_KERNEL_DIR | grep -v "kexec.cfg" | wc -l | tr -d " "` -gt 1 + then + echo -e "\nPlease select the kernel you want to configure:\n" + + cnt=1 ; reset_pref "kexec_klist" + for k in `ls -1 $KEXEC_KERNEL_DIR/zImage* | grep -v "kexec.cfg" ` + do + echo -e "\t[$cnt] $k" + set_pref "kexec_klist" "$cnt" "$k" + + let cnt=$cnt+1 + done + + echo "" + + while true + do + echo -n "Select a kernel: " + read junk + + get_pref "kexec_klist" "$junk" KEXEC_KERNEL && break + + done + + echo "Using [$KEXEC_KERNEL]" + fi + + configure_rootdev + configure_roottype + configure_verbose + configure_custom + + CMDLINE="console=ttyS0,115200n8 console=tty1 dyntick=enable fbcon=rotate:1 noinitrd root=$KERNEL_ROOTDEV rootfstype=$KERNEL_ROOTFSTYPE $KERNEL_VERBOSE $KERNEL_CUSTOM" + + echo -en "\nWriting CMDLINE to $KEXEC_KERNEL.kexec.cfg..." + echo "$CMDLINE" > $KEXEC_KERNEL.kexec.cfg && echo ok || mdie FAILED + + show_menu +} + +configure_rootdev() { + + echo -e "\nPlease choose a root device (root=*):\n" + + cnt=1 ; reset_pref "kexec_rootdev" + for root in /dev/mtdblock2 /dev/hda1 "Manual Entry" + do + echo -e "\t[$cnt] $root" + set_pref kexec_rootdev "$cnt" "$root" + let cnt=cnt+1 + done + + echo "" + + while true + do + echo -n "Select a root device: " + read junk + + get_pref kexec_rootdev "$junk" KERNEL_ROOTDEV && break + done + + if test "$KERNEL_ROOTDEV" = "Manual Entry" + then + echo "" + + KERNEL_ROOTDEV="" + + while test -z "$KERNEL_ROOTDEV" + do + while true + do + echo -n "Enter the root device: " + read junk + test -n "$junk" && break + done + + echo -en "\nIs [$junk] correct? [Y|n] " + read junk2 + while true + do + if test "$junk2" = y -o "$junk2" = Y -o -z "$junk2" + then + KERNEL_ROOTDEV="$junk" + break + fi + + break + done + done + fi + + echo "Using [$KERNEL_ROOTDEV] as root device" +} + +configure_roottype() { + + echo -e "\nPlease choose a rootfs type (rootfs=*):\n" + + cnt=1 ; reset_pref "kexec_rootfstype" + for root in jffs2 ext2 ext3 "Manual Entry" + do + echo -e "\t[$cnt] $root" + set_pref kexec_rootfstype "$cnt" "$root" + let cnt=cnt+1 + done + + echo "" + + while true + do + echo -n "Select a rootfs type: " + read junk + + get_pref kexec_rootfstype "$junk" KERNEL_ROOTFSTYPE && break + done + + if test "$KERNEL_ROOTFSTYPE" = "Manual Entry" + then + echo "" + + KERNEL_ROOTFSTYPE="" + + while test -z "$KERNEL_ROOTFSTYPE" + do + while true + do + echo -n "Enter the rootfs type: " + read junk + test -n "$junk" && break + done + + echo -en "\nIs [$junk] correct? [Y|n] " + read junk2 + while true + do + if test "$junk2" = y -o "$junk2" = Y -o -z "$junk2" + then + KERNEL_ROOTFSTYPE="$junk" + break + fi + + break + done + done + fi + + echo "Using [$KERNEL_ROOTFSTYPE] as rootfs type" +} + +configure_verbose() { + echo -e "\nDo you want to see kernel messages? ([quiet | debug]):\n" + + echo -e "\t[1] Yes" + echo -e "\t[2] No" + + echo "" + + while true + do + echo -n "Select one of the above: " + read junk + + test "$junk" = 1 -o "$junk" = 2 && break + done + + test "$junk" = 1 && KERNEL_VERBOSE="debug" || KERNEL_VERBOSE="quiet" + +} + +configure_custom() { + echo -e "\nDo you want to set custom kernel options?\n" + + echo -e "\t[1] Yes" + echo -e "\t[2] No" + + echo "" + + while true + do + echo -n "Select one of the above: " + read junk + + test "$junk" = 1 -o "$junk" = 2 && break + done + + if test "$junk" = 1 + then + + echo "" + + KERNEL_CUSTOM="" + + while test -z "$KERNEL_CUSTOM" + do + while true + do + echo -n "Enter kernel options: " + read junk + test -n "$junk" && break + done + + echo -en "\nIs [$junk] correct? [Y|n] " + read junk2 + while true + do + if test "$junk2" = y -o "$junk2" = Y -o -z "$junk2" + then + KERNEL_CUSTOM="$junk" + break + fi + + break + done + done + fi + + echo "Using [$KERNEL_CUSTOM] as custom kernel options" + +} + +case "$1" in +title) echo "$M_TITLE";; +run) run_module;; +esac + |