diff --git a/xnba/README b/xnba/README index 49187bb..5c6ee75 100644 --- a/xnba/README +++ b/xnba/README @@ -1,3 +1,9 @@ +xNBA +----- + +xnba-undi-2.0-source.tar.bz2 is from https://github.com/xcat2/xNBA +It included the soure code from ipxe.org and modification for xCAT Network Boot Agent + xNBA for Debian --------------- diff --git a/xnba/ipxe-branding.patch b/xnba/ipxe-branding.patch index ecc2afb..6a5de6a 100644 --- a/xnba/ipxe-branding.patch +++ b/xnba/ipxe-branding.patch @@ -1,7 +1,8 @@ -diff -urN ipxe/src/config/general.h ipxe-branded/src/config/general.h ---- ipxe/src/config/general.h 2010-11-11 14:09:48.052334980 -0500 -+++ ipxe-branded/src/config/general.h 2010-11-12 09:33:37.493584218 -0500 -@@ -24,8 +24,8 @@ +diff --git a/src/config/branding.h b/src/config/branding.h +index 73f00af..29985fe 100644 +--- a/src/config/branding.h ++++ b/src/config/branding.h +@@ -24,8 +24,8 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); * "iPXE". * */ @@ -9,6 +10,6 @@ diff -urN ipxe/src/config/general.h ipxe-branded/src/config/general.h -#define PRODUCT_SHORT_NAME "iPXE" +#define PRODUCT_NAME "xCAT Network Boot Agent" +#define PRODUCT_SHORT_NAME "xNBA" + #define PRODUCT_URI "http://ipxe.org" /* - * Timer configuration diff --git a/xnba/ipxe-cmdlinesize.patch b/xnba/ipxe-cmdlinesize.patch deleted file mode 100644 index 55d1f10..0000000 --- a/xnba/ipxe-cmdlinesize.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -urN ipxe-expandfilename/src/arch/i386/include/bzimage.h ipxe-cmdlinesize/src/arch/i386/include/bzimage.h ---- ipxe-expandfilename/src/arch/i386/include/bzimage.h 2010-11-11 14:09:48.042334268 -0500 -+++ ipxe-cmdlinesize/src/arch/i386/include/bzimage.h 2010-11-12 10:47:08.086084309 -0500 -@@ -137,6 +137,6 @@ - #define BZI_STACK_SIZE 0x1000 - - /** Maximum size of command line */ --#define BZI_CMDLINE_SIZE 0x100 -+#define BZI_CMDLINE_SIZE 0x7FF - - #endif /* _BZIMAGE_H */ diff --git a/xnba/ipxe-dhcp.patch b/xnba/ipxe-dhcp.patch new file mode 100644 index 0000000..b505943 --- /dev/null +++ b/xnba/ipxe-dhcp.patch @@ -0,0 +1,13 @@ +diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c +index 3a3666c..0e46a82 100644 +--- a/src/net/udp/dhcp.c ++++ b/src/net/udp/dhcp.c +@@ -87,7 +87,7 @@ static uint8_t dhcp_request_options_data[] = { + DHCP_VENDOR_CLASS_ID, + DHCP_STRING ( DHCP_VENDOR_PXECLIENT ( DHCP_ARCH_CLIENT_ARCHITECTURE, + DHCP_ARCH_CLIENT_NDI ) ), +- DHCP_USER_CLASS_ID, DHCP_STRING ( 'i', 'P', 'X', 'E' ), ++ DHCP_USER_CLASS_ID, DHCP_STRING ( 'x', 'N', 'B', 'A' ), + DHCP_PARAMETER_REQUEST_LIST, + DHCP_OPTION ( DHCP_SUBNET_MASK, DHCP_ROUTERS, DHCP_DNS_SERVERS, + DHCP_LOG_SERVERS, DHCP_HOST_NAME, DHCP_DOMAIN_NAME, diff --git a/xnba/ipxe-machyp.patch b/xnba/ipxe-machyp.patch index a22f335..2b1650d 100644 --- a/xnba/ipxe-machyp.patch +++ b/xnba/ipxe-machyp.patch @@ -1,141 +1,24 @@ -diff -urN ipxe-cmdlinesize/src/core/settings.c ipxe-machyp/src/core/settings.c ---- ipxe-cmdlinesize/src/core/settings.c 2010-11-11 14:09:48.062345190 -0500 -+++ ipxe-machyp/src/core/settings.c 2010-11-12 10:49:22.822334798 -0500 -@@ -1321,6 +1321,72 @@ - } - - /** -+ * Parse and store value of hex string setting, hyphen delimited -+ * -+ * @v settings Settings block -+ * @v setting Setting to store -+ * @v value Formatted setting data -+ * @ret rc Return status code -+ */ -+static int storef_hexhyp ( struct settings *settings, struct setting *setting, -+ const char *value ) { -+ char *ptr = ( char * ) value; -+ uint8_t bytes[ strlen ( value ) ]; /* cannot exceed strlen(value) */ -+ unsigned int len = 0; -+ -+ while ( 1 ) { -+ bytes[len++] = strtoul ( ptr, &ptr, 16 ); -+ switch ( *ptr ) { -+ case '\0' : -+ return store_setting ( settings, setting, bytes, len ); -+ case '-' : -+ ptr++; -+ break; -+ default : -+ return -EINVAL; -+ } -+ } -+} -+/** -+ * Fetch and format value of hex string setting with hypphen delimiter -+ * -+ * @v settings Settings block, or NULL to search all blocks -+ * @v setting Setting to fetch -+ * @v buf Buffer to contain formatted value -+ * @v len Length of buffer -+ * @ret len Length of formatted value, or negative error -+ */ -+static int fetchf_hexhyp ( struct settings *settings, struct setting *setting, -+ char *buf, size_t len ) { -+ int raw_len; -+ int check_len; -+ int used = 0; -+ int i; -+ -+ raw_len = fetch_setting_len ( settings, setting ); -+ if ( raw_len < 0 ) -+ return raw_len; -+ -+ { -+ uint8_t raw[raw_len]; -+ -+ check_len = fetch_setting ( settings, setting, raw, -+ sizeof ( raw ) ); -+ if ( check_len < 0 ) -+ return check_len; -+ assert ( check_len == raw_len ); -+ -+ if ( len ) -+ buf[0] = 0; /* Ensure that a terminating NUL exists */ -+ for ( i = 0 ; i < raw_len ; i++ ) { -+ used += ssnprintf ( ( buf + used ), ( len - used ), -+ "%s%02x", ( used ? "-" : "" ), -+ raw[i] ); -+ } -+ return used; -+ } -+} -+/** - * Fetch and format value of hex string setting - * - * @v settings Settings block, or NULL to search all blocks -@@ -1366,6 +1432,12 @@ - .storef = storef_hex, - .fetchf = fetchf_hex, - }; -+/** A hex-string setting, hyphen delimited */ -+struct setting_type setting_type_hexhyp __setting_type = { -+ .name = "hexhyp", -+ .storef = storef_hexhyp, -+ .fetchf = fetchf_hexhyp, -+}; - - /** - * Parse and store value of UUID setting -diff -urN ipxe-cmdlinesize/src/include/ipxe/settings.h ipxe-machyp/src/include/ipxe/settings.h ---- ipxe-cmdlinesize/src/include/ipxe/settings.h 2010-11-11 14:09:48.132334810 -0500 -+++ ipxe-machyp/src/include/ipxe/settings.h 2010-11-12 10:50:51.433584483 -0500 -@@ -227,6 +227,7 @@ - extern struct setting_type setting_type_uint16 __setting_type; - extern struct setting_type setting_type_uint32 __setting_type; - extern struct setting_type setting_type_hex __setting_type; -+extern struct setting_type setting_type_hexhyp __setting_type; - extern struct setting_type setting_type_uuid __setting_type; - - extern struct setting ip_setting __setting; -@@ -243,6 +244,7 @@ - extern struct setting uuid_setting __setting; - extern struct setting next_server_setting __setting; - extern struct setting mac_setting __setting; -+extern struct setting machyp_setting __setting; - extern struct setting busid_setting __setting; - extern struct setting user_class_setting __setting; - -diff -urN ipxe-cmdlinesize/src/net/netdev_settings.c ipxe-machyp/src/net/netdev_settings.c ---- ipxe-cmdlinesize/src/net/netdev_settings.c 2010-11-11 14:09:48.132334810 -0500 -+++ ipxe-machyp/src/net/netdev_settings.c 2010-11-12 10:49:22.822334798 -0500 -@@ -38,6 +38,11 @@ +diff --git a/src/net/netdev_settings.c b/src/net/netdev_settings.c +index cc2e103..2b8de05 100644 +--- a/src/net/netdev_settings.c ++++ b/src/net/netdev_settings.c +@@ -45,6 +45,11 @@ const struct setting mac_setting __setting ( SETTING_NETDEV, mac ) = { .description = "MAC address", .type = &setting_type_hex, }; -+struct setting machyp_setting __setting = { -+ .name = "machyp", -+ .description = "MAC address", -+ .type = &setting_type_hexhyp, ++const struct setting machyp_setting __setting ( SETTING_NETDEV, machyp ) = { ++ .name = "machyp", ++ .description = "MAC address", ++ .type = &setting_type_hexhyp, +}; - struct setting busid_setting __setting = { - .name = "busid", - .description = "Bus ID", -@@ -58,7 +63,7 @@ - struct net_device *netdev = container_of ( settings, struct net_device, - settings.settings ); - -- if ( setting_cmp ( setting, &mac_setting ) == 0 ) { -+ if (( setting_cmp ( setting, &mac_setting ) == 0 ) || ( setting_cmp ( setting, &machyp_setting ) == 0 )) { - if ( len != netdev->ll_protocol->ll_addr_len ) - return -EINVAL; - memcpy ( netdev->ll_addr, data, len ); -@@ -84,7 +89,7 @@ - struct device_description *desc = &netdev->dev->desc; - struct dhcp_netdev_desc dhcp_desc; - -- if ( setting_cmp ( setting, &mac_setting ) == 0 ) { -+ if (( setting_cmp ( setting, &mac_setting ) == 0 ) || ( setting_cmp ( setting, &machyp_setting ) == 0 )) { - if ( len > netdev->ll_protocol->ll_addr_len ) - len = netdev->ll_protocol->ll_addr_len; - memcpy ( data, netdev->ll_addr, len ); + const struct setting hwaddr_setting __setting ( SETTING_NETDEV, hwaddr ) = { + .name = "hwaddr", + .description = "Hardware address", +@@ -277,6 +282,7 @@ struct netdev_setting_operation { + /** Network device settings */ + static struct netdev_setting_operation netdev_setting_operations[] = { + { &mac_setting, netdev_store_mac, netdev_fetch_mac }, ++ { &machyp_setting, netdev_store_mac, netdev_fetch_mac }, + { &hwaddr_setting, NULL, netdev_fetch_hwaddr }, + { &bustype_setting, NULL, netdev_fetch_bustype }, + { &busloc_setting, NULL, netdev_fetch_busloc }, diff --git a/xnba/ipxe-source-10-29-2020.tar.xz b/xnba/ipxe-source-10-29-2020.tar.xz new file mode 100644 index 0000000..0b67653 Binary files /dev/null and b/xnba/ipxe-source-10-29-2020.tar.xz differ diff --git a/xnba/ipxe-xnbaclass.patch b/xnba/ipxe-xnbaclass.patch index 5f6a97b..b505943 100644 --- a/xnba/ipxe-xnbaclass.patch +++ b/xnba/ipxe-xnbaclass.patch @@ -1,10 +1,11 @@ -diff -urN ipxe-droppackets/src/net/udp/dhcp.c ipxe-xnbaclass/src/net/udp/dhcp.c ---- ipxe-droppackets/src/net/udp/dhcp.c 2010-11-11 14:09:48.142334824 -0500 -+++ ipxe-xnbaclass/src/net/udp/dhcp.c 2010-11-12 10:35:08.482334675 -0500 -@@ -79,7 +79,7 @@ - DHCP_CLIENT_ARCHITECTURE, DHCP_ARCH_CLIENT_ARCHITECTURE, - DHCP_CLIENT_NDI, DHCP_ARCH_CLIENT_NDI, - DHCP_VENDOR_CLASS_ID, DHCP_ARCH_VENDOR_CLASS_ID, +diff --git a/src/net/udp/dhcp.c b/src/net/udp/dhcp.c +index 3a3666c..0e46a82 100644 +--- a/src/net/udp/dhcp.c ++++ b/src/net/udp/dhcp.c +@@ -87,7 +87,7 @@ static uint8_t dhcp_request_options_data[] = { + DHCP_VENDOR_CLASS_ID, + DHCP_STRING ( DHCP_VENDOR_PXECLIENT ( DHCP_ARCH_CLIENT_ARCHITECTURE, + DHCP_ARCH_CLIENT_NDI ) ), - DHCP_USER_CLASS_ID, DHCP_STRING ( 'i', 'P', 'X', 'E' ), + DHCP_USER_CLASS_ID, DHCP_STRING ( 'x', 'N', 'B', 'A' ), DHCP_PARAMETER_REQUEST_LIST, diff --git a/xnba/xnba-undi.spec b/xnba/xnba-undi.spec index ae710f8..d54117c 100644 --- a/xnba/xnba-undi.spec +++ b/xnba/xnba-undi.spec @@ -1,12 +1,11 @@ Name: xnba-undi -Version: 1.0.3 -Release: 7 +Version: 2.0.0 +Release: 0 Summary: xCAT Network Boot Agent for x86 PXE hosts -Obsoletes: gpxe-undi Group: System Environment/Kernel License: GPL -URL: https://ipxe.org/vendor/xcat/ipxe.git +URL: https://ipxe.org/ipxe.git BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} BuildArch: noarch @@ -15,14 +14,22 @@ BuildArch: noarch %define os_release %(rpm -q --qf '%%{release}' %{Distribution}-release | cut -d"." -f 1) -Source0: xnba-%{version}-7.tar.bz2 +Source0: ipxe-source-10-29-2020.tar.xz +Patch1: ipxe-branding.patch +Patch2: ipxe-machyp.patch +Patch3: ipxe-xnbaclass.patch +Patch4: ipxe-dhcp.patch %description -The xCAT Network Boot Agent is a slightly modified version of gPXE. It provides enhanced boot features for any UNDI compliant x86 host. This includes iSCSI, http/ftp downloads, and gPXE script based booting. +The xCAT Network Boot Agent is a slightly modified version of iPXE. It provides enhanced boot features for any UNDI compliant x86 host. This includes iSCSI, http/ftp downloads, and iPXE script based booting. %prep -%setup -n xnba-1.0.3-7 +%setup -n ipxe-source +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 %build @@ -30,7 +37,7 @@ rm -rf %{buildroot} cd src make bin/undionly.kkpxe -make bin-x86_64-efi/snponly.efi +make bin-x86_64-efi/ipxe.efi %install @@ -38,7 +45,7 @@ make bin-x86_64-efi/snponly.efi mkdir -p %{buildroot}/tftpboot/xcat #Rename to avoid conflicting with potential vanilla undionly.kpxe that user may be using cp src/bin/undionly.kkpxe %{buildroot}/tftpboot/xcat/xnba.kpxe -cp src/bin-x86_64-efi/snponly.efi %{buildroot}/tftpboot/xcat/xnba.efi +cp src/bin-x86_64-efi/ipxe.efi %{buildroot}/tftpboot/xcat/xnba.efi %post