summaryrefslogtreecommitdiffstats
path: root/config/binary_local-hooks
diff options
context:
space:
mode:
authoranonym <anonym@riseup.net>2015-08-05 20:09:07 +0200
committeranonym <anonym@riseup.net>2015-08-05 20:09:07 +0200
commita2fd0ea3fddd79195673db01dd23f49a45ee7eb0 (patch)
treedcfb36e74ab74f40159dee038c1a83487e8b2663 /config/binary_local-hooks
parent4bf7742d903159a466b4512b23f99737c43d37d1 (diff)
parent0a4dd67c9d879895bf0ced9228d602eac4b5db61 (diff)
Merge remote-tracking branch 'origin/devel' into feature/jessie
Conflicts: features/images/I2P_router_console.png features/images/TailsInstallerNoDevice.png features/images/TorBrowserAddressBar.png features/images/USBSuggestsInstall.png features/images/UnsafeBrowserAdvancedSettings.png features/images/UnsafeBrowserEditPreferences.png features/images/UnsafeBrowserProxyRefused.png features/images/UnsafeBrowserWindow.png features/step_definitions/unsafe_browser.rb
Diffstat (limited to 'config/binary_local-hooks')
-rwxr-xr-xconfig/binary_local-hooks/40-include_syslinux_in_ISO_filesystem35
-rwxr-xr-xconfig/binary_local-hooks/50-grub-efi-ia3287
2 files changed, 94 insertions, 28 deletions
diff --git a/config/binary_local-hooks/40-include_syslinux_in_ISO_filesystem b/config/binary_local-hooks/40-include_syslinux_in_ISO_filesystem
index 4991739..37ec461 100755
--- a/config/binary_local-hooks/40-include_syslinux_in_ISO_filesystem
+++ b/config/binary_local-hooks/40-include_syslinux_in_ISO_filesystem
@@ -21,12 +21,6 @@ Set_defaults
# Seems like we'll have work to do
Echo_message 'including syslinux in the ISO filesystem'
-### Functions
-
-syslinux_deb_version_in_chroot () {
- chroot chroot dpkg-query -W -f='${Version}\n' syslinux
-}
-
### Variables
LINUX_BINARY_UTILS_DIR='binary/utils/linux'
WIN32_BINARY_UTILS_DIR='binary/utils/win32'
@@ -34,31 +28,16 @@ BINARY_MBR_DIR='binary/utils/mbr'
CHROOT_SYSLINUX_BIN='chroot/usr/bin/syslinux'
CHROOT_SYSLINUX_MBR='chroot/usr/lib/SYSLINUX/gptmbr.bin'
CHROOT_TEMP_APT_SOURCES='chroot/etc/apt/sources.list.d/tmp-deb-src.list'
-SYSLINUX_DEB_VERSION_IN_CHROOT=$(syslinux_deb_version_in_chroot)
+
+### Functions
+
+syslinux_deb_version_in_chroot () {
+ chroot chroot dpkg-query -W -f='${Version}\n' syslinux
+}
### Main
mkdir -p "$LINUX_BINARY_UTILS_DIR" "$WIN32_BINARY_UTILS_DIR" "$BINARY_MBR_DIR"
-
-# Copy 32-bit syslinux binary
cp "$CHROOT_SYSLINUX_BIN" "$LINUX_BINARY_UTILS_DIR/"
-
-# Copy 64-bit syslinux binary
-(
- olddir=$(pwd)
- workdir=$(mktemp -d)
- cd "$workdir"
- chroot="$olddir/chroot"
- Chroot "$chroot" \
- apt-get --yes download \
- syslinux:amd64="$SYSLINUX_DEB_VERSION_IN_CHROOT"
- dpkg-deb --extract "$chroot"/syslinux_*.deb .
- rm "$chroot"/syslinux_*.deb
- cp ./usr/bin/syslinux "$olddir/$LINUX_BINARY_UTILS_DIR/syslinux-amd64"
- cd "$olddir"
- rm -r "$workdir"
-)
-
-# Copy syslinux MBR
cp "$CHROOT_SYSLINUX_MBR" "$BINARY_MBR_DIR/mbr.bin"
cat chroot/etc/apt/sources.list chroot/etc/apt/sources.list.d/*.list \
@@ -68,7 +47,7 @@ cat chroot/etc/apt/sources.list chroot/etc/apt/sources.list.d/*.list \
> "$CHROOT_TEMP_APT_SOURCES"
Chroot chroot apt-get --yes update
Chroot chroot apt-get --yes install dpkg-dev
-Chroot chroot apt-get source syslinux="$SYSLINUX_DEB_VERSION_IN_CHROOT"
+Chroot chroot apt-get source syslinux="$(syslinux_deb_version_in_chroot)"
cp chroot/syslinux-*/bios/win32/syslinux.exe "$WIN32_BINARY_UTILS_DIR/"
rm -r chroot/syslinux*
rm "$CHROOT_TEMP_APT_SOURCES"
diff --git a/config/binary_local-hooks/50-grub-efi-ia32 b/config/binary_local-hooks/50-grub-efi-ia32
new file mode 100755
index 0000000..23c32cc
--- /dev/null
+++ b/config/binary_local-hooks/50-grub-efi-ia32
@@ -0,0 +1,87 @@
+#! /bin/sh
+
+# Some of this file was adapted from the Debian Installer's
+# build/util/efi-image, which is:
+#
+# Copyright (C) 2010, 2011 Canonical Ltd.
+# Author: Colin Watson <cjwatson@ubuntu.com>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any later
+# version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+set -e
+set -x
+
+platform="i386-efi"
+outdir="binary/EFI/BOOT/grub/$platform"
+efi_name="ia32"
+
+grub_cpmodules () {
+ if [ -z "$1" ] || [ -z "$2" ]; then
+ echo "usage: $0 OUTPUT-DIRECTORY GRUB-PLATFORM"
+ return 1
+ fi
+
+ outdir="$1"
+ platform="$2"
+
+ # Copy over GRUB modules, except for those already built in.
+ cp -a "chroot/usr/lib/grub/$platform"/*.lst "$outdir/"
+ for x in "chroot/usr/lib/grub/$platform"/*.mod; do
+ # Some of these exclusions are based on knowledge of module
+ # dependencies.
+ case $(basename "$x" .mod) in
+ configfile|search|search_fs_file|search_fs_uuid|search_label|tar|part_gpt|linux|gzio)
+ # included in boot image
+ ;;
+ affs|afs|afs_be|befs|befs_be|minix|nilfs2|sfs|zfs|zfsinfo)
+ # unnecessary filesystem modules
+ ;;
+ example_functional_test|functional_test|hello)
+ # other cruft
+ ;;
+ *)
+ cp -a "$x" "$outdir/"
+ ;;
+ esac
+ done
+}
+
+# Including common functions
+. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh
+
+# Setting static variables
+DESCRIPTION="$(Echo 'including GRUB EFI for ia32 in the ISO filesystem')"
+HELP=""
+USAGE="${PROGRAM}"
+
+# Reading configuration files
+Read_conffiles config/all config/bootstrap config/common config/binary
+Set_defaults
+
+# Safeguards
+[ "${LB_ARCHITECTURE}" = "i386" ] || exit 0
+
+# Seems like we'll have work to do
+Echo_message 'including GRUB EFI for ia32 in the ISO filesystem'
+
+# Build the core image
+Chroot chroot grub-mkimage -O "$platform" \
+ -o "/tmp/boot$efi_name.efi" -p "/efi/boot/grub" \
+ search configfile normal tar fat part_gpt linux \
+ gzio
+mv "chroot/tmp/boot$efi_name.efi" "binary/EFI/BOOT/boot$efi_name.efi"
+
+mkdir -p "$outdir"
+grub_cpmodules "$outdir" "$platform"