From owner-freebsd-hackers Tue Sep 5 9:24:24 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from peach.ocn.ne.jp (peach.ocn.ne.jp [210.145.254.87]) by hub.freebsd.org (Postfix) with ESMTP id EB77E37B42C; Tue, 5 Sep 2000 09:24:19 -0700 (PDT) Received: from newsguy.com (p19-dn01kiryunisiki.gunma.ocn.ne.jp [211.0.245.20]) by peach.ocn.ne.jp (8.9.1a/OCN/) with ESMTP id BAA11545; Wed, 6 Sep 2000 01:24:18 +0900 (JST) Message-ID: <39B51E16.E8AD4BC8@newsguy.com> Date: Wed, 06 Sep 2000 01:23:51 +0900 From: "Daniel C. Sobral" X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en,pt-BR MIME-Version: 1.0 To: bp@freebsd.org, hackers@freebsd.org Subject: Multiple kernels selector... Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG This is an adaptation from menuconf.4th: \ Simple greeting screen, presenting basic options. \ XXX This is far too trivial - I don't have time now to think \ XXX about something more fancy... :-/ \ $FreeBSD: /c/ncvs/src/share/examples/bootforth/menuconf.4th,v 1.4 1999/09/29 04:46:01 dcs Exp $ : title ." Welcome to BootFORTH!" cr cr ; : menu ." 1. Start FreeBSD with /boot/stable.conf." cr ." 2. Start FreeBSD with /boot/current.conf." cr ." 3. Start FreeBSD with standard configuration. " cr ." 4. Reboot." cr cr ; : tkey ( d -- flag | char ) seconds + begin 1 while dup seconds u< if drop -1 exit then key? if drop key exit then repeat ; : prompt ." Enter your option (1,2,3,4): " 10 tkey dup 32 = if drop key then dup 0< if drop 51 then dup emit cr ; : (reboot) 0 reboot ; : main_menu begin 1 while title menu prompt cr cr dup 49 = if drop ." Loading /boot/stable.conf. Please wait..." cr s" /boot/stable.conf" read-conf 0 boot-conf exit then dup 50 = if drop ." Loading /boot/current.conf. Please wait..." cr s" /boot/current.conf" read-conf 0 boot-conf exit then dup 51 = if drop ." Proceeding with standard boot. Please wait..." cr 0 boot-conf exit then dup 52 = if drop ['] (reboot) catch abort" Error rebooting" then ." Key " emit ." is not a valid option!" cr ." Press any key to continue..." key drop cr repeat ; This reads stable.conf or current.conf depending on option 1 or 2 (or standard boot for option 3), and then boots. You can simplify it in the following way. Replace the lines s" /boot/stable.conf" read-conf 0 boot-conf exit (and similar for current.conf) with the line s" kernel.stable" 1 boot-conf exit and you'll just try to boot the standard configuration using the kernel named kernel.stable. If you need to match modules to kernels, keep both kernel and modules in the same directory, under either root or /boot, for each kernel/modules set. Then, if you want to boot the kernel and modules inside the directory /boot/stable or /stable, for example, you replace the two lines with: s" stable" 1 boot-conf exit You can, of course, add more options easily. And you can mix all of the above options: .conf files names, kernel names and directory names, depending on what option you choose. Put this stuff in a file (asciimenu.4th, for example) and then replace the "start" on loader.rc with the following: s" /boot/asciimenu.4th" fopen dup fload fclose initialize drop main_menu -- Daniel C. Sobral (8-DCS) dcs@newsguy.com dcs@freebsd.org capo@white.bunnies.bsdconspiracy.net OK, so the solar flares are my fault.. I am sorry, ok?!?! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message