2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2024-11-27 03:39:11 +00:00

Merge pull request #41 from xcat2/xnba

Build new xnba-undi package based on ipxe version 1.20.1
This commit is contained in:
besawn 2021-01-29 16:59:28 -05:00 committed by GitHub
commit 3257cb339a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 112 additions and 176 deletions

View File

@ -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

Binary file not shown.

Binary file not shown.

View File

@ -1,3 +1,9 @@
xnba-undi (1.20.1-0) unstable; urgency=low
* Debian build for xnba-undi version 1.20.1
-- Casandra Qiu <cxhong@us.ibm.com> Mon, 16 Nov 2020 15:49:48 +0800
xnba-undi (1.0.3-7) unstable; urgency=low
* Initial Debian build

View File

@ -3,7 +3,7 @@ Section: admin
Priority: extra
Maintainer: xCAT <xcat-user@lists.sourceforge.net>
Build-Depends: debhelper (>= 7.0.50~)
Standards-Version: 1.0.3
Standards-Version: 1.20.1
#Homepage: <insert the upstream URL, if relevant>
#Vcs-Git: git://git.debian.org/collab-maint/gpxe.git
#Vcs-Browser: http://git.debian.org/?p=collab-maint/gpxe.git;a=summary

View File

@ -1 +1 @@
xnba-undi_1.0.3-7_amd64.deb admin extra
xnba-undi_1.20.1-0_amd64.deb admin extra

View File

@ -0,0 +1 @@
../../ipxe-branding.patch

View File

@ -0,0 +1 @@
../../ipxe-dhcp.patch

View File

@ -0,0 +1 @@
../../ipxe-machyp.patch

View File

@ -0,0 +1 @@
../../ipxe-xnbaclass.patch

View File

@ -0,0 +1,4 @@
ipxe-branding.patch
ipxe-xnbaclass.patch
ipxe-machyp.patch
ipxe-dhcp.patch

View File

@ -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/<packagename>
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

View File

@ -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

View File

@ -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 */

18
xnba/ipxe-dhcp.patch Normal file
View File

@ -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 */

View File

@ -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 },

View File

@ -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,

View File

@ -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/

BIN
xnba/xnba-1.20.1.tar.bz2 Normal file

Binary file not shown.

View File

@ -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