Date: Thu, 22 Aug 2002 07:21:23 +0900 From: Hiroharu Tamaru <tamaru@myn.rcast.u-tokyo.ac.jp> To: freebsd-hackers@FreeBSD.ORG Cc: dirkx@covalent.net, tamaru@myn.rcast.u-tokyo.ac.jp Subject: Re: forth/kernel name with a variable. Message-ID: <sa6ofbvsvj0.wl@gin.myn.rcast.u-tokyo.ac.jp> In-Reply-To: Your message of "Sun, 16 Jun 2002 23:20:55 %2B0200 (CEST)". <Pine.OSX.4.43.0206162317010.339-100000@mobile.webweaving.org> References: <Pine.OSX.4.43.0206162317010.339-100000@mobile.webweaving.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi,
On Sun, 16 Jun 2002 23:20:55 +0200 (CEST),
dirkx@covalent.net wrote:
> During a diskless boot (i.e. after the PXE stage); I'd like to get to load
> (or try to load) a configuration file which is machine specific; e.g.
> something along the lines of:
>
> # >> /mboot/boot/defaults/loader.conf
> #
> ....
> loader_conf_files="/boot/device.hints /boot/loader.conf
> /boot/loader.conf.local /boot/\\${boot.netif.ip}.conf
> /boot/nextboot.conf"
> ....
>
> where at least an attempt is made to get a machine specific file (in this
> case to define a kernel boot file which is specific to that machine) - as
> this would allow me to reduce the footprint on the boot/dhcp/tftp server
> considerably.
>
> Any hints ? (The above does not get substituted).
>
> Dw
> --
> Dirk-Willem van Gulik
I was looking for the same feature, and could not come up
with a Right Way either. Since I wanted to hack as little
as possible, and also not to touch files that are updated so
often in the repository, I ended up with the following hack:
1) patch loader.rc
--- loader.rc- Fri Dec 28 21:05:23 2001
+++ loader.rc Thu May 16 06:55:45 2002
@@ -5,7 +5,26 @@
include /boot/loader.4th
\ Reads and processes loader.rc
-start
+\ start
+
+only forth also support-functions definitions
+
+\ This is for use in 10.0.0.100.rc files
+: initialize_name ( addr len -- )
+ strdup conf_files .len ! conf_files .addr !
+;
+
+\ Need to compile a word to use 'catch' feature
+: mystart
+ s" /boot/defaults/loader.conf" initialize include_conf_files
+ s" include /boot/${boot.netif.ip}.rc" ['] evaluate catch
+ any_conf_read? if
+ load_kernel
+ load_modules
+ then
+;
+
+mystart
\ Tests for password -- executes autoboot first if a password was defined
check-password
2) say your IP is 10.0.0.100, then create a file
/boot/10.0.0.100.rc that has a one line content like
this (the position and the number of the spaces seems to count):
s" /boot/10.0.0.100.conf" initialize_name include_conf_files
3) write your favorite config in /boot/10.0.0.100.conf in
the same syntax as loader.conf
4) Things should work as desired.
NOTE: the order the files are read are:
/boot/defaults/loader.conf
/boot/device.hints
/boot/loader.conf
/boot/loader.conf.local
/boot/10.0.0.100.conf
Oh, and by the way, this was a 4.5-STABLE box when I did the
hack; I guess what you are playing with is a -CURRENT
box. YMMV.
I wanted to avoid the 10.0.0.100.rc file, but could hardly
read nor write the 4th language. I wish someone with a 4th
expertise would write a real solution and commit it to
-CURRENT and -STABLE. The diskless stuffs are hard to live
with without this feature if you have a heterogeneous
environment where you need to switch the kernel image
themselves according to the boxes' h/w.
P.S.
Please keep me in the CC line, I'm not subscribed to this
list; I found the original message in the archives.
--
Hiroharu Tamaru
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?sa6ofbvsvj0.wl>
