source: grub-pc/trunk/fuentes/debian/build-efi-images @ 22

Last change on this file since 22 was 22, checked in by mabarracus, 4 years ago

updated version and apply net.ifnames=0 into debian/rules

  • Property svn:executable set to *
File size: 3.2 KB
Line 
1#! /bin/sh
2set -e
3
4# Copyright (C) 2010, 2011, 2012 Canonical Ltd.
5# Author: Colin Watson <cjwatson@ubuntu.com>
6#
7# This program is free software; you can redistribute it and/or modify it
8# under the terms of the GNU General Public License as published by the Free
9# Software Foundation; either version 2, or (at your option) any later
10# version.
11#
12# This program is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15# for more details.
16#
17# You should have received a copy of the GNU General Public License along
18# with this program; if not, write to the Free Software Foundation, Inc.,
19# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20
21# Make EFI boot images for signing.
22
23if [ $# -lt 5 ]; then
24        echo "usage: $0 GRUB-MKIMAGE GRUB-CORE OUTPUT-DIRECTORY PLATFORM EFI-NAME"
25fi
26
27grub_mkimage="$1"
28grub_core="$2"
29outdir="$3"
30platform="$4"
31efi_name="$5"
32
33workdir=
34
35cleanup () {
36        [ -z "$workdir" ] || rm -rf "$workdir"
37}
38trap cleanup EXIT HUP INT QUIT TERM
39
40rm -rf "$outdir"
41mkdir -p "$outdir"
42
43workdir="$(mktemp -d build-efi-images.XXXXXX)"
44
45# GRUB's rescue parser doesn't understand 'if'.
46echo 'normal (memdisk)/grub.cfg' >"$workdir/grub-bootstrap.cfg"
47
48# Skeleton configuration file which finds the real boot disk.
49cat >"$workdir/grub.cfg" <<EOF
50if [ -z "\$prefix" -o ! -e "\$prefix" ]; then
51        if ! search --file --set=root /.disk/info; then
52                search --file --set=root /.disk/mini-info
53        fi
54        set prefix=(\$root)/boot/grub
55fi
56if [ -e \$prefix/$platform/grub.cfg ]; then
57        source \$prefix/$platform/grub.cfg
58elif [ -e \$prefix/grub.cfg ]; then
59        source \$prefix/grub.cfg
60else
61        source \$cmdpath/grub.cfg
62fi
63EOF
64
65cat >"$workdir/grub-netboot.cfg" <<EOF
66if [ -e \$prefix/$platform/grub.cfg ]; then
67        source \$prefix/$platform/grub.cfg
68else
69        source \$prefix/grub.cfg
70fi
71EOF
72
73mkfs.msdos -C "$workdir/memdisk.fat" 64
74mcopy -i "$workdir/memdisk.fat" "$workdir/grub.cfg" ::grub.cfg
75
76mkfs.msdos -C "$workdir/memdisk-netboot.fat" 64
77mcopy -i "$workdir/memdisk-netboot.fat" "$workdir/grub-netboot.cfg" ::grub.cfg
78
79CD_MODULES="
80        all_video
81        boot
82        btrfs
83        cat
84        chain
85        configfile
86        echo
87        efifwsetup
88        efinet
89        ext2
90        fat
91        font
92        gettext
93        gfxmenu
94        gfxterm
95        gfxterm_background
96        gzio
97        halt
98        hfsplus
99        iso9660
100        jpeg
101        keystatus
102        loadenv
103        linux
104        lsefi
105        lsefimmap
106        lsefisystab
107        lssal
108        memdisk
109        minicmd
110        normal
111        part_apple
112        part_msdos
113        part_gpt
114        password_pbkdf2
115        png
116        reboot
117        search
118        search_fs_uuid
119        search_fs_file
120        search_label
121        sleep
122        test
123        true
124        video
125        "
126
127# Platform-specific modules
128case $platform in
129    x86_64-efi)
130        CD_MODULES="$CD_MODULES
131        linuxefi
132        "
133        ;;
134esac
135
136GRUB_MODULES="$CD_MODULES
137        lvm
138        mdraid09
139        mdraid1x
140        raid5rec
141        raid6rec
142        "
143NET_MODULES="$CD_MODULES
144        tftp
145        "
146
147"$grub_mkimage" -O "$platform" -o "$outdir/gcd$efi_name.efi" \
148        -d "$grub_core" \
149        -c "$workdir/grub-bootstrap.cfg" -m "$workdir/memdisk.fat" \
150        -p /boot/grub \
151        $CD_MODULES
152"$grub_mkimage" -O "$platform" -o "$outdir/grub$efi_name.efi" \
153        -d "$grub_core" -p /EFI/ubuntu $GRUB_MODULES
154"$grub_mkimage" -O "$platform" -o "$outdir/grubnet$efi_name.efi" \
155        -d "$grub_core" -c "$workdir/grub-bootstrap.cfg" \
156        -m "$workdir/memdisk-netboot.fat" -p /grub $NET_MODULES
157
158exit 0
Note: See TracBrowser for help on using the repository browser.