initial import
This commit is contained in:
146
ipxe/PKGBUILD
Normal file
146
ipxe/PKGBUILD
Normal file
@@ -0,0 +1,146 @@
|
||||
# Maintainer: Jesus E. <heckyel@riseup.net>
|
||||
|
||||
pkgname=ipxe
|
||||
_pkgver=1.0.0+git-20190125.36a4c85
|
||||
pkgver=1.0.0+git20190125.36a4c85
|
||||
_debver=$_pkgver
|
||||
_debrel=5.1
|
||||
pkgrel=2
|
||||
pkgdesc="iPXE free and libre boot firmware"
|
||||
arch=('i686' 'x86_64')
|
||||
url='http://www.ipxe.org/'
|
||||
license=('GPL-2')
|
||||
depends=('bash')
|
||||
makedepends=('libisoburn' 'mtools' 'syslinux' 'xz' 'quilt')
|
||||
install=$pkgname.install
|
||||
source=("${pkgname}-${_pkgver}.tar.xz::https://deb.debian.org/debian/pool/main/i/ipxe/ipxe_${_pkgver}.orig.tar.xz"
|
||||
"https://deb.debian.org/debian/pool/main/i/ipxe/ipxe_${_debver}-${_debrel}.debian.tar.xz"
|
||||
"ipxe-0002-banner.patch"
|
||||
"ipxe-0003-efi-iso.patch"
|
||||
"grub"
|
||||
"chain-default.ipxe"
|
||||
"chain-default-3928.ipxe")
|
||||
sha512sums=('8503fbc92a29a52368ac3b4dec0bc122767793a87493a83881eaf8b7e4a6dd8dd1211e354d66824e736114e90e1c26b81e89cdee3683d447071344df6ccf1e65'
|
||||
'0a62e1d3d6dade60c14e4aa1980674d69011fd42e392e8f900236608acf6c3246b8a90d21c0a11357695318477e1f34c5f2da8cce2bce881ef8f303af5399a0e'
|
||||
'6bd7041fc86308e1f9fdbfe168cdf4b5a429810739c070b4bca56855862773d72d52481bf4fd651f998c5b0988e96c3fd1bb5758cd50cd685c5fc1eddfb6e8dd'
|
||||
'2a6bf5978845e17c35fece6a626e2983c38f4b3f073f17bf7822be0aa552f4df5e42426e5358c7da4c5554a505123b696d9ab60b07cd5dc1b06e908868dd20f3'
|
||||
'4c820bf56a277cf230b2a057ddabca27578a24e6491a0616847b64852feabd48fa4f54e11c91dd79ddf9544820e21e363769c601d7fab1145036d57b9307dd26'
|
||||
'9162f528cd0080b9231785795f08d3229c52ce3c18ca5a6efcfbea5028e103a294ddef79a0f28ab64b8d0cdcb9e6cdd7fee797766ad2c3d1dbc3891ddeb4b553'
|
||||
'2208f9de509f07c0ae661ec54c8acb751c72ba7d7bb794fc6a8909118cdc06620c5423cf3ae75692af18130f641df6180839c7f09cb98c35925d7147e910d34f')
|
||||
|
||||
prepare() {
|
||||
cd $pkgname-$_pkgver/
|
||||
|
||||
if [[ ${pkgver%.*.*} = ${_debver%.*.*} ]]; then
|
||||
# Debian patches
|
||||
export QUILT_PATCHES=debian/patches
|
||||
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
|
||||
export QUILT_DIFF_ARGS='--no-timestamps'
|
||||
|
||||
mv "$srcdir"/debian .
|
||||
|
||||
quilt push -av
|
||||
fi
|
||||
|
||||
cd src/
|
||||
|
||||
# Hyperbola branding
|
||||
patch -Np2 < "${srcdir}/ipxe-0002-banner.patch"
|
||||
|
||||
# ISO image with EFI support
|
||||
patch -Np2 < "${srcdir}/ipxe-0003-efi-iso.patch"
|
||||
|
||||
# change menu colors
|
||||
sed -i "/COLOR_[A-Z]*_BG/s/COLOR_BLUE/COLOR_BLACK/" config/colour.h
|
||||
|
||||
# enable neighbour command
|
||||
sed -i "/NEIGHBOUR_CMD/c #define NEIGHBOUR_CMD" config/general.h
|
||||
|
||||
# enable ping command
|
||||
sed -i "/PING_CMD/c #define PING_CMD" config/general.h
|
||||
|
||||
# enable HTTPS
|
||||
sed -i "/DOWNLOAD_PROTO_HTTPS/c #define DOWNLOAD_PROTO_HTTPS" config/general.h
|
||||
|
||||
# enable reboot and poweroff
|
||||
sed -i -e "/REBOOT_CMD/c #define REBOOT_CMD" \
|
||||
-e "/POWEROFF_CMD/c #define POWEROFF_CMD" config/general.h
|
||||
|
||||
# disable WEP, WPA and WPA2
|
||||
sed -i -e "/CRYPTO_80211_/s/^#define/#undef/" \
|
||||
-e "/IWMGMT_CMD/c #undef IWMGMT_CMD" config/general.h
|
||||
|
||||
# Fix compatibility for x86 architectures
|
||||
sed -i 's|SIZEOF_LOW_4GB[ ][/][ ]SIZEOF_2MB_PAGE|2048|' arch/x86/transitions/librm.S
|
||||
}
|
||||
|
||||
build() {
|
||||
cd $pkgname-$_pkgver/src/
|
||||
|
||||
# default targets (ipxe.{lkrn,dsk,iso,usb}, undionly.kpxe)
|
||||
make all
|
||||
|
||||
# this includes drivers, but is bigger
|
||||
# build targets with embedded scripts first and rename
|
||||
make bin/ipxe.pxe EMBED=${srcdir}/chain-default.ipxe
|
||||
mv bin/ipxe.pxe bin/ipxe-default.pxe
|
||||
|
||||
make bin/ipxe.pxe EMBED=${srcdir}/chain-default-3928.ipxe
|
||||
mv bin/ipxe.pxe bin/ipxe-default-3928.pxe
|
||||
|
||||
make bin/ipxe.pxe
|
||||
|
||||
if [ $CARCH = x86_64 ]; then
|
||||
# EFI
|
||||
make bin-i386-efi/ipxe.efi bin-x86_64-efi/ipxe.efi
|
||||
|
||||
# ipxe.liso and ipxe.eiso
|
||||
# build after EFI!
|
||||
make bin/ipxe.liso bin/ipxe.eiso
|
||||
elif [ $CARCH = i686 ]; then
|
||||
# EFI
|
||||
make bin-i386-efi/ipxe.efi
|
||||
|
||||
# ipxe.liso
|
||||
# build after EFI!
|
||||
make bin/ipxe.liso
|
||||
fi
|
||||
}
|
||||
|
||||
package() {
|
||||
cd $pkgname-$_pkgver/
|
||||
|
||||
install -D -m0755 ${srcdir}/grub ${pkgdir}/etc/grub.d/35_ipxe
|
||||
|
||||
install -D -m0644 COPYING ${pkgdir}/usr/share/licenses/ipxe/COPYING
|
||||
install -D -m0644 COPYING.GPLv2 ${pkgdir}/usr/share/licenses/ipxe/COPYING.GPLv2
|
||||
install -D -m0644 COPYING.UBDL ${pkgdir}/usr/share/licenses/ipxe/COPYING.UBDL
|
||||
|
||||
cd src/
|
||||
|
||||
# iPXE kernel bzImage
|
||||
install -D -m0644 bin/ipxe.lkrn ${pkgdir}/usr/lib/ipxe/ipxe.lkrn
|
||||
|
||||
# default targets, legacy and EFI ISO
|
||||
install -D -m0644 bin/ipxe.dsk ${pkgdir}/usr/share/ipxe/ipxe.dsk
|
||||
install -D -m0644 bin/ipxe.usb ${pkgdir}/usr/share/ipxe/ipxe.usb
|
||||
install -D -m0644 bin/ipxe.iso ${pkgdir}/usr/share/ipxe/ipxe.iso
|
||||
install -D -m0644 bin/ipxe.liso ${pkgdir}/usr/share/ipxe/ipxe-legacy.iso
|
||||
if [ $CARCH = x86_64 ]; then
|
||||
install -D -m0644 bin/ipxe.eiso ${pkgdir}/usr/share/ipxe/ipxe-efi.iso
|
||||
fi
|
||||
|
||||
# iPXE UNDI-only targets
|
||||
install -D -m0644 bin/undionly.kpxe ${pkgdir}/usr/lib/ipxe/undi.kpxe
|
||||
|
||||
# iPXE targets with full driver support
|
||||
install -D -m0644 bin/ipxe.pxe ${pkgdir}/usr/lib/ipxe/ipxe.pxe
|
||||
install -D -m0644 bin/ipxe-default.pxe ${pkgdir}/usr/lib/ipxe/ipxe-default.pxe
|
||||
install -D -m0644 bin/ipxe-default-3928.pxe ${pkgdir}/usr/lib/ipxe/ipxe-default-3928.pxe
|
||||
|
||||
# iPXE EFI targets
|
||||
install -D -m0644 bin-i386-efi/ipxe.efi ${pkgdir}/usr/lib/ipxe/efi-i386.efi
|
||||
if [ $CARCH = x86_64 ]; then
|
||||
install -D -m0644 bin-x86_64-efi/ipxe.efi ${pkgdir}/usr/lib/ipxe/efi-x86_64.efi
|
||||
fi
|
||||
}
|
||||
6
ipxe/chain-default-3928.ipxe
Normal file
6
ipxe/chain-default-3928.ipxe
Normal file
@@ -0,0 +1,6 @@
|
||||
#!ipxe
|
||||
|
||||
set next-server-port 3928
|
||||
|
||||
dhcp &&
|
||||
chain http://${next-server}:${next-server-port}/default.ipxe
|
||||
6
ipxe/chain-default.ipxe
Normal file
6
ipxe/chain-default.ipxe
Normal file
@@ -0,0 +1,6 @@
|
||||
#!ipxe
|
||||
|
||||
set next-server-port 80
|
||||
|
||||
dhcp &&
|
||||
chain http://${next-server}:${next-server-port}/default.ipxe
|
||||
49
ipxe/grub
Normal file
49
ipxe/grub
Normal file
@@ -0,0 +1,49 @@
|
||||
#! /bin/sh -e
|
||||
########################################################
|
||||
# This script generates an iPXE entry on grub.cfg #
|
||||
# if ipxe is installed on the system. #
|
||||
########################################################
|
||||
|
||||
prefix="/usr"
|
||||
exec_prefix="${prefix}"
|
||||
|
||||
datarootdir="/usr/share"
|
||||
datadir="${datarootdir}"
|
||||
|
||||
. "${datadir}/grub/grub-mkconfig_lib"
|
||||
|
||||
IPXE_BZIMAGE="/boot/ipxe/ipxe.lkrn"
|
||||
case $(uname -m) in
|
||||
x86_64)
|
||||
IPXE_EFI="/usr/lib/ipxe/efi-x86_64.efi" ;;
|
||||
*)
|
||||
IPXE_EFI="/usr/lib/ipxe/efi-i386.efi" ;;
|
||||
esac
|
||||
EFI_MOUNT="$(lsblk -l -o 'MOUNTPOINT,PARTTYPE' -n | grep 'c12a7328-f81f-11d2-ba4b-00a0c93ec93b' | head -n1 | cut -d' ' -f1)"
|
||||
IPXE_EFI_DEST="${EFI_MOUNT}/EFI/ipxe/ipxe.efi"
|
||||
CLASS="--class ipxe --class gnu --class tool"
|
||||
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
if [ -n "${EFI_MOUNT}" ]; then
|
||||
# EFI system
|
||||
# This can chainload from EFI system partition only!
|
||||
echo "Setting up iPXE for EFI chainloading" >&2
|
||||
mkdir -p "$(dirname ${IPXE_EFI_DEST})"
|
||||
cp ${IPXE_EFI} "${IPXE_EFI_DEST}"
|
||||
echo "menuentry \"iPXE - Free Boot Firmware\" ${CLASS} {"
|
||||
prepare_grub_to_access_device $(${grub_probe} --target=device ${IPXE_EFI_DEST}) | sed -e "s/^/\t/"
|
||||
echo -e "\techo 'Loading iPXE EFI ...'"
|
||||
echo -e "\tchainloader $(make_system_path_relative_to_its_root ${IPXE_EFI_DEST})"
|
||||
echo "}"
|
||||
fi
|
||||
else
|
||||
if [ -e ${IPXE_BZIMAGE} ] && is_path_readable_by_grub ${IPXE_BZIMAGE}; then
|
||||
# image exists, create menu entry
|
||||
echo "Found iPXE bzImage: ${IPXE_BZIMAGE}" >&2
|
||||
echo "menuentry \"iPXE - Free Boot Firmware\" ${CLASS} {"
|
||||
prepare_grub_to_access_device $(${grub_probe} --target=device ${IPXE_BZIMAGE}) | sed -e "s/^/\t/"
|
||||
echo -e "\techo 'Loading iPXE ...'"
|
||||
echo -e "\tlinux16 $(make_system_path_relative_to_its_root ${IPXE_BZIMAGE})"
|
||||
echo "}"
|
||||
fi
|
||||
fi
|
||||
30
ipxe/ipxe-0002-banner.patch
Normal file
30
ipxe/ipxe-0002-banner.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c
|
||||
index 106e0f8..0a33a18 100644
|
||||
--- a/src/usr/autoboot.c
|
||||
+++ b/src/usr/autoboot.c
|
||||
@@ -70,7 +70,8 @@ static int ( * is_autoboot_device ) ( struct net_device *netdev );
|
||||
|
||||
#define NORMAL "\033[0m"
|
||||
#define BOLD "\033[1m"
|
||||
-#define CYAN "\033[36m"
|
||||
+#define BLACK "\033[1;30m"
|
||||
+#define GREY "\033[0;37m"
|
||||
|
||||
/** The "scriptlet" setting */
|
||||
const struct setting scriptlet_setting __setting ( SETTING_MISC, scriptlet ) = {
|
||||
@@ -582,9 +583,13 @@ int ipxe ( struct net_device *netdev ) {
|
||||
* do so.
|
||||
*
|
||||
*/
|
||||
- printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD PRODUCT_SHORT_NAME " %s"
|
||||
+ printf ( NORMAL "\n\n" PRODUCT_NAME "\n" BOLD PRODUCT_SHORT_NAME
|
||||
NORMAL " -- " PRODUCT_TAG_LINE " -- "
|
||||
- CYAN PRODUCT_URI NORMAL "\nFeatures:", product_version );
|
||||
+ GREY PRODUCT_URI NORMAL "\n"
|
||||
+ BOLD "Hyperbola" BLACK "GNU/Linux-libre" NORMAL " -- make it simple and lightweight -- "
|
||||
+ BOLD BLACK "https://www.hyperbola.info" NORMAL "\n"
|
||||
+ "Version %s compiled on " __DATE__ ", " __TIME__ "\n"
|
||||
+ "Features:", product_version );
|
||||
for_each_table_entry ( feature, FEATURES )
|
||||
printf ( " %s", feature->name );
|
||||
printf ( "\n" );
|
||||
121
ipxe/ipxe-0003-efi-iso.patch
Normal file
121
ipxe/ipxe-0003-efi-iso.patch
Normal file
@@ -0,0 +1,121 @@
|
||||
From 1bb5900a8aa64ae332dcd49a7ce82e43063b0244 Mon Sep 17 00:00:00 2001
|
||||
From: Christian Hesse <mail@eworm.de>
|
||||
Date: Wed, 24 Feb 2016 09:16:51 +0100
|
||||
Subject: [PATCH] allow to build ISO image with EFI support (ipxe.eiso)
|
||||
|
||||
---
|
||||
src/arch/x86/Makefile.pcbios | 7 +++++
|
||||
src/util/geniso | 52 +++++++++++++++++++++++++++---------
|
||||
2 files changed, 47 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/arch/x86/Makefile.pcbios b/src/arch/x86/Makefile.pcbios
|
||||
index c44eefc1fa..bad076298d 100644
|
||||
--- a/src/arch/x86/Makefile.pcbios
|
||||
+++ b/src/arch/x86/Makefile.pcbios
|
||||
@@ -86,6 +86,13 @@ NON_AUTO_MEDIA += iso
|
||||
$(Q)ISOLINUX_BIN=$(ISOLINUX_BIN) LDLINUX_C32=$(LDLINUX_C32) \
|
||||
VERSION="$(VERSION)" bash util/geniso -o $@ $<
|
||||
|
||||
+# rule to make a non-emulation ISO boot image with EFI support
|
||||
+NON_AUTO_MEDIA += eiso
|
||||
+%eiso: %lkrn bin-i386-efi/ipxe.efi bin-x86_64-efi/ipxe.efi util/geniso
|
||||
+ $(QM)$(ECHO) " [GENISO] $@"
|
||||
+ $(Q)ISOLINUX_BIN=$(ISOLINUX_BIN) LDLINUX_C32=$(LDLINUX_C32) \
|
||||
+ VERSION="$(VERSION)" bash util/geniso -e -o $@ $<
|
||||
+
|
||||
# rule to make a floppy emulation ISO boot image
|
||||
NON_AUTO_MEDIA += liso
|
||||
%liso: %lkrn util/geniso
|
||||
diff --git a/src/util/geniso b/src/util/geniso
|
||||
index ff090d4a08..7694036862 100755
|
||||
--- a/src/util/geniso
|
||||
+++ b/src/util/geniso
|
||||
@@ -6,16 +6,21 @@ function help() {
|
||||
echo "usage: ${0} [OPTIONS] foo.lkrn [bar.lkrn,...]"
|
||||
echo
|
||||
echo "where OPTIONS are:"
|
||||
+ echo " -e build image with EFI support"
|
||||
echo " -h show this help"
|
||||
echo " -l build legacy image with floppy emulation"
|
||||
echo " -o FILE save iso image to file"
|
||||
}
|
||||
|
||||
+EFI=0
|
||||
LEGACY=0
|
||||
FIRST=""
|
||||
|
||||
-while getopts "hlo:" opt; do
|
||||
+while getopts "ehlo:" opt; do
|
||||
case ${opt} in
|
||||
+ e)
|
||||
+ EFI=1
|
||||
+ ;;
|
||||
h)
|
||||
help
|
||||
exit 0
|
||||
@@ -37,17 +42,25 @@ if [ -z "${OUT}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
-# There should either be mkisofs or the compatible genisoimage program
|
||||
-for command in genisoimage mkisofs; do
|
||||
- if ${command} --version >/dev/null 2>/dev/null; then
|
||||
- mkisofs=(${command})
|
||||
- break
|
||||
- fi
|
||||
-done
|
||||
-
|
||||
-if [ -z "${mkisofs}" ]; then
|
||||
- echo "${0}: mkisofs or genisoimage not found, please install or set PATH" >&2
|
||||
+# We need xorriso (from libisoburn) for EFI support, so try that first.
|
||||
+if xorriso --version >/dev/null 2>/dev/null; then
|
||||
+ mkisofs=(xorriso -as mkisofs)
|
||||
+elif [ ${EFI} -eq 1 ]; then
|
||||
+ echo "${0}: xorriso not found, but required for EFI support. Please install." >&2
|
||||
exit 1
|
||||
+else
|
||||
+ # fall back to mkisofs or the compatible genisoimage program
|
||||
+ for command in genisoimage mkisofs; do
|
||||
+ if ${command} --version >/dev/null 2>/dev/null; then
|
||||
+ mkisofs=(${command})
|
||||
+ break
|
||||
+ fi
|
||||
+ done
|
||||
+
|
||||
+ if [ -z "${mkisofs}" ]; then
|
||||
+ echo "${0}: mkisofs or genisoimage not found, please install or set PATH" >&2
|
||||
+ exit 1
|
||||
+ fi
|
||||
fi
|
||||
|
||||
dir=$(mktemp -d bin/iso.dir.XXXXXX)
|
||||
@@ -122,13 +135,28 @@ case "${LEGACY}" in
|
||||
# copy isolinux bootloader
|
||||
cp ${ISOLINUX_BIN} ${dir}
|
||||
|
||||
+ mkisofs+=(-b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table)
|
||||
+
|
||||
+ if [ "${EFI}" -eq 1 ]; then
|
||||
+ # generate EFI image
|
||||
+ img=${dir}/efiboot.img
|
||||
+
|
||||
+ mformat -f 2880 -C -i ${img} ::
|
||||
+ mmd -i ${img} "::/EFI"
|
||||
+ mmd -i ${img} "::/EFI/BOOT"
|
||||
+ mcopy -m -i ${img} bin-x86_64-efi/ipxe.efi "::EFI/BOOT/BOOTX64.EFI"
|
||||
+ mcopy -m -i ${img} bin-i386-efi/ipxe.efi "::EFI/BOOT/BOOTIA32.EFI"
|
||||
+
|
||||
+ mkisofs+=(-eltorito-alt-boot -e efiboot.img -isohybrid-gpt-basdat -no-emul-boot)
|
||||
+ fi
|
||||
+
|
||||
# syslinux 6.x needs a file called ldlinux.c32
|
||||
if [ -n "${LDLINUX_C32}" -a -s "${LDLINUX_C32}" ]; then
|
||||
cp ${LDLINUX_C32} ${dir}
|
||||
fi
|
||||
|
||||
# generate the iso image
|
||||
- "${mkisofs[@]}" -b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -output ${OUT} ${dir}
|
||||
+ "${mkisofs[@]}" -output ${OUT} ${dir}
|
||||
|
||||
# isohybrid will be used if available
|
||||
if isohybrid --version >/dev/null 2>/dev/null; then
|
||||
41
ipxe/ipxe.install
Normal file
41
ipxe/ipxe.install
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
post_upgrade() {
|
||||
mkdir -p /boot/ipxe/
|
||||
cp /usr/lib/ipxe/ipxe.lkrn /boot/ipxe/ipxe.lkrn
|
||||
}
|
||||
|
||||
post_install() {
|
||||
# This text is taken from Makefile
|
||||
cat <<EOF
|
||||
> To create a bootable floppy, type
|
||||
> cat bin/ipxe.dsk > /dev/fd0
|
||||
> where /dev/fd0 is your floppy drive. This will erase any
|
||||
> data already on the disk.
|
||||
>
|
||||
> To create a bootable USB key, type
|
||||
> cat bin/ipxe.usb > /dev/sdX
|
||||
> where /dev/sdX is your USB key, and is *not* a real hard
|
||||
> disk on your system. This will erase any data already on
|
||||
> the USB key.
|
||||
>
|
||||
> To create a bootable CD-ROM, burn the ISO image
|
||||
> bin/ipxe.iso to a blank CD-ROM.
|
||||
>
|
||||
> These images contain drivers for all supported cards. You
|
||||
> can build more customised images, and ROM images, using
|
||||
> make bin/<rom-name>.<output-format>
|
||||
EOF
|
||||
|
||||
if [ -x /usr/sbin/grub-mkconfig ] && [ -s /boot/grub/grub.cfg ]; then
|
||||
echo ' >'
|
||||
echo ' > Run grub-mkconfig now for iPXE in Grub boot menu.'
|
||||
fi
|
||||
|
||||
post_upgrade
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
rm -f /boot/ipxe/ipxe.lkrn
|
||||
rmdir /boot/ipxe/
|
||||
}
|
||||
Reference in New Issue
Block a user