diff --git a/xnba/README b/xnba/README index 49187bb..9c109dc 100644 --- a/xnba/README +++ b/xnba/README @@ -1,5 +1,27 @@ +xNBA +----- + +xnba-1.20.1.tar.bz2 contains the source code of ipxe version 1.20.1 (10/29/2020 ?) + +#git clone git://git.ipxe.org/ipxe.git +#tar Jcvf xnba-1.20.1.tar.bz2 --exclude-vcs ipxe + +The following patches contain modification for xCAT Network Boot Agent + + ipxe-xnbaclass.patch + ipxe-machyp.patch + ipxe-dhcp.patch + ipxe-branding.patch + +xNBA for linux +-------------- +Require packages: xz-devel +RPM build: rpmbuild -ba xnba-undi.spec + + xNBA for Debian --------------- +Require packages: dpkg-buildpackage, debhelper, and quilt ./make_deb.sh: build the package from the binaries under "binary" directory ./rebuild.sh : build the package from source code, this should only run on amd64/x86_64 platform, it will update the files under "binary" directory after compilation diff --git a/xnba/binary/xnba.efi b/xnba/binary/xnba.efi index 1fe1356..edcb4be 100644 Binary files a/xnba/binary/xnba.efi and b/xnba/binary/xnba.efi differ diff --git a/xnba/binary/xnba.kpxe b/xnba/binary/xnba.kpxe index 544963e..2560828 100644 Binary files a/xnba/binary/xnba.kpxe and b/xnba/binary/xnba.kpxe differ diff --git a/xnba/debian/changelog b/xnba/debian/changelog index d7b5fea..3da9dc6 100644 --- a/xnba/debian/changelog +++ b/xnba/debian/changelog @@ -1,3 +1,9 @@ +xnba-undi (1.20.1-0) unstable; urgency=low + + * Debian build for xnba-undi version 1.20.1 + + -- Casandra Qiu Mon, 16 Nov 2020 15:49:48 +0800 + xnba-undi (1.0.3-7) unstable; urgency=low * Initial Debian build diff --git a/xnba/debian/control b/xnba/debian/control index bf1d82f..3d67a7d 100644 --- a/xnba/debian/control +++ b/xnba/debian/control @@ -3,7 +3,7 @@ Section: admin Priority: extra Maintainer: xCAT Build-Depends: debhelper (>= 7.0.50~) -Standards-Version: 1.0.3 +Standards-Version: 1.20.1 #Homepage: #Vcs-Git: git://git.debian.org/collab-maint/gpxe.git #Vcs-Browser: http://git.debian.org/?p=collab-maint/gpxe.git;a=summary diff --git a/xnba/debian/files b/xnba/debian/files index bd41b10..de9918d 100644 --- a/xnba/debian/files +++ b/xnba/debian/files @@ -1 +1 @@ -xnba-undi_1.0.3-7_amd64.deb admin extra +xnba-undi_1.20.1-0_amd64.deb admin extra diff --git a/xnba/debian/patches/ipxe-branding.patch b/xnba/debian/patches/ipxe-branding.patch new file mode 120000 index 0000000..2c8c4e9 --- /dev/null +++ b/xnba/debian/patches/ipxe-branding.patch @@ -0,0 +1 @@ +../../ipxe-branding.patch \ No newline at end of file diff --git a/xnba/debian/patches/ipxe-dhcp.patch b/xnba/debian/patches/ipxe-dhcp.patch new file mode 120000 index 0000000..6a2b121 --- /dev/null +++ b/xnba/debian/patches/ipxe-dhcp.patch @@ -0,0 +1 @@ +../../ipxe-dhcp.patch \ No newline at end of file diff --git a/xnba/debian/patches/ipxe-machyp.patch b/xnba/debian/patches/ipxe-machyp.patch new file mode 120000 index 0000000..9248f9b --- /dev/null +++ b/xnba/debian/patches/ipxe-machyp.patch @@ -0,0 +1 @@ +../../ipxe-machyp.patch \ No newline at end of file diff --git a/xnba/debian/patches/ipxe-xnbaclass.patch b/xnba/debian/patches/ipxe-xnbaclass.patch new file mode 120000 index 0000000..a833978 --- /dev/null +++ b/xnba/debian/patches/ipxe-xnbaclass.patch @@ -0,0 +1 @@ +../../ipxe-xnbaclass.patch \ No newline at end of file diff --git a/xnba/debian/patches/series b/xnba/debian/patches/series new file mode 100644 index 0000000..ef32fe3 --- /dev/null +++ b/xnba/debian/patches/series @@ -0,0 +1,4 @@ +ipxe-branding.patch +ipxe-xnbaclass.patch +ipxe-machyp.patch +ipxe-dhcp.patch diff --git a/xnba/debian/rules b/xnba/debian/rules index d11cd1b..9210b48 100755 --- a/xnba/debian/rules +++ b/xnba/debian/rules @@ -10,9 +10,10 @@ build: build-stamp build-stamp: dh_testdir + dh_quilt_patch # Add here commands to compile the package. $(MAKE) -C src bin/undionly.kkpxe - $(MAKE) -C src bin-x86_64-efi/snponly.efi + $(MAKE) -C src bin-x86_64-efi/ipxe.efi touch build-stamp @@ -33,7 +34,7 @@ install: build # Add here commands to install the package into debian/ cp src/bin/undionly.kkpxe `pwd`/debian/`dh_listpackages`/tftpboot/xcat/xnba.kpxe - cp src/bin-x86_64-efi/snponly.efi `pwd`/debian/`dh_listpackages`/tftpboot/xcat/xnba.efi + cp src/bin-x86_64-efi/ipxe.efi `pwd`/debian/`dh_listpackages`/tftpboot/xcat/xnba.efi #dh_movefiles 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..e24bb7a --- /dev/null +++ b/xnba/ipxe-dhcp.patch @@ -0,0 +1,18 @@ +diff --git a/src/include/ipxe/dhcp.h b/src/include/ipxe/dhcp.h +index b7a5f00..d086105 100644 +--- a/src/include/ipxe/dhcp.h ++++ b/src/include/ipxe/dhcp.h +@@ -293,11 +293,11 @@ enum dhcp_client_architecture_values { + /** EFI IA32 */ + DHCP_CLIENT_ARCHITECTURE_IA32 = 0x0006, + /** EFI x86-64 */ +- DHCP_CLIENT_ARCHITECTURE_X86_64 = 0x0007, ++ DHCP_CLIENT_ARCHITECTURE_X86_64 = 0x0009, /** swapped with DHCP_CLIENT_ARCHITECTURE_EFI **/ + /** EFI Xscale */ + DHCP_CLIENT_ARCHITECTURE_XSCALE = 0x0008, + /** EFI BC */ +- DHCP_CLIENT_ARCHITECTURE_EFI = 0x0009, ++ DHCP_CLIENT_ARCHITECTURE_EFI = 0x0007, /** swapped with DHCP_CLIENT_ARCHITECTURE_X86_64 **/ + /** EFI 32-bit ARM */ + DHCP_CLIENT_ARCHITECTURE_ARM32 = 0x000a, + /** EFI 64-bit ARM */ 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-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/rebuild.sh b/xnba/rebuild.sh index ab4b9a8..6fe3318 100755 --- a/xnba/rebuild.sh +++ b/xnba/rebuild.sh @@ -1,10 +1,10 @@ #!/bin/bash -tar xvfj xnba-1.0.3.tar.bz2 -cd xnba-1.0.3 +tar xvf ./xnba-1.20.1.tar.bz2 +cd xnba-1.20.1 cp -rL ../debian . dpkg-buildpackage -uc -us -aamd64 cd - -rm -rf xnba-1.0.3 +rm -rf xnba-1.20.1 cp `pwd`/debian/`dh_listpackages`/tftpboot/xcat/xnba.kpxe `pwd`/binary/ cp `pwd`/debian/`dh_listpackages`/tftpboot/xcat/xnba.efi `pwd`/binary/ diff --git a/xnba/xnba-1.20.1.tar.bz2 b/xnba/xnba-1.20.1.tar.bz2 new file mode 100644 index 0000000..5d90975 Binary files /dev/null and b/xnba/xnba-1.20.1.tar.bz2 differ diff --git a/xnba/xnba-undi.spec b/xnba/xnba-undi.spec index ae710f8..1acbcc7 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: 1.20.1 +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 +Source: xnba-1.20.1.tar.bz2 +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 xnba-1.20.1 +%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