2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2024-11-21 09:01:46 +00:00

-Update gPXE to 0.9.7

-Change settings according to what will fit in the worst-case option rom
-Have a spec file to generate option roms for virtual nics in kvm
This commit is contained in:
jbjohnso 2009-04-13 14:29:39 +00:00
parent 06753e25c9
commit 04a0f68496
7 changed files with 336 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,11 @@
diff -urN gpxe-0.9.7/src/arch/i386/prefix/romprefix.S gpxe-0.9.7-kvmworkaround/src/arch/i386/prefix/romprefix.S
--- gpxe-0.9.7/src/arch/i386/prefix/romprefix.S 2009-03-01 21:23:42.000000000 -0500
+++ gpxe-0.9.7-kvmworkaround/src/arch/i386/prefix/romprefix.S 2009-03-13 13:27:43.000000000 -0400
@@ -716,6 +716,7 @@
1: pushf
sti
hlt
+ nop
popf
cmpl %fs:(0x6c), %eax
je 1b

View File

@ -0,0 +1,127 @@
diff -urN gpxe-0.9.7/src/arch/i386/interface/pcbios/iscsiboot.c gpxe-0.9.7-registeriscsionpxe/src/arch/i386/interface/pcbios/iscsiboot.c
--- gpxe-0.9.7/src/arch/i386/interface/pcbios/iscsiboot.c 2009-03-01 21:23:42.000000000 -0500
+++ gpxe-0.9.7-registeriscsionpxe/src/arch/i386/interface/pcbios/iscsiboot.c 2009-03-13 14:01:42.000000000 -0400
@@ -20,6 +20,55 @@
.type = &setting_type_int8,
};
+static int iscsireg ( const char *root_path ) {
+ struct scsi_device *scsi;
+ struct int13_drive *drive;
+ int rc;
+
+ scsi = zalloc ( sizeof ( *scsi ) );
+ if ( ! scsi ) {
+ rc = -ENOMEM;
+ goto regerr_alloc_scsi;
+ }
+ drive = zalloc ( sizeof ( *drive ) );
+ if ( ! drive ) {
+ rc = -ENOMEM;
+ goto regerr_alloc_drive;
+ }
+
+ printf ( "Configuring iSCSI at %s\n", root_path );
+
+ if ( ( rc = iscsi_attach ( scsi, root_path ) ) != 0 ) {
+ printf ( "Could not attach iSCSI device: %s\n",
+ strerror ( rc ) );
+ goto regerr_attach;
+ }
+ if ( ( rc = init_scsidev ( scsi ) ) != 0 ) {
+ printf ( "Could not initialise iSCSI device: %s\n",
+ strerror ( rc ) );
+ goto regerr_init;
+ }
+
+ drive->blockdev = &scsi->blockdev;
+
+ /* FIXME: ugly, ugly hack */
+ struct net_device *netdev = last_opened_netdev();
+ struct iscsi_session *iscsi =
+ container_of ( scsi->backend, struct iscsi_session, refcnt );
+ ibft_fill_data ( netdev, iscsi );
+
+ register_int13_drive ( drive );
+ printf ( "Registered as BIOS drive %#02x\n", drive->drive );
+ return 0;
+ regerr_init:
+ iscsi_detach ( scsi );
+ regerr_attach:
+ free ( drive );
+ regerr_alloc_drive:
+ free ( scsi );
+ regerr_alloc_scsi:
+ return rc;
+}
static int iscsiboot ( const char *root_path ) {
struct scsi_device *scsi;
struct int13_drive *drive;
@@ -85,7 +134,9 @@
return rc;
}
+
struct sanboot_protocol iscsi_sanboot_protocol __sanboot_protocol = {
.prefix = "iscsi:",
.boot = iscsiboot,
+ .reg = iscsireg,
};
diff -urN gpxe-0.9.7/src/include/gpxe/sanboot.h gpxe-0.9.7-registeriscsionpxe/src/include/gpxe/sanboot.h
--- gpxe-0.9.7/src/include/gpxe/sanboot.h 2009-03-01 21:23:42.000000000 -0500
+++ gpxe-0.9.7-registeriscsionpxe/src/include/gpxe/sanboot.h 2009-03-13 13:57:04.000000000 -0400
@@ -6,6 +6,7 @@
struct sanboot_protocol {
const char *prefix;
int ( * boot ) ( const char *root_path );
+ int ( * reg ) ( const char *root_path );
};
#define __sanboot_protocol \
diff -urN gpxe-0.9.7/src/usr/autoboot.c gpxe-0.9.7-registeriscsionpxe/src/usr/autoboot.c
--- gpxe-0.9.7/src/usr/autoboot.c 2009-03-01 21:23:42.000000000 -0500
+++ gpxe-0.9.7-registeriscsionpxe/src/usr/autoboot.c 2009-03-13 13:58:43.000000000 -0400
@@ -115,6 +115,23 @@
}
/**
+ * Register a drive in BIOS, but don't boot from it
+ *
+ * @v root_path Root path
+ * * @ret rc Return status code
+ */
+int reg_root_path ( const char *root_path ) {
+ struct sanboot_protocol *sanboot;
+ for ( sanboot = sanboot_protocols ;
+ sanboot < sanboot_protocols_end ; sanboot++ ) {
+ if ( strncmp ( root_path, sanboot->prefix,
+ strlen ( sanboot->prefix ) ) == 0 ) {
+ return sanboot->reg ( root_path );
+ }
+ }
+ return -ENOTSUP;
+}
+/**
* Boot using root path
*
* @v root_path Root path
@@ -149,6 +166,7 @@
struct setting pxe_boot_menu_setting
= { .tag = DHCP_PXE_BOOT_MENU };
char buf[256];
+ char ruf[256];
struct in_addr next_server;
unsigned int pxe_discovery_control;
int rc;
@@ -188,6 +206,11 @@
fetch_ipv4_setting ( NULL, &next_server_setting, &next_server );
fetch_string_setting ( NULL, &filename_setting, buf, sizeof ( buf ) );
if ( buf[0] ) {
+ /* Going to PXE, but set up iBFT if applicable first */
+ fetch_string_setting(NULL, &root_path_setting,ruf,sizeof(ruf));
+ if (ruf[0]) {
+ reg_root_path ( ruf );
+ }
printf ( "Booting from filename \"%s\"\n", buf );
return boot_next_server_and_filename ( next_server, buf );
}

View File

@ -0,0 +1,84 @@
diff -urN gpxe-0.9.7/src/config/general.h gpxe-0.9.7-strip/src/config/general.h
--- gpxe-0.9.7/src/config/general.h 2009-03-01 21:23:42.000000000 -0500
+++ gpxe-0.9.7-strip/src/config/general.h 2009-04-12 09:32:49.000000000 -0400
@@ -29,7 +29,7 @@
* Timer configuration
*
*/
-#define BANNER_TIMEOUT 20 /* Tenths of a second for which the shell
+#define BANNER_TIMEOUT 5 /* Tenths of a second for which the shell
banner should appear */
/*
@@ -46,9 +46,9 @@
#define DOWNLOAD_PROTO_TFTP /* Trivial File Transfer Protocol */
#undef DOWNLOAD_PROTO_NFS /* Network File System */
-#define DOWNLOAD_PROTO_HTTP /* Hypertext Transfer Protocol */
+#undef DOWNLOAD_PROTO_HTTP /* Hypertext Transfer Protocol */
#undef DOWNLOAD_PROTO_HTTPS /* Secure Hypertext Transfer Protocol */
-#undef DOWNLOAD_PROTO_FTP /* File Transfer Protocol */
+#define DOWNLOAD_PROTO_FTP /* File Transfer Protocol */
#undef DOWNLOAD_PROTO_TFTM /* Multicast Trivial File Transfer Protocol */
#undef DOWNLOAD_PROTO_SLAM /* Scalable Local Area Multicast */
#undef DOWNLOAD_PROTO_FSP /* FSP? */
@@ -59,7 +59,7 @@
*/
//#undef SANBOOT_PROTO_ISCSI /* iSCSI protocol */
-//#undef SANBOOT_PROTO_AOE /* AoE protocol */
+#undef SANBOOT_PROTO_AOE /* AoE protocol */
/*
* Name resolution modules
@@ -76,31 +76,31 @@
* you want to use.
*
*/
-//#define IMAGE_NBI /* NBI image support */
-//#define IMAGE_ELF /* ELF image support */
-//#define IMAGE_FREEBSD /* FreeBSD kernel image support */
-//#define IMAGE_MULTIBOOT /* MultiBoot image support */
-//#define IMAGE_AOUT /* a.out image support */
-//#define IMAGE_WINCE /* WinCE image support */
-//#define IMAGE_PXE /* PXE image support */
-//#define IMAGE_SCRIPT /* gPXE script image support */
-//#define IMAGE_BZIMAGE /* Linux bzImage image support */
-//#define IMAGE_COMBOOT /* SYSLINUX COMBOOT image support */
-//#define IMAGE_EFI /* EFI image support */
+#undef IMAGE_NBI /* NBI image support */
+#undef IMAGE_ELF /* ELF image support */
+#undef IMAGE_FREEBSD /* FreeBSD kernel image support */
+#undef IMAGE_MULTIBOOT /* MultiBoot image support */
+#undef IMAGE_AOUT /* a.out image support */
+#undef IMAGE_WINCE /* WinCE image support */
+#define IMAGE_PXE /* PXE image support */
+#define IMAGE_SCRIPT /* gPXE script image support */
+#define IMAGE_BZIMAGE /* Linux bzImage image support */
+#undef IMAGE_COMBOOT /* SYSLINUX COMBOOT image support */
+#undef IMAGE_EFI /* EFI image support */
/*
* Command-line commands to include
*
*/
-#define AUTOBOOT_CMD /* Automatic booting */
-#define NVO_CMD /* Non-volatile option storage commands */
-#define CONFIG_CMD /* Option configuration console */
-#define IFMGMT_CMD /* Interface management commands */
-#define ROUTE_CMD /* Routing table management commands */
+#undef AUTOBOOT_CMD /* Automatic booting */
+#undef NVO_CMD /* Non-volatile option storage commands */
+#undef CONFIG_CMD /* Option configuration console */
+#undef IFMGMT_CMD /* Interface management commands */
+#undef ROUTE_CMD /* Routing table management commands */
#define IMAGE_CMD /* Image management commands */
-#define DHCP_CMD /* DHCP management commands */
-#define SANBOOT_CMD /* SAN boot commands */
-#define LOGIN_CMD /* Login command */
+#undef DHCP_CMD /* DHCP management commands */
+#undef SANBOOT_CMD /* SAN boot commands */
+#undef LOGIN_CMD /* Login command */
/*
* Obscure configuration options

BIN
gpxe/gpxe-0.9.7.tar.gz Normal file

Binary file not shown.

59
gpxe/gpxe-kvm.spec Normal file
View File

@ -0,0 +1,59 @@
Name: gpxe-kvm
Version: 0.9.7
Release: 1
Summary: gPXE loader for virtual guests
Group: System Environment/Kernel
License: GPL
URL: http://etherboot.org/wiki/index.php
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
ExclusiveArch: i386 x86_64
%define Distribution %(rpm -q -qf /etc/redhat-release --qf '%%{name}' | cut -d"-" -f 1)
%define os_version %(rpm -q --qf '%%{version}' %{Distribution}-release)
%define os_release %(rpm -q --qf '%%{release}' %{Distribution}-release | cut -d"." -f 1)
Source0: gpxe-0.9.7.tar.gz
Patch0: gpxe-0.9.7-kvmworkaround.patch
Patch1: gpxe-0.9.7-registeriscsionpxe.patch
Patch2: gpxe-0.9.7-strip.patch
%description
The gPXE network bootloader provides network boot capability for virtual machines with e1000 and virtio network devices. This includes iSCSI and PXE with tftp or ftp image download capability.
%prep
%setup -n gpxe-%{version}
%patch -p1
%patch1 -p1
%patch2 -p1
%build
rm -rf %{buildroot}
cd src
make bin/e1000.rom
make bin/virtio-net.rom
%install
mkdir -p %{buildroot}/usr/share/qemu/
cp src/bin/e1000.rom %{buildroot}/usr/share/qemu/pxe-e1000.bin
cp src/bin/virtio-net.rom %{buildroot}/usr/share/qemu/pxe-virtio.bin
%post
%preun
%clean
%{__rm} -rf %{buildroot}
%files
/usr
%changelog

55
gpxe/gpxe-undi.spec Normal file
View File

@ -0,0 +1,55 @@
Name: gpxe-undi
Version: 0.9.7
Release: 1
Summary: gPXE loader for PXE clients
Group: System Environment/Kernel
License: GPL
URL: http://etherboot.org/wiki/index.php
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
BuildArch: noarch
%define Distribution %(rpm -q -qf /etc/redhat-release --qf '%%{name}' | cut -d"-" -f 1)
%define os_version %(rpm -q --qf '%%{version}' %{Distribution}-release)
%define os_release %(rpm -q --qf '%%{release}' %{Distribution}-release | cut -d"." -f 1)
Source0: gpxe-0.9.7.tar.gz
Patch0: gpxe-0.9.7-kvmworkaround.patch
Patch1: gpxe-0.9.7-registeriscsionpxe.patch
Patch2: gpxe-0.9.7-strip.patch
%description
The gPXE network bootloader provides enhanced boot features for any UNDI compliant x86 host. This includes iSCSI, ftp downloads, and gPXE script based booting.
%prep
%setup -n gpxe-%{version}
%patch -p1
%patch1 -p1
%patch2 -p1
%build
rm -rf %{buildroot}
cd src
make bin/undionly.kpxe
%install
mkdir -p %{buildroot}/tftpboot/
cp src/bin/undionly.kpxe %{buildroot}/tftpboot/undionly.kpxe
%post
%preun
%clean
%{__rm} -rf %{buildroot}
%files
/tftpboot/undionly.kpxe
%changelog