Update to iPXE version to 1.21.1

- Build additional artifacts - ISO, UEFI, etc.
- Set default timeout on shell to fallthrough on failures
- Add ping command (enabling patch renamed to be more generic)
- Update build container to Debian 11
- Add VERSION file

Change-Id: I9476c1d6446f6943dcd084384ba2ae3d96f71128
diff --git a/Dockerfile b/Dockerfile
index 7bd7f6d..65e1d75 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,7 +3,7 @@
 # SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
 # SPDX-License-Identifier: Apache-2.0
 
-FROM debian:10.6
+FROM debian:11
 
 # Install Build packages
 RUN apt-get -y update \
diff --git a/Makefile b/Makefile
index 759d9ac..60b38d6 100644
--- a/Makefile
+++ b/Makefile
@@ -6,14 +6,19 @@
 SHELL = bash -eu -o pipefail
 
 # iPXE configuration
-IPXE_VERSION ?= v1.20.1
-TARGETS      ?= bin/undionly.kpxe bin/ipxe.usb
-OPTIONS      ?= EMBED=chain.ipxe
-COPY_FILES   ?= chain.ipxe
+IPXE_VERSION  ?= v1.21.1
+TARGETS       ?= bin/undionly.kpxe bin/ipxe.usb bin/ipxe.iso bin/ipxe.pdsk
+TARGETS_EFI32 ?= bin-i386-efi/ipxe.usb
+TARGETS_EFI64 ?= bin-x86_64-efi/ipxe.usb
+OPTIONS       ?= EMBED=chain.ipxe
+COPY_FILES    ?= chain.ipxe
 
 # Build configuration
-OUTDIR       ?= $(shell pwd)/out
-BUILDER      := ipxebuilder-$(shell date +"%Y%m%d%H%M%S")# timestamp for each run
+OUTDIR        ?= $(shell pwd)/out
+BUILDER       := ipxebuilder-$(shell date +"%Y%m%d%H%M%S")# timestamp for each run
+
+# print help by default
+.DEFAULT_GOAL := help
 
 # phony (doesn't make files) targets
 .PHONY: base image clean clean-all license help
@@ -27,16 +32,18 @@
 out:
 	mkdir -p out
 
-base: | ipxe  ## create bas iPXE build container using Docker
+base: | ipxe  ## create base iPXE build container using Docker
 	docker build . -t ipxe-builder:$(IPXE_VERSION)
 
-image: | out base  ## create iPXE binary artifacts using Docker
+image: | out base  ## create iPXE binaries using Docker
 	docker run -v $(OUTDIR):/tmp/out --name $(BUILDER) -d ipxe-builder:$(IPXE_VERSION)
 	for file in $(COPY_FILES); do \
     docker cp $$file $(BUILDER):/ipxe/src/ ;\
   done
 	docker exec -w /ipxe/src $(BUILDER) \
-    bash -c "make -j4 $(TARGETS) $(OPTIONS); cp $(TARGETS) /tmp/out"
+    bash -c "make -j4 $(TARGETS) $(OPTIONS); cp $(TARGETS) /tmp/out; \
+		         make -j4 $(TARGETS_EFI32) $(OPTIONS); cp $(TARGETS_EFI32) /tmp/out/ipxe_efi32.usb; \
+		         make -j4 $(TARGETS_EFI64) $(OPTIONS); cp $(TARGETS_EFI64) /tmp/out/ipxe_efi64.usb"
 	docker rm --force $(BUILDER)
 
 test: image  ## test (currently only runs an image build)
@@ -54,5 +61,5 @@
 help: ## Print help for each target
 	@echo infra-playbooks make targets
 	@echo
-	@grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \
+	@grep '^[[:alnum:]_-]*:.* ## ' $(MAKEFILE_LIST) \
     | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};'
diff --git a/README.md b/README.md
index f8f8cf6..a1ed9ba 100644
--- a/README.md
+++ b/README.md
@@ -5,8 +5,7 @@
 # iPXE Build
 
 This repo will builds an [iPXE](https://ipxe.org/) payload that can be used for
-network booting of systems.
-
+network booting of computer systems.
 
 Docker is used to build iPXE, wrapping [all build
 dependencies](https://ipxe.org/download#source_code) in the Dockerfile, An
@@ -29,8 +28,13 @@
 
 - `undionly.kxpe` - Can be served by a DHCP server and chainloads with the
   NIC's built in PXE and network driver implementation
+
 - `ipxe.usb` - write to a USB stick with `dd if=bin/ipxe.usb of=/dev/<rawdevice>`
 
+- `ipxe.pdisk` - padded to floppy size, useful for some LOM implementations
+
+- `ipxe.iso` - ISO image for writing to optical discs, and some other tools.
+
 See also [build targets](https://ipxe.org/appnote/buildtargets).
 
 ## Mutual TLS
@@ -55,6 +59,7 @@
 
 2. Build the artifacts incorporating all these files using Makefile options:
 
-    make COPY_FILES="chain.ipxe ca.pem client.pem client.key" OPTIONS="EMBED=chain.ipxe CERT=ca.pem,client.pem TRUST=onfca.pem
-PRIVKEY=client.key"
+    make COPY_FILES="chain.ipxe onfca.pem client.pem client.key" \
+      OPTIONS="EMBED=chain.ipxe CERT=onfca.pem,client.pem TRUST=onfca.pem PRIVKEY=client.key" \
+      image
 
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..4259c64
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+0.5.0-dev
diff --git a/chain.ipxe b/chain.ipxe
index 3d2b840..ebd30fc 100644
--- a/chain.ipxe
+++ b/chain.ipxe
@@ -2,8 +2,16 @@
 # SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org>
 # SPDX-License-Identifier: Apache-2.0
 
-# autoconfigure self via DHCP
-dhcp
+# autoconfigure interface, or optionaly drop to shell
+ifconf || goto optional_shell
 
-# chainload netboot.ipxe, or drop to shell if it doesn't exist
-chain https://boot.tucson.onlab.us:2443/boot.ipxe || shell
+# display network settings before chainloading
+ifstat
+route
+
+# chainload netboot.ipxe, or continue if not available
+chain http://webserver/boot.ipxe || goto optional_shell
+
+# if unable to chainload, wait 10 seconds for command entry, or exit iPXE and continue boot
+:optional_shell
+prompt --timeout 10000 Press any key for iPXE command line... && shell || exit
diff --git a/patches/features.patch b/patches/features.patch
new file mode 100644
index 0000000..62702f9
--- /dev/null
+++ b/patches/features.patch
@@ -0,0 +1,22 @@
+diff --git a/src/config/general.h b/src/config/general.h
+index 0c99bcbb..04ced76c 100644
+--- a/src/config/general.h
++++ b/src/config/general.h
+@@ -54,7 +54,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+ #define	DOWNLOAD_PROTO_TFTP	/* Trivial File Transfer Protocol */
+ #define	DOWNLOAD_PROTO_HTTP	/* Hypertext Transfer Protocol */
+-#undef	DOWNLOAD_PROTO_HTTPS	/* Secure Hypertext Transfer Protocol */
++#define	DOWNLOAD_PROTO_HTTPS	/* Secure Hypertext Transfer Protocol */
+ #undef	DOWNLOAD_PROTO_FTP	/* File Transfer Protocol */
+ #undef	DOWNLOAD_PROTO_SLAM	/* Scalable Local Area Multicast */
+ #undef	DOWNLOAD_PROTO_NFS	/* Network File System Protocol */
+@@ -148,7 +148,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+ //#define PCI_CMD		/* PCI commands */
+ //#define PARAM_CMD		/* Form parameter commands */
+ //#define NEIGHBOUR_CMD		/* Neighbour management commands */
+-//#define PING_CMD		/* Ping command */
++#define PING_CMD		/* Ping command */
+ //#define CONSOLE_CMD		/* Console command */
+ //#define IPSTAT_CMD		/* IP statistics commands */
+ //#define PROFSTAT_CMD		/* Profiling commands */
diff --git a/patches/https.patch b/patches/https.patch
deleted file mode 100644
index f339c9a..0000000
--- a/patches/https.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/src/config/general.h b/src/config/general.h
-index 3c14a2cd..8867f152 100644
---- a/src/config/general.h
-+++ b/src/config/general.h
-@@ -54,7 +54,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
- 
- #define	DOWNLOAD_PROTO_TFTP	/* Trivial File Transfer Protocol */
- #define	DOWNLOAD_PROTO_HTTP	/* Hypertext Transfer Protocol */
--#undef	DOWNLOAD_PROTO_HTTPS	/* Secure Hypertext Transfer Protocol */
-+#define DOWNLOAD_PROTO_HTTPS	/* Secure Hypertext Transfer Protocol */
- #undef	DOWNLOAD_PROTO_FTP	/* File Transfer Protocol */
- #undef	DOWNLOAD_PROTO_SLAM	/* Scalable Local Area Multicast */
- #undef	DOWNLOAD_PROTO_NFS	/* Network File System Protocol */