FreeBSD Bugzilla – Attachment 196934 Details for
Bug 227313
net/isboot-kmod works with net/istgt but not with ctld(8)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch loader to load isboot.ko if iBFT is present.
ibft-loader.diff (text/plain), 8.71 KB, created by
Daniel O'Connor
on 2018-09-07 04:14:29 UTC
(
hide
)
Description:
Patch loader to load isboot.ko if iBFT is present.
Filename:
MIME Type:
Creator:
Daniel O'Connor
Created:
2018-09-07 04:14:29 UTC
Size:
8.71 KB
patch
obsolete
>Index: sys/boot/forth/loader.4th >=================================================================== >--- sys/boot/forth/loader.4th (revision 338471) >+++ sys/boot/forth/loader.4th (working copy) >@@ -49,6 +49,35 @@ > > only forth definitions > >+: ibftpresent? ( -- flag ) \ Returns TRUE if iBFT is present, FALSE otherwise >+ s" ibft.revision" getenv >+ dup -1 = if >+ drop false exit >+ then >+ 2drop >+ true >+; >+ >+: ibftenabled? ( -- flag ) \ Returns TRUE if iBFT is enabled, FALSE otherwise >+ s" ibft.disabled" getenv >+ dup -1 <> if >+ s" 0" compare 0<> if >+ false exit >+ then >+ else >+ drop >+ then >+ true >+; >+ >+: ibftauto ( -- flag ) \ Set isboot_load="YES" is iBFT is present and enabled >+ ibftenabled? if >+ ibftpresent? if >+ s" set isboot_load=YES" evaluate >+ then >+ then >+; >+ > : bootmsg ( -- ) > loader_color? dup ( -- bool bool ) > if 7 fg 4 bg then >Index: sys/boot/forth/loader.conf >=================================================================== >--- sys/boot/forth/loader.conf (revision 338471) >+++ sys/boot/forth/loader.conf (working copy) >@@ -536,6 +536,7 @@ > amdtemp_load="NO" # AMD K8/K10/K11 temperature monitor > tpm_load="NO" # Trusted Platform Module > wbwd_load="NO" # Winbond watchdog >+isboot_Load="NO" # iSCSI boot module > > > ############################################################## >Index: sys/boot/forth/loader.rc >=================================================================== >--- sys/boot/forth/loader.rc (revision 338471) >+++ sys/boot/forth/loader.rc (working copy) >@@ -15,6 +15,9 @@ > \ Tests for password -- executes autoboot first if a password was defined > check-password > >+\ Check for iBFT and load isboot if present & not disabled >+ibftauto >+ > \ Uncomment to enable boot menu > \ include /boot/beastie.4th > \ beastie-start >Index: sys/boot/i386/libi386/Makefile >=================================================================== >--- sys/boot/i386/libi386/Makefile (revision 338471) >+++ sys/boot/i386/libi386/Makefile (working copy) >@@ -7,6 +7,7 @@ > biospci.c biossmap.c bootinfo.c bootinfo32.c bootinfo64.c \ > comconsole.c devicename.c elf32_freebsd.c \ > elf64_freebsd.c multiboot.c multiboot_tramp.S \ >+ ibft.c \ > i386_copy.c i386_module.c nullconsole.c pxe.c pxetramp.s \ > smbios.c time.c vidconsole.c amd64_tramp.S spinconsole.c > .PATH: ${.CURDIR}/../../zfs >Index: sys/boot/i386/libi386/ibft.c >=================================================================== >--- sys/boot/i386/libi386/ibft.c (nonexistent) >+++ sys/boot/i386/libi386/ibft.c (working copy) >@@ -0,0 +1,118 @@ >+/*- >+ * Copyright (c) 2018 Daniel O'Connor <darius@dons.net.au> >+ * All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND >+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE >+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS >+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT >+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY >+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF >+ * SUCH DAMAGE. >+ */ >+ >+#include <sys/cdefs.h> >+__FBSDID("$FreeBSD$"); >+ >+#include <stand.h> >+#include <bootstrap.h> >+#include <sys/endian.h> >+ >+#include "btxv86.h" >+#include "ibft.h" >+ >+/* >+ * Detect iBFT and export information about the iBFT into the >+ * environment. >+ */ >+ >+#define IBFT_ALIGN 16 >+#define IBFT_SIGNATURE "iBFT" >+#define IBFT_SIGNATURE_LENGTH 4 >+#define IBFT_LOW_ADDR (512 * 1024) >+#define IBFT_HIGH_ADDR (1024 * 1024) >+#define IBFT_MAX_LEN (32 * 1024) >+#define IBFT_IP_LEN 16 >+ >+#define IBFT_GET8(base, off) (*(uint8_t *)((base) + (off))) >+#define IBFT_GET16(base, off) (*(uint16_t *)((base) + (off))) >+#define IBFT_GET32(base, off) (*(uint32_t *)((base) + (off))) >+ >+static uint8_t >+ibft_checksum(const caddr_t addr, const int len) >+{ >+ uint8_t sum; >+ int i; >+ >+ for (sum = 0, i = 0; i < len; i++) >+ sum += IBFT_GET8(addr, i); >+ return (sum); >+} >+ >+static caddr_t >+ibft_sigsearch(const caddr_t start, const caddr_t end) >+{ >+ caddr_t cp; >+ uint32_t tlen; >+ uint8_t sum; >+ >+ for (cp = start; cp < end; cp += IBFT_ALIGN) { >+ if (strncmp(cp, IBFT_SIGNATURE, IBFT_SIGNATURE_LENGTH) != 0) >+ continue; >+ >+ tlen = IBFT_GET32(cp, 4); >+ if (tlen > IBFT_MAX_LEN) >+ continue; >+ >+ sum = ibft_checksum(cp, tlen); >+ if (sum != 0) >+ continue; >+ return (cp); >+ } >+ return (NULL); >+} >+ >+void >+ibft_detect(void) >+{ >+ char tmp[20]; >+ caddr_t cp; >+ >+ // XXX: Need to use ACPI for EFI >+ cp = ibft_sigsearch(PTOV(IBFT_LOW_ADDR), PTOV(IBFT_HIGH_ADDR)); >+ if (cp == NULL) >+ return; >+ >+ sprintf(tmp, "%d", IBFT_GET8(cp, 8)); >+ setenv("ibft.revision", tmp, 1); >+ bzero(tmp, sizeof(tmp)); >+ strncpy(tmp, cp + 10, 6); >+ setenv("ibft.oemid", tmp, 1); >+ bzero(tmp, sizeof(tmp)); >+ strncpy(tmp, cp + 16, 8); >+ setenv("ibft.oemtableid", tmp, 1); >+} >+ >+static int >+command_ibft(int argc, char **argv) >+{ >+ ibft_detect(); >+ >+ return 0; >+} >+ >+COMMAND_SET(ibft, "ibft", "find iBFT block", command_ibft); >+ > >Property changes on: sys/boot/i386/libi386/ibft.c >___________________________________________________________________ >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:keywords >## -0,0 +1 ## >+FreeBSD=%H >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sys/boot/i386/libi386/ibft.h >=================================================================== >--- sys/boot/i386/libi386/ibft.h (nonexistent) >+++ sys/boot/i386/libi386/ibft.h (working copy) >@@ -0,0 +1,33 @@ >+/*- >+ * Copyright (c) 2018 Daniel O'Connor <darius@dons.net.au> >+ * All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR >+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, >+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR >+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) >+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, >+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN >+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE >+ * POSSIBILITY OF SUCH DAMAGE. >+ * >+ * $FreeBSD$ >+ */ >+#ifndef _IBFT_H_ >+#define _IBFT_H_ >+ >+void ibft_detect(void); >+ >+#endif /* _IBFT_H_ */ > >Property changes on: sys/boot/i386/libi386/ibft.h >___________________________________________________________________ >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:keywords >## -0,0 +1 ## >+FreeBSD=%H >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: sys/boot/i386/loader/main.c >=================================================================== >--- sys/boot/i386/loader/main.c (revision 338471) >+++ sys/boot/i386/loader/main.c (working copy) >@@ -44,6 +44,7 @@ > #include "common/bootargs.h" > #include "libi386/libi386.h" > #include "libi386/smbios.h" >+#include "libi386/ibft.h" > #include "btxv86.h" > > #ifdef LOADER_ZFS_SUPPORT >@@ -215,6 +216,9 @@ > /* detect PCI BIOS for future reference */ > biospci_detect(); > >+ /* detect iBFT for future reference */ >+ ibft_detect(); >+ > printf("\n%s", bootprog_info); > > extract_currdev(); /* set $currdev and $loaddev */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 227313
:
194065
| 196934