Skip to content

Commit

Permalink
Merge pull request #13123 from klaases/boot1
Browse files Browse the repository at this point in the history
Bootloader ISO EFI Support
  • Loading branch information
sharifelgamal authored Dec 23, 2021
2 parents ce3014a + 036b537 commit cab934e
Show file tree
Hide file tree
Showing 12 changed files with 133 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ KUBERNETES_VERSION ?= $(shell egrep "DefaultKubernetesVersion =" pkg/minikube/co
KIC_VERSION ?= $(shell egrep "Version =" pkg/drivers/kic/types.go | cut -d \" -f2)

# Default to .0 for higher cache hit rates, as build increments typically don't require new ISO versions
ISO_VERSION ?= v1.24.0-1639505700-12892
ISO_VERSION ?= v1.24.0-1640194376-13123
# Dashes are valid in semver, but not Linux packaging. Use ~ to delimit alpha/beta
DEB_VERSION ?= $(subst -,~,$(RAW_VERSION))
DEB_REVISION ?= 0
Expand Down
1 change: 1 addition & 0 deletions deploy/iso/minikube-iso/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ RUN apt-get update \
dumb-init \
golang-go \
libpcre3-dev \
mkisofs \
&& rm -rf /var/lib/apt/lists/*

RUN localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
Expand Down
12 changes: 12 additions & 0 deletions deploy/iso/minikube-iso/board/iso/x86_64/genimage.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
image efiboot.img {
vfat {
label = "EFIBOOTISO"
file startup.nsh {
image = "efi-part/startup.nsh"
}
file EFI {
image = "efi-part/EFI"
}
}
size = 1474560
}
4 changes: 4 additions & 0 deletions deploy/iso/minikube-iso/board/iso/x86_64/grub-stub.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
insmod iso9660
insmod udf

search --no-floppy --label EFIBOOTISO --set root
7 changes: 7 additions & 0 deletions deploy/iso/minikube-iso/board/iso/x86_64/grub.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set default="0"
set timeout="5"

menuentry "Buildroot" {
linux /boot/vmlinuz console=tty0 rw
initrd /boot/initrd.img
}
21 changes: 21 additions & 0 deletions deploy/iso/minikube-iso/board/iso/x86_64/post-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

# Copyright 2021 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

BOARD_DIR=$(dirname "$0")

cp -f "$BOARD_DIR/grub.cfg" "$BINARIES_DIR/efi-part/EFI/BOOT/grub.cfg"
41 changes: 41 additions & 0 deletions deploy/iso/minikube-iso/board/iso/x86_64/post-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh

# Copyright 2021 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

GENIMAGE_CFG="$2"

support/scripts/genimage.sh -c "$GENIMAGE_CFG"

cd "$BINARIES_DIR"
mkdir -p root/boot
cp bzImage root/boot/vmlinuz
cp rootfs.cpio.gz root/boot/initrd.img
mkdir -p root/EFI/BOOT
cp efi-part/EFI/BOOT/* root/EFI/BOOT/
cp efiboot.img root/EFI/BOOT/

mkisofs \
-o boot.iso \
-R -J -v -d -N \
-hide-rr-moved \
-no-emul-boot \
-eltorito-platform=efi \
-eltorito-boot EFI/BOOT/efiboot.img \
-V "EFIBOOTISO" \
-A "EFI Boot ISO" \
root
cd -
48 changes: 42 additions & 6 deletions deploy/iso/minikube-iso/configs/minikube_defconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@
# Architecture
BR2_x86_64=y

# Toolchain
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y

# System
BR2_SYSTEM_DHCP="eth0"

# Required tools to create bootable media
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y

# Bootloader
BR2_TARGET_GRUB2=y
BR2_TARGET_GRUB2_X86_64_EFI=y
BR2_TARGET_GRUB2_BUILTIN_CONFIG="$(BR2_EXTERNAL_MINIKUBE_PATH)/board/iso/x86_64/grub-stub.cfg"
BR2_TARGET_GRUB2_BUILTIN_MODULES="boot linux ext2 fat squash4 part_msdos part_gpt normal efi_gop udf iso9660 search search_fs_file search_fs_uuid search_label"

# Filesystem / image
BR2_TARGET_ROOTFS_CPIO=y
BR2_TARGET_ROOTFS_CPIO_GZIP=y
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_MINIKUBE_PATH)/board/iso/x86_64/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_MINIKUBE_PATH)/board/iso/x86_64/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_MINIKUBE_PATH)/board/iso/x86_64/genimage.cfg"

# Linux headers same as kernel, a 4.19 series
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y

# Kernel
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.202"
BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y

BR2_CCACHE=y

# Packages
BR2_PACKAGE_ACPID=y

# Minikube

BR2_OPTIMIZE_2=y
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_MINIKUBE_PATH)/board/coreos/minikube/patches"
BR2_TOOLCHAIN_BUILDROOT_VENDOR="minikube"
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_19=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_GCC_ENABLE_LTO=y
BR2_TARGET_GENERIC_HOSTNAME="minikube"
Expand All @@ -13,12 +54,8 @@ BR2_TARGET_GENERIC_PASSWD_SHA512=y
BR2_INIT_SYSTEMD=y
BR2_ROOTFS_DEVICE_TABLE="$(BR2_EXTERNAL_MINIKUBE_PATH)/board/coreos/minikube/permissions"
BR2_SYSTEM_BIN_SH_BASH=y
# BR2_TARGET_GENERIC_GETTY is not set
BR2_ROOTFS_USERS_TABLES="$(BR2_EXTERNAL_MINIKUBE_PATH)/board/coreos/minikube/users"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_MINIKUBE_PATH)/board/coreos/minikube/rootfs-overlay"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.19.202"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_MINIKUBE_PATH)/board/coreos/minikube/linux_defconfig"
BR2_LINUX_KERNEL_LZ4=y
Expand Down Expand Up @@ -65,7 +102,6 @@ BR2_PACKAGE_UTIL_LINUX_LOSETUP=y
BR2_PACKAGE_UTIL_LINUX_NOLOGIN=y
BR2_PACKAGE_UTIL_LINUX_NSENTER=y
BR2_PACKAGE_UTIL_LINUX_SCHEDUTILS=y
BR2_TARGET_ROOTFS_CPIO_GZIP=y
BR2_TARGET_ROOTFS_ISO9660=y
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="$(BR2_EXTERNAL_MINIKUBE_PATH)/board/coreos/minikube/isolinux.cfg"
BR2_TARGET_SYSLINUX=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ sha256 bc6d9452c700af0ebc09c0da8ddba55be4c03ac8928e72ca92d98905800c8018 v1.4.3.t
sha256 ac62c64664bf62fd44df0891c896eecdb6d93def3438271d7892dca75bc069d1 v1.4.4.tar.gz
sha256 285a3f4c00a87538bd7d0a82a0a8a758458c02b925349f44f3189f480c326038 v1.4.6.tar.gz
sha256 3bb9f54be022067847f5930d21ebbfe4e7a67f589d78930aa0ac713492c28bcc v1.4.9.tar.gz
sha256 0890f7b0ee8e20a279a617c60686874b3c7a99e064adb2b38d884499b5284c43 v1.5.8.tar.gz
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# containerd
#
################################################################################
CONTAINERD_BIN_VERSION = v1.5.8
CONTAINERD_BIN_COMMIT = 1e5ef943eb76627a6d3b6de8cd1ef6537f393a71
CONTAINERD_BIN_VERSION = v1.4.9
CONTAINERD_BIN_COMMIT = e25210fe30a0a703442421b0f60afac609f950a3
CONTAINERD_BIN_SITE = /~https://github.com/containerd/containerd/archive
CONTAINERD_BIN_SOURCE = $(CONTAINERD_BIN_VERSION).tar.gz
CONTAINERD_BIN_DEPENDENCIES = host-go libgpgme
Expand Down
2 changes: 1 addition & 1 deletion pkg/drivers/hyperkit/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ func (d *Driver) extractKernel(isoPath string) error {
}{
{"/boot/bzimage", "bzimage"},
{"/boot/initrd", "initrd"},
{"/isolinux/isolinux.cfg", "isolinux.cfg"},
{"/grub/grub.cfg", "grub.cfg"},
} {
fullDestPath := d.ResolveStorePath(f.destPath)
if err := ExtractFile(isoPath, f.pathInIso, fullDestPath); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/minikube/download/iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const fileScheme = "file"
// DefaultISOURLs returns a list of ISO URL's to consult by default, in priority order
func DefaultISOURLs() []string {
v := version.GetISOVersion()
isoBucket := "minikube-builds/iso/12892"
isoBucket := "minikube-builds/iso/13123"
return []string{
fmt.Sprintf("https://storage.googleapis.com/%s/minikube-%s.iso", isoBucket, v),
fmt.Sprintf("/~https://github.com/kubernetes/minikube/releases/download/%s/minikube-%s.iso", v, v),
Expand Down

0 comments on commit cab934e

Please sign in to comment.