]>
Commit | Line | Data |
---|---|---|
fc2208b0 RM |
1 | |
2 | # Make GRUB rescue image | |
8c411768 | 3 | # Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc. |
fc2208b0 RM |
4 | # |
5 | # GRUB is free software: you can redistribute it and/or modify | |
6 | # it under the terms of the GNU General Public License as published by | |
7 | # the Free Software Foundation, either version 3 of the License, or | |
8 | # (at your option) any later version. | |
9 | # | |
10 | # GRUB is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | # GNU General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with GRUB. If not, see <http://www.gnu.org/licenses/>. | |
17 | ||
18 | # Initialize some variables. | |
48b391e9 | 19 | |
48b391e9 VS |
20 | prefix="@prefix@" |
21 | exec_prefix="@exec_prefix@" | |
22 | datarootdir="@datarootdir@" | |
23 | bindir="@bindir@" | |
24 | libdir="@libdir@" | |
fc2208b0 RM |
25 | PACKAGE_NAME=@PACKAGE_NAME@ |
26 | PACKAGE_TARNAME=@PACKAGE_TARNAME@ | |
27 | PACKAGE_VERSION=@PACKAGE_VERSION@ | |
a32d5c71 | 28 | datadir="@datadir@" |
c8d9ead6 | 29 | if [ "x$pkgdatadir" = x ]; then |
2311c5ca | 30 | pkgdatadir="${datadir}/@PACKAGE@" |
c8d9ead6 | 31 | fi |
8c411768 | 32 | pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst" |
fc2208b0 | 33 | |
0ea7c4f9 GS |
34 | self=`basename $0` |
35 | ||
2311c5ca VS |
36 | multiboot_dir="${libdir}/@PACKAGE@/i386-multiboot" |
37 | coreboot_dir="${libdir}/@PACKAGE@/i386-coreboot" | |
38 | qemu_dir="${libdir}/@PACKAGE@/i386-qemu" | |
070038f8 | 39 | mipsel_qemu_dir="${libdir}/@PACKAGE@/mipsel-qemu_mips" |
3f2bdd8f | 40 | loongson_dir="${libdir}/@PACKAGE@/mipsel-loongson" |
070038f8 | 41 | mips_qemu_dir="${libdir}/@PACKAGE@/mips-qemu_mips" |
2311c5ca | 42 | pc_dir="${libdir}/@PACKAGE@/i386-pc" |
dbc56d8f | 43 | i386_ieee1275_dir="${libdir}/@PACKAGE@/i386-ieee1275" |
2311c5ca VS |
44 | efi32_dir="${libdir}/@PACKAGE@/i386-efi" |
45 | efi64_dir="${libdir}/@PACKAGE@/x86_64-efi" | |
070038f8 | 46 | ia64_dir="${libdir}/@PACKAGE@/ia64-efi" |
a79b8a15 | 47 | ppc_dir="${libdir}/@PACKAGE@/powerpc-ieee1275" |
7e70395f | 48 | rom_directory= |
d1d368e4 | 49 | override_dir= |
fd49ceb3 | 50 | grub_mkimage="${bindir}/@grub_mkimage@" |
a79b8a15 | 51 | grub_render_label="${bindir}/@grub_render_label@" |
67ab8353 | 52 | grub_glue_efi="${bindir}/@grub_glue_efi@" |
a79b8a15 VS |
53 | label_font="${pkgdatadir}/unicode.pf2" |
54 | label_color="black" | |
55 | label_bgcolor="white" | |
56 | product_name="${PACKAGE_NAME}" | |
57 | product_version="${PACKAGE_VERSION}" | |
fc2208b0 | 58 | |
a6085973 TS |
59 | xorriso=xorriso |
60 | ||
9cc3ee5c VS |
61 | export TEXTDOMAIN=@PACKAGE@ |
62 | export TEXTDOMAINDIR="@localedir@" | |
63 | ||
a20f6ad0 VS |
64 | localedir="@datadir@/locale" |
65 | ||
c8d9ead6 | 66 | . "${pkgdatadir}/grub-mkconfig_lib" |
a32d5c71 | 67 | |
fc2208b0 RM |
68 | # Usage: usage |
69 | # Print the usage. | |
70 | usage () { | |
a32d5c71 | 71 | gettext_printf "Usage: %s [OPTION] SOURCE...\n" "$self" |
e7d2559b | 72 | # TRANSLATORS: it generates one single image which is bootable through any method. |
67093bc0 | 73 | gettext "Make GRUB CD-ROM, disk, pendrive and floppy bootable image."; echo |
a32d5c71 | 74 | echo |
e7d2559b | 75 | filetrans="$(gettext FILE)" |
9f9d3f69 VS |
76 | print_option_help "-h, --help" "$(gettext "print this message and exit")" |
77 | print_option_help "-v, --version" "$(gettext "print the version information and exit")" | |
78 | print_option_help "-o, --output=$filetrans" "$(gettext "save output in FILE [required]")" | |
79 | print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")" | |
aa428238 VS |
80 | grub_print_install_files_help |
81 | print_option_help "--install-modules=$(gettext "MODULES")" "$(gettext "install only MODULES and their dependencies on bootable media")" | |
9f9d3f69 | 82 | print_option_help "--rom-directory=$(gettext "DIR")" "$(gettext "save ROM images in DIR [optional]")" |
e7d2559b | 83 | # TRANSLATORS: xorriso is a program for creating ISOs and burning CDs |
9f9d3f69 VS |
84 | print_option_help "--xorriso=$filetrans" "$(gettext "use FILE as xorriso [optional]")" |
85 | print_option_help "--grub-mkimage=$filetrans" "$(gettext "use FILE as grub-mkimage")" | |
67ab8353 | 86 | print_option_help "--grub-glue-efi=$filetrans" "$(gettext "use FILE as grub-glue-efi")" |
a79b8a15 VS |
87 | print_option_help "--grub-render-label=$filetrans" "$(gettext "use FILE as grub-render-label")" |
88 | print_option_help "--label-font=$filetrans" "$(gettext "use FILE as font for label")" | |
89 | print_option_help "--label-color=$(gettext "COLOR")" "$(gettext "use COLOR for label")" | |
90 | print_option_help "--label-bgcolor=$(gettext "COLOR")" "$(gettext "use COLOR for label background")" | |
91 | print_option_help "--product-name=$(gettext "STR")" "$(gettext "use STR as product")" | |
92 | print_option_help "--product-version=$(gettext "STR")" "$(gettext "use STR as product version")" | |
a32d5c71 | 93 | echo |
9f9d3f69 | 94 | gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "xorriso -as mkisofs -help" "$self" | grub_fmt |
a32d5c71 VS |
95 | echo |
96 | gettext "Option -- switches to native xorriso command mode."; echo | |
97 | echo | |
98 | gettext "Report bugs to <bug-grub@gnu.org>."; echo | |
99 | gettext "Mail xorriso support requests to <bug-xorriso@gnu.org>."; echo | |
fc2208b0 RM |
100 | } |
101 | ||
102 | # Check the arguments. | |
7a64e28d BC |
103 | while test $# -gt 0 |
104 | do | |
aa428238 VS |
105 | grub_process_install_options "$@" |
106 | case "$grub_process_install_options_consumed" in | |
107 | 1) shift; continue;; | |
108 | 2) shift; shift; continue;; | |
109 | esac | |
110 | ||
7a64e28d BC |
111 | option=$1 |
112 | shift | |
113 | ||
fc2208b0 RM |
114 | case "$option" in |
115 | -h | --help) | |
116 | usage | |
117 | exit 0 ;; | |
118 | -v | --version) | |
0ea7c4f9 | 119 | echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" |
fc2208b0 | 120 | exit 0 ;; |
7a64e28d BC |
121 | |
122 | --modules) | |
b02c7c8f | 123 | modules=`argument $option "$@"`; shift ;; |
fc2208b0 RM |
124 | --modules=*) |
125 | modules=`echo "$option" | sed 's/--modules=//'` ;; | |
7a64e28d BC |
126 | |
127 | -o | --output) | |
b02c7c8f | 128 | output_image=`argument $option "$@"`; shift ;; |
fc2208b0 RM |
129 | --output=*) |
130 | output_image=`echo "$option" | sed 's/--output=//'` ;; | |
7a64e28d | 131 | |
d6d0c209 BC |
132 | --rom-directory) |
133 | rom_directory=`argument $option "$@"`; shift ;; | |
7e70395f VS |
134 | --rom-directory=*) |
135 | rom_directory=`echo "$option" | sed 's/--rom-directory=//'` ;; | |
d6d0c209 | 136 | |
efda854e | 137 | # Intentionally undocumented |
7a64e28d | 138 | --override-directory) |
b02c7c8f | 139 | override_dir=`argument $option "$@"` |
7a64e28d BC |
140 | shift |
141 | PATH=${override_dir}:$PATH | |
142 | export PATH | |
143 | ;; | |
efda854e RM |
144 | --override-directory=*) |
145 | override_dir=`echo "${option}/" | sed 's/--override-directory=//'` | |
146 | PATH=${override_dir}:$PATH | |
147 | export PATH | |
148 | ;; | |
d6d0c209 | 149 | |
a79b8a15 VS |
150 | --product-name) |
151 | product_name=`argument $option "$@"`; shift ;; | |
152 | --product-name=*) | |
153 | product_name=`echo "$option" | sed 's/--product-name=//'` ;; | |
154 | ||
155 | --product-version) | |
156 | product_version=`argument $option "$@"`; shift ;; | |
157 | --product-version=*) | |
158 | product_version=`echo "$option" | sed 's/--product-version=//'` ;; | |
159 | ||
d6d0c209 BC |
160 | --grub-mkimage) |
161 | grub_mkimage=`argument $option "$@"`; shift ;; | |
7fb5c25f CW |
162 | --grub-mkimage=*) |
163 | grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;; | |
b2ffba9c | 164 | |
67ab8353 VS |
165 | --grub-glue-efi) |
166 | grub_glue_efi=`argument $option "$@"`; shift ;; | |
167 | --grub-glue-efi=*) | |
168 | grub_glue_efi=`echo "$option" | sed 's/--grub-glue-efi=//'` ;; | |
169 | ||
a79b8a15 VS |
170 | --grub-render-label) |
171 | grub_render_label=`argument $option "$@"`; shift ;; | |
172 | --grub-render-label=*) | |
173 | grub_render_label=`echo "$option" | sed 's/--grub-render-label=//'` ;; | |
174 | ||
175 | --label-font) | |
176 | label_font=`argument $option "$@"`; shift ;; | |
177 | --label-font=*) | |
178 | label_font=`echo "$option" | sed 's/--label-font=//'` ;; | |
179 | ||
180 | --label-color) | |
181 | label_color=`argument $option "$@"`; shift ;; | |
182 | --label-color=*) | |
183 | label_color=`echo "$option" | sed 's/--label-color=//'` ;; | |
184 | ||
185 | --label-bgcolor) | |
186 | label_bgcolor=`argument $option "$@"`; shift ;; | |
187 | --label-bgcolor=*) | |
188 | label_bgcolor=`echo "$option" | sed 's/--label-bgcolor=//'` ;; | |
189 | ||
b2ffba9c BC |
190 | --xorriso) |
191 | xorriso=`argument $option "$@"`; shift ;; | |
a6085973 | 192 | --xorriso=*) |
182c872a | 193 | xorriso=`echo "${option}" | sed 's/--xorriso=//'` ;; |
b2ffba9c | 194 | |
fc2208b0 | 195 | *) |
b02c7c8f | 196 | source="${source} ${option} $@"; break ;; |
fc2208b0 RM |
197 | esac |
198 | done | |
199 | ||
74ff1dd5 | 200 | if [ "x${output_image}" = x ] ; then |
b525fd83 | 201 | gettext "output file must be specified" >&2 |
a32d5c71 | 202 | echo >&2 |
74ff1dd5 FZ |
203 | usage |
204 | exit 1 | |
205 | fi | |
206 | ||
7fb5c25f CW |
207 | set $grub_mkimage dummy |
208 | if test -f "$1"; then | |
209 | : | |
210 | else | |
a32d5c71 | 211 | gettext_printf "%s: Not found.\n" "$1" 1>&2 |
7fb5c25f CW |
212 | exit 1 |
213 | fi | |
214 | ||
b65ea155 | 215 | iso9660_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 |
fc2208b0 RM |
216 | mkdir -p ${iso9660_dir}/boot/grub |
217 | ||
efda854e RM |
218 | process_input_dir () |
219 | { | |
aa428238 | 220 | grub_install_files "$1" "${iso9660_dir}/boot/grub" "$2" |
efda854e RM |
221 | } |
222 | ||
7e70395f VS |
223 | make_image () |
224 | { | |
225 | source_directory="$1" | |
226 | platform=$2 | |
227 | if ! test -e "${source_directory}"; then | |
228 | return; | |
efda854e | 229 | fi |
fc2208b0 | 230 | |
a32d5c71 | 231 | gettext_printf "Enabling %s support ...\n" "$2" |
7e70395f | 232 | |
92cd0f6e VS |
233 | memdisk_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 |
234 | memdisk_dir="`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 | |
235 | mkdir -p "${memdisk_dir}/boot/grub" | |
fc2208b0 | 236 | |
92cd0f6e | 237 | (cat << EOF |
c982589f | 238 | search --fs-uuid --set=root ${iso_uuid} |
92cd0f6e | 239 | set prefix=(\${root})/boot/grub |
fc2208b0 | 240 | EOF |
92cd0f6e | 241 | for i in $(cat "${source_directory}/partmap.lst") ${modules} ; do |
fc2208b0 RM |
242 | echo "insmod $i" |
243 | done ; \ | |
92cd0f6e VS |
244 | echo "source \$prefix/grub.cfg") \ |
245 | > "${memdisk_dir}/boot/grub/grub.cfg" | |
fc2208b0 | 246 | |
3eaac1a1 | 247 | (cd "${memdisk_dir}"; tar -cf - boot) > "${memdisk_img}" |
92cd0f6e VS |
248 | rm -rf "${memdisk_dir}" |
249 | "$grub_mkimage" -O ${platform} -d "${source_directory}" -m "${memdisk_img}" -o "$3" --prefix='(memdisk)/boot/grub' \ | |
ee62c427 | 250 | search iso9660 configfile normal memdisk tar $4 |
92cd0f6e | 251 | rm -rf "${memdisk_img}" |
7e70395f VS |
252 | } |
253 | ||
efda854e | 254 | if [ "${override_dir}" = "" ] ; then |
7210dca9 | 255 | if test -e "${multiboot_dir}" ; then |
070038f8 | 256 | process_input_dir "${multiboot_dir}" i386-multiboot |
7e70395f VS |
257 | fi |
258 | if test -e "${coreboot_dir}" ; then | |
070038f8 | 259 | process_input_dir "${coreboot_dir}" i386-coreboot |
7e70395f VS |
260 | fi |
261 | if test -e "${qemu_dir}" ; then | |
070038f8 | 262 | process_input_dir "${qemu_dir}" i386-qemu |
fc2208b0 | 263 | fi |
efda854e | 264 | if test -e "${pc_dir}" ; then |
070038f8 | 265 | process_input_dir "${pc_dir}" i386-pc |
efda854e | 266 | fi |
dbc56d8f VS |
267 | if test -e "${i386_ieee1275_dir}" ; then |
268 | process_input_dir "${i386_ieee1275_dir}" i386-ieee1275 | |
269 | fi | |
ac0289ba | 270 | if test -e "${efi32_dir}" ; then |
070038f8 | 271 | process_input_dir "${efi32_dir}" i386-efi |
ac0289ba VS |
272 | fi |
273 | if test -e "${efi64_dir}" ; then | |
070038f8 VS |
274 | process_input_dir "${efi64_dir}" x86_64-efi |
275 | fi | |
276 | if test -e "${ia64_dir}" ; then | |
277 | process_input_dir "${ia64_dir}" ia64-efi | |
278 | fi | |
279 | if test -e "${mips_qemu_dir}" ; then | |
280 | process_input_dir "${mips_qemu_dir}" mips-qemu_mips | |
281 | fi | |
282 | if test -e "${mipsel_qemu_dir}" ; then | |
283 | process_input_dir "${mipsel_qemu_dir}" mipsel-qemu_mips | |
ac0289ba | 284 | fi |
3f2bdd8f VS |
285 | if test -e "${loongson_dir}" ; then |
286 | process_input_dir "${loongson_dir}" mipsel-loongson | |
287 | fi | |
a79b8a15 | 288 | if test -e "${ppc_dir}" ; then |
07aec23c | 289 | process_input_dir "${ppc_dir}" powerpc-ieee1275 |
a79b8a15 | 290 | fi |
efda854e | 291 | else |
b84f26c5 | 292 | . "${override_dir}"/modinfo.sh |
6ad6223e | 293 | process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform} |
7210dca9 | 294 | multiboot_dir= |
efda854e | 295 | pc_dir= |
ac0289ba VS |
296 | efi32_dir= |
297 | efi64_dir= | |
070038f8 | 298 | ia64_dir= |
7e70395f VS |
299 | coreboot_dir= |
300 | qemu_dir= | |
070038f8 VS |
301 | mipsel_qemu_dir= |
302 | mips_qemu_dir= | |
3f2bdd8f | 303 | loongson_dir= |
a79b8a15 | 304 | ppc_dir= |
dbc56d8f | 305 | i386_ieee1275_dir= |
6ad6223e | 306 | case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in |
070038f8 VS |
307 | i386-multiboot) multiboot_dir="${override_dir}" ;; |
308 | i386-coreboot) coreboot_dir="${override_dir}" ;; | |
309 | i386-qemu) qemu_dir="${override_dir}" ;; | |
310 | i386-pc) pc_dir="${override_dir}" ;; | |
311 | i386-efi) efi32_dir="${override_dir}" ;; | |
312 | x86_64-efi) efi64_dir="${override_dir}" ;; | |
313 | ia64-efi) ia64_dir="${override_dir}" ;; | |
314 | mipsel-qemu_mips) mipsel_qemu_dir="${override_dir}" ;; | |
3f2bdd8f | 315 | mipsel-loongson) loongson_dir="${override_dir}" ;; |
070038f8 | 316 | mips-qemu_mips) mips_qemu_dir="${override_dir}" ;; |
a79b8a15 | 317 | powerpc-ieee1275) ppc_dir="${override_dir}" ;; |
dbc56d8f | 318 | i386-ieee1275) i386_ieee1275_dir="${override_dir}" ;; |
efda854e | 319 | esac |
fc2208b0 RM |
320 | fi |
321 | ||
13ac4305 VS |
322 | # obtain date-based UUID |
323 | iso_uuid=$(date -u +%Y-%m-%d-%H-%M-%S-00) | |
324 | grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)" | |
325 | ||
52cc3ce0 | 326 | # build BIOS core.img |
efda854e | 327 | if test -e "${pc_dir}" ; then |
a32d5c71 | 328 | gettext_printf "Enabling %s support ...\n" "BIOS" |
92cd0f6e VS |
329 | load_cfg="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" |
330 | core_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 | |
331 | ||
332 | (for i in $(cat "${pc_dir}/partmap.lst") ${modules} ; do | |
333 | echo "insmod $i" | |
334 | done ;) > "${load_cfg}" | |
0ae56929 | 335 | |
92cd0f6e VS |
336 | "$grub_mkimage" -O i386-pc -d "${pc_dir}/" -o "${core_img}" -c "$load_cfg" --prefix=/boot/grub \ |
337 | iso9660 biosdisk | |
338 | cat "${pc_dir}/cdboot.img" "${core_img}" > "${iso9660_dir}/boot/grub/i386-pc/eltorito.img" | |
0ae56929 | 339 | |
92cd0f6e VS |
340 | embed_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1 |
341 | cat "${pc_dir}/boot.img" "${core_img}" > "${embed_img}" | |
fc2208b0 | 342 | |
0ae70393 | 343 | rm -f "${core_img}" |
fc2208b0 | 344 | |
47779711 | 345 | grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-info-table \ |
0ae56929 | 346 | --embedded-boot ${embed_img}" |
fc2208b0 RM |
347 | fi |
348 | ||
7e70395f | 349 | # build multiboot core.img |
efff4b1c | 350 | make_image "${multiboot_dir}" i386-multiboot "${iso9660_dir}/boot/multiboot.img" "pata ahci at_keyboard" |
7e70395f | 351 | |
dbc56d8f VS |
352 | make_image "${i386_ieee1275_dir}" i386-ieee1275 "${iso9660_dir}/boot/ofwx86.elf" "" |
353 | ||
070038f8 | 354 | if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; then |
b65ea155 | 355 | efi_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1 |
260ddb94 | 356 | mkdir -p "${efi_dir}/efi/boot" |
13ac4305 | 357 | |
070038f8 VS |
358 | # build bootia64.efi |
359 | make_image "${ia64_dir}" ia64-efi "${efi_dir}"/efi/boot/bootia64.efi "" | |
7e70395f VS |
360 | # build bootx64.efi |
361 | make_image "${efi64_dir}" x86_64-efi "${efi_dir}"/efi/boot/bootx64.efi "" | |
362 | # build bootia32.efi | |
363 | make_image "${efi32_dir}" i386-efi "${efi_dir}"/efi/boot/bootia32.efi "" | |
fc858482 VS |
364 | if [ -e "${efi_dir}"/efi/boot/bootia32.efi ]; then |
365 | # For old macs. Suggested by Peter Jones. | |
366 | cp "${efi_dir}"/efi/boot/bootia32.efi "${efi_dir}"/efi/boot/boot.efi | |
367 | fi | |
13ac4305 | 368 | |
67ab8353 VS |
369 | if [ -e "${efi_dir}"/efi/boot/bootx64.efi ] || [ -e "${efi_dir}"/efi/boot/bootia32.efi ]; then |
370 | mkdir -p "${iso9660_dir}"/System/Library/CoreServices | |
371 | fi | |
372 | ||
373 | if [ -e "${efi_dir}"/efi/boot/bootx64.efi ] && [ -e "${efi_dir}"/efi/boot/bootia32.efi ]; then | |
374 | "$grub_glue_efi" -6 "${efi_dir}"/efi/boot/bootx64.efi -3 "${efi_dir}"/efi/boot/bootia32.efi -o "${iso9660_dir}"/System/Library/CoreServices/boot.efi | |
375 | elif [ -e "${efi_dir}"/efi/boot/bootx64.efi ]; then | |
376 | cp "${efi_dir}"/efi/boot/bootx64.efi "${iso9660_dir}"/System/Library/CoreServices/boot.efi | |
377 | elif [ -e "${efi_dir}"/efi/boot/bootia32.efi ]; then | |
378 | cp "${efi_dir}"/efi/boot/bootia32.efi "${iso9660_dir}"/System/Library/CoreServices/boot.efi | |
379 | fi | |
380 | ||
260ddb94 VS |
381 | mformat -C -f 2880 -L 16 -i "${iso9660_dir}"/efi.img :: |
382 | mcopy -s -i "${iso9660_dir}"/efi.img ${efi_dir}/efi ::/ | |
ea9be8ea | 383 | rm -rf ${efi_dir} |
260ddb94 | 384 | grub_mkisofs_arguments="${grub_mkisofs_arguments} --efi-boot efi.img" |
ac0289ba VS |
385 | fi |
386 | ||
a79b8a15 VS |
387 | make_image "${ppc_dir}" powerpc-ieee1275 "${iso9660_dir}/boot/powerpc.elf" "" |
388 | if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] || [ -e "${iso9660_dir}/boot/powerpc.elf" ]; then | |
389 | mkdir -p "${iso9660_dir}"/System/Library/CoreServices | |
390 | touch "${iso9660_dir}/mach_kernel" | |
391 | cat > "${iso9660_dir}/System/Library/CoreServices/SystemVersion.plist" <<EOF | |
392 | <plist version="1.0"> | |
393 | <dict> | |
394 | <key>ProductBuildVersion</key> | |
395 | <string></string> | |
396 | <key>ProductName</key> | |
397 | <string>${product_name}</string> | |
398 | <key>ProductVersion</key> | |
399 | <string>${product_version}</string> | |
400 | </dict> | |
401 | </plist> | |
402 | EOF | |
403 | "$grub_render_label" -f "$label_font" -b "$label_bgcolor" -c "$label_color" -t "${product_name} ${product_version}" -o "${iso9660_dir}/System/Library/CoreServices/.disk_label" | |
404 | echo "${product_name} ${product_version}" > "${iso9660_dir}/System/Library/CoreServices/.disk_label.contentDetails" | |
405 | grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus -hfsplus-file-creator-type chrp tbxj /System/Library/CoreServices/.disk_label" | |
406 | fi | |
407 | ||
408 | if [ -e "${iso9660_dir}/boot/powerpc.elf" ] ; then | |
409 | cp "${ppc_dir}/grub.chrp" "${iso9660_dir}"/System/Library/CoreServices/BootX | |
410 | cp "${iso9660_dir}/boot/powerpc.elf" "${iso9660_dir}"/System/Library/CoreServices/grub.elf | |
411 | # FIXME: add PreP | |
412 | grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus-file-creator-type chrp tbxi /System/Library/CoreServices/BootX -hfs-bless-by p /System/Library/CoreServices -sysid PPC" | |
413 | fi | |
414 | ||
415 | if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ]; then | |
416 | grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfs-bless-by i /System/Library/CoreServices/boot.efi" | |
417 | fi | |
418 | ||
070038f8 VS |
419 | make_image "${mipsel_qemu_dir}" mipsel-qemu_mips-elf "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "pata" |
420 | if [ -e "${iso9660_dir}/boot/mipsel-qemu_mips.elf" ] && [ -d "${rom_directory}" ]; then | |
421 | cp "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "${rom_directory}/mipsel-qemu_mips.elf" | |
422 | fi | |
3f2bdd8f VS |
423 | |
424 | make_image "${loongson_dir}" mipsel-loongson-elf "${iso9660_dir}/boot/mipsel-loongson.elf" "pata -C xz" | |
425 | if [ -e "${iso9660_dir}/boot/mipsel-loongson.elf" ] && [ -d "${rom_directory}" ]; then | |
426 | cp "${iso9660_dir}/boot/mipsel-loongson.elf" "${rom_directory}/mipsel-loongson.elf" | |
427 | fi | |
428 | make_image "${loongson_dir}" mipsel-yeeloong-flash "${iso9660_dir}/boot/mipsel-yeeloong.bin" "pata -C xz" | |
429 | if [ -e "${iso9660_dir}/boot/mipsel-yeeloong.bin" ] && [ -d "${rom_directory}" ]; then | |
430 | cp "${iso9660_dir}/boot/mipsel-yeeloong.bin" "${rom_directory}/mipsel-yeeloong.bin" | |
431 | fi | |
432 | ||
433 | make_image "${loongson_dir}" mipsel-fuloong2f-flash "${iso9660_dir}/boot/mipsel-fuloong2f.bin" "pata -C xz" | |
434 | if [ -e "${iso9660_dir}/boot/mipsel-fulong.bin" ] && [ -d "${rom_directory}" ]; then | |
435 | cp "${iso9660_dir}/boot/mipsel-fulong.bin" "${rom_directory}/mipsel-fulong.bin" | |
436 | fi | |
437 | ||
070038f8 VS |
438 | make_image "${mips_qemu_dir}" mips-qemu_mips-elf "${iso9660_dir}/boot/mips-qemu_mips.elf" "pata" |
439 | if [ -e "${iso9660_dir}/boot/mips-qemu_mips.elf" ] && [ -d "${rom_directory}" ]; then | |
440 | cp "${iso9660_dir}/boot/mips-qemu_mips.elf" "${rom_directory}/mips-qemu_mips.elf" | |
441 | fi | |
efff4b1c | 442 | make_image "${qemu_dir}" i386-qemu "${iso9660_dir}/boot/qemu.img" "pata at_keyboard" |
7e70395f VS |
443 | if [ -e "${iso9660_dir}/boot/qemu.img" ] && [ -d "${rom_directory}" ]; then |
444 | cp "${iso9660_dir}/boot/qemu.img" "${rom_directory}/qemu.img" | |
445 | fi | |
efff4b1c | 446 | make_image "${coreboot_dir}" i386-coreboot "${iso9660_dir}/boot/coreboot.elf" "pata ahci at_keyboard" |
7e70395f VS |
447 | if [ -e "${iso9660_dir}/boot/coreboot.elf" ] && [ -d "${rom_directory}" ]; then |
448 | cp "${iso9660_dir}/boot/coreboot.elf" "${rom_directory}/coreboot.elf" | |
449 | fi | |
450 | ||
fc2208b0 | 451 | # build iso image |
92cd0f6e VS |
452 | "${xorriso}" -as mkisofs -graft-points ${grub_mkisofs_arguments} --protective-msdos-label -o "${output_image}" -r "${iso9660_dir}" --sort-weight 0 / --sort-weight 1 /boot ${source} |
453 | rm -rf "${iso9660_dir}" | |
fc2208b0 | 454 | |
92cd0f6e | 455 | rm -f "${embed_img}" |
0ae56929 | 456 | |
fc2208b0 | 457 | exit 0 |