[Etherboot-developers] Patch to add passing FreeBSD kernel environment
Brought to you by:
marty_connor,
stefanhajnoczi
|
From: Doug A. <amb...@am...> - 2001-06-09 03:13:50
|
This applies to version 5.1.0 in the src directory. It added the
capability to define FreeBSD kernel environment or do it via a DHCP option.
Comments on picking which option value would be helpfull. I picked 133
since it was the next one after 132 which is used for the boot how to
flags. ISC-DHCP did something strange when I added it to the list
of options to request.
Doug A.
diff -r -c ./Config /usr/home/ambrisko/etherboot-5.1.0.orig/src/Config
*** ./Config Sun May 6 22:55:54 2001
--- /usr/home/ambrisko/etherboot-5.1.0.orig/src/Config Fri Jun 8 14:32:07 2001
***************
*** 126,131 ****
--- 126,133 ----
# -DIMAGE_FREEBSD
# Add FreeBSD image loading support (requires at least
# -DAOUT_IMAGE and/or -DELF_IMAGE).
+ # -DFREEBSD_KERNEL_ENV
+ # Pass in FreeBSD kernel environment
# -DDOWNLOAD_PROTO_TFTP
# If defined, boots by tftp (recommended).
# -DDOWNLOAD_PROTO_NFS
diff -r -c ./etherboot.h /usr/home/ambrisko/etherboot-5.1.0.orig/src/etherboot.h
*** ./etherboot.h Sat May 26 16:47:14 2001
--- /usr/home/ambrisko/etherboot-5.1.0.orig/src/etherboot.h Fri Jun 8 14:15:36 2001
***************
*** 221,226 ****
--- 221,227 ----
#define RFC1533_VENDOR_ETHDEV 130
#ifdef IMAGE_FREEBSD
#define RFC1533_VENDOR_HOWTO 132
+ #define RFC1533_VENDOR_KERNEL_ENV 133
#endif
#define RFC1533_VENDOR_MNUOPTS 160
#define RFC1533_VENDOR_SELECTION 176
***************
*** 579,584 ****
--- 580,586 ----
extern unsigned char *end_of_rfc1533;
#ifdef IMAGE_FREEBSD
extern int freebsd_howto;
+ extern char freebsd_kernel_env[1024];
#endif
/* config.c */
diff -r -c ./main.c /usr/home/ambrisko/etherboot-5.1.0.orig/src/main.c
*** ./main.c Sat May 26 16:47:14 2001
--- /usr/home/ambrisko/etherboot-5.1.0.orig/src/main.c Fri Jun 8 14:21:08 2001
***************
*** 49,54 ****
--- 49,55 ----
#ifdef IMAGE_FREEBSD
int freebsd_howto = 0;
+ char freebsd_kernel_env[1024];
#endif
#ifndef BOOTP_DATA_AT_0x93C00
***************
*** 97,102 ****
--- 98,106 ----
RFC1533_VENDOR_ETHDEV,
#ifdef IMAGE_FREEBSD
RFC1533_VENDOR_HOWTO,
+ /*
+ RFC1533_VENDOR_KERNEL_ENV,
+ */
#endif
RFC1533_VENDOR_MNUOPTS, RFC1533_VENDOR_SELECTION,
/* 8 MOTD entries */
***************
*** 999,1004 ****
--- 1003,1014 ----
any troubles with this but I have without it
*/
vendorext_isvalid = 1;
+ #ifdef FREEBSD_KERNEL_ENV
+ memcpy(freebsd_kernel_env, FREEBSD_KERNEL_ENV,
+ strlen(FREEBSD_KERNEL_ENV));
+ #else
+ freebsd_kernel_env[0]='\000';
+ #endif
#else
vendorext_isvalid = 0;
#endif
***************
*** 1072,1077 ****
--- 1082,1094 ----
#ifdef IMAGE_FREEBSD
else if (c == RFC1533_VENDOR_HOWTO)
freebsd_howto = ((p[2]*256+p[3])*256+p[4])*256+p[5];
+ else if (c == RFC1533_VENDOR_KERNEL_ENV){
+ if(*(p + 1) < sizeof(freebsd_kernel_env)){
+ memcpy(freebsd_kernel_env,p+2,*(p+1));
+ }else{
+ printf("Only support %d bytes in Kernel Env %d\n",sizeof(freebsd_kernel_env));
+ }
+ }
#endif
#ifdef IMAGE_MENU
else if (c == RFC1533_VENDOR_MNUOPTS)
diff -r -c ./osloader.c /usr/home/ambrisko/etherboot-5.1.0.orig/src/osloader.c
*** ./osloader.c Sat May 26 16:51:17 2001
--- /usr/home/ambrisko/etherboot-5.1.0.orig/src/osloader.c Fri Jun 8 14:27:15 2001
***************
*** 502,507 ****
--- 502,512 ----
info.bsdinfo.bi_kernelname = KERNEL_BUF;
info.bsdinfo.bi_nfs_diskless = NULL;
info.bsdinfo.bi_size = sizeof(info.bsdinfo);
+ #define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */
+ if(strlen(freebsd_kernel_env)>0){
+ freebsd_howto |= RB_BOOTINFO;
+ info.bsdinfo.bi_envp = freebsd_kernel_env;
+ }
/* Check if we have symbols loaded, and if so,
* made the meta_data needed to pass those to
|