]> git.proxmox.com Git - grub2.git/blame - util/grub-mkrescue.in
* util/grub-mkrescue.in: Rename i386-ieee1275 core image due to
[grub2.git] / util / grub-mkrescue.in
CommitLineData
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
20prefix="@prefix@"
21exec_prefix="@exec_prefix@"
22datarootdir="@datarootdir@"
23bindir="@bindir@"
24libdir="@libdir@"
fc2208b0
RM
25PACKAGE_NAME=@PACKAGE_NAME@
26PACKAGE_TARNAME=@PACKAGE_TARNAME@
27PACKAGE_VERSION=@PACKAGE_VERSION@
a32d5c71 28datadir="@datadir@"
c8d9ead6 29if [ "x$pkgdatadir" = x ]; then
2311c5ca 30 pkgdatadir="${datadir}/@PACKAGE@"
c8d9ead6 31fi
8c411768 32pkglib_DATA="moddep.lst command.lst fs.lst partmap.lst parttool.lst handler.lst video.lst crypto.lst terminal.lst"
fc2208b0 33
0ea7c4f9
GS
34self=`basename $0`
35
2311c5ca
VS
36multiboot_dir="${libdir}/@PACKAGE@/i386-multiboot"
37coreboot_dir="${libdir}/@PACKAGE@/i386-coreboot"
38qemu_dir="${libdir}/@PACKAGE@/i386-qemu"
070038f8 39mipsel_qemu_dir="${libdir}/@PACKAGE@/mipsel-qemu_mips"
3f2bdd8f 40loongson_dir="${libdir}/@PACKAGE@/mipsel-loongson"
070038f8 41mips_qemu_dir="${libdir}/@PACKAGE@/mips-qemu_mips"
2311c5ca 42pc_dir="${libdir}/@PACKAGE@/i386-pc"
dbc56d8f 43i386_ieee1275_dir="${libdir}/@PACKAGE@/i386-ieee1275"
2311c5ca
VS
44efi32_dir="${libdir}/@PACKAGE@/i386-efi"
45efi64_dir="${libdir}/@PACKAGE@/x86_64-efi"
070038f8 46ia64_dir="${libdir}/@PACKAGE@/ia64-efi"
8ca86b3a 47sparc64_dir="${libdir}/@PACKAGE@/sparc64-ieee1275"
ab1440bd 48arcs_dir="${libdir}/@PACKAGE@/mips-arc"
7f63a64f 49arc_dir="${libdir}/@PACKAGE@/mipsel-arc"
a79b8a15 50ppc_dir="${libdir}/@PACKAGE@/powerpc-ieee1275"
7e70395f 51rom_directory=
d1d368e4 52override_dir=
fd49ceb3 53grub_mkimage="${bindir}/@grub_mkimage@"
a79b8a15 54grub_render_label="${bindir}/@grub_render_label@"
67ab8353 55grub_glue_efi="${bindir}/@grub_glue_efi@"
a79b8a15
VS
56label_font="${pkgdatadir}/unicode.pf2"
57label_color="black"
58label_bgcolor="white"
59product_name="${PACKAGE_NAME}"
60product_version="${PACKAGE_VERSION}"
fc2208b0 61
a6085973
TS
62xorriso=xorriso
63
9cc3ee5c
VS
64export TEXTDOMAIN=@PACKAGE@
65export TEXTDOMAINDIR="@localedir@"
66
a20f6ad0
VS
67localedir="@datadir@/locale"
68
c8d9ead6 69. "${pkgdatadir}/grub-mkconfig_lib"
a32d5c71 70
fc2208b0
RM
71# Usage: usage
72# Print the usage.
73usage () {
a32d5c71 74 gettext_printf "Usage: %s [OPTION] SOURCE...\n" "$self"
e7d2559b 75 # TRANSLATORS: it generates one single image which is bootable through any method.
67093bc0 76 gettext "Make GRUB CD-ROM, disk, pendrive and floppy bootable image."; echo
a32d5c71 77 echo
e7d2559b 78 filetrans="$(gettext FILE)"
9f9d3f69
VS
79 print_option_help "-h, --help" "$(gettext "print this message and exit")"
80 print_option_help "-v, --version" "$(gettext "print the version information and exit")"
81 print_option_help "-o, --output=$filetrans" "$(gettext "save output in FILE [required]")"
82 print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
aa428238
VS
83 grub_print_install_files_help
84 print_option_help "--install-modules=$(gettext "MODULES")" "$(gettext "install only MODULES and their dependencies on bootable media")"
9f9d3f69 85 print_option_help "--rom-directory=$(gettext "DIR")" "$(gettext "save ROM images in DIR [optional]")"
e7d2559b 86 # TRANSLATORS: xorriso is a program for creating ISOs and burning CDs
9f9d3f69
VS
87 print_option_help "--xorriso=$filetrans" "$(gettext "use FILE as xorriso [optional]")"
88 print_option_help "--grub-mkimage=$filetrans" "$(gettext "use FILE as grub-mkimage")"
67ab8353 89 print_option_help "--grub-glue-efi=$filetrans" "$(gettext "use FILE as grub-glue-efi")"
a79b8a15
VS
90 print_option_help "--grub-render-label=$filetrans" "$(gettext "use FILE as grub-render-label")"
91 print_option_help "--label-font=$filetrans" "$(gettext "use FILE as font for label")"
92 print_option_help "--label-color=$(gettext "COLOR")" "$(gettext "use COLOR for label")"
93 print_option_help "--label-bgcolor=$(gettext "COLOR")" "$(gettext "use COLOR for label background")"
94 print_option_help "--product-name=$(gettext "STR")" "$(gettext "use STR as product")"
95 print_option_help "--product-version=$(gettext "STR")" "$(gettext "use STR as product version")"
ab1440bd
VS
96 print_option_help "--sparc-boot" "$(gettext "enable sparc boot. Disables HFS+, APM, ARCS and boot as disk image for i386-pc")"
97 print_option_help "--arcs-boot" "$(gettext "enable ARCS (big-endian mips machines, mostly SGI) boot. Disables HFS+, APM, sparc64 and boot as disk image for i386-pc")"
a32d5c71 98 echo
9f9d3f69 99 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
100 echo
101 gettext "Option -- switches to native xorriso command mode."; echo
102 echo
103 gettext "Report bugs to <bug-grub@gnu.org>."; echo
104 gettext "Mail xorriso support requests to <bug-xorriso@gnu.org>."; echo
fc2208b0
RM
105}
106
8ca86b3a
VS
107system_area=auto
108
fc2208b0 109# Check the arguments.
7a64e28d
BC
110while test $# -gt 0
111do
aa428238
VS
112 grub_process_install_options "$@"
113 case "$grub_process_install_options_consumed" in
114 1) shift; continue;;
115 2) shift; shift; continue;;
116 esac
117
7a64e28d
BC
118 option=$1
119 shift
120
fc2208b0
RM
121 case "$option" in
122 -h | --help)
123 usage
124 exit 0 ;;
125 -v | --version)
0ea7c4f9 126 echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
fc2208b0 127 exit 0 ;;
7a64e28d
BC
128
129 --modules)
b02c7c8f 130 modules=`argument $option "$@"`; shift ;;
fc2208b0
RM
131 --modules=*)
132 modules=`echo "$option" | sed 's/--modules=//'` ;;
7a64e28d
BC
133
134 -o | --output)
b02c7c8f 135 output_image=`argument $option "$@"`; shift ;;
fc2208b0
RM
136 --output=*)
137 output_image=`echo "$option" | sed 's/--output=//'` ;;
7a64e28d 138
d6d0c209
BC
139 --rom-directory)
140 rom_directory=`argument $option "$@"`; shift ;;
7e70395f
VS
141 --rom-directory=*)
142 rom_directory=`echo "$option" | sed 's/--rom-directory=//'` ;;
d6d0c209 143
efda854e 144 # Intentionally undocumented
7a64e28d 145 --override-directory)
b02c7c8f 146 override_dir=`argument $option "$@"`
7a64e28d
BC
147 shift
148 PATH=${override_dir}:$PATH
149 export PATH
150 ;;
efda854e
RM
151 --override-directory=*)
152 override_dir=`echo "${option}/" | sed 's/--override-directory=//'`
153 PATH=${override_dir}:$PATH
154 export PATH
155 ;;
d6d0c209 156
8ca86b3a
VS
157 --sparc-boot)
158 system_area=sparc64 ;;
159
ab1440bd
VS
160 --arcs-boot)
161 system_area=arcs ;;
162
a79b8a15
VS
163 --product-name)
164 product_name=`argument $option "$@"`; shift ;;
165 --product-name=*)
166 product_name=`echo "$option" | sed 's/--product-name=//'` ;;
167
168 --product-version)
169 product_version=`argument $option "$@"`; shift ;;
170 --product-version=*)
171 product_version=`echo "$option" | sed 's/--product-version=//'` ;;
172
d6d0c209
BC
173 --grub-mkimage)
174 grub_mkimage=`argument $option "$@"`; shift ;;
7fb5c25f
CW
175 --grub-mkimage=*)
176 grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
b2ffba9c 177
67ab8353
VS
178 --grub-glue-efi)
179 grub_glue_efi=`argument $option "$@"`; shift ;;
180 --grub-glue-efi=*)
181 grub_glue_efi=`echo "$option" | sed 's/--grub-glue-efi=//'` ;;
182
a79b8a15
VS
183 --grub-render-label)
184 grub_render_label=`argument $option "$@"`; shift ;;
185 --grub-render-label=*)
186 grub_render_label=`echo "$option" | sed 's/--grub-render-label=//'` ;;
187
188 --label-font)
189 label_font=`argument $option "$@"`; shift ;;
190 --label-font=*)
191 label_font=`echo "$option" | sed 's/--label-font=//'` ;;
192
193 --label-color)
194 label_color=`argument $option "$@"`; shift ;;
195 --label-color=*)
196 label_color=`echo "$option" | sed 's/--label-color=//'` ;;
197
198 --label-bgcolor)
199 label_bgcolor=`argument $option "$@"`; shift ;;
200 --label-bgcolor=*)
201 label_bgcolor=`echo "$option" | sed 's/--label-bgcolor=//'` ;;
202
b2ffba9c
BC
203 --xorriso)
204 xorriso=`argument $option "$@"`; shift ;;
a6085973 205 --xorriso=*)
182c872a 206 xorriso=`echo "${option}" | sed 's/--xorriso=//'` ;;
b2ffba9c 207
fc2208b0 208 *)
b02c7c8f 209 source="${source} ${option} $@"; break ;;
fc2208b0
RM
210 esac
211done
212
74ff1dd5 213if [ "x${output_image}" = x ] ; then
b525fd83 214 gettext "output file must be specified" >&2
a32d5c71 215 echo >&2
74ff1dd5
FZ
216 usage
217 exit 1
218fi
219
7fb5c25f
CW
220set $grub_mkimage dummy
221if test -f "$1"; then
222 :
223else
a32d5c71 224 gettext_printf "%s: Not found.\n" "$1" 1>&2
7fb5c25f
CW
225 exit 1
226fi
227
b65ea155 228iso9660_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
fc2208b0 229mkdir -p ${iso9660_dir}/boot/grub
e0810df3 230mkdir -p ${iso9660_dir}/boot/grub/roms
fc2208b0 231
efda854e
RM
232process_input_dir ()
233{
aa428238 234 grub_install_files "$1" "${iso9660_dir}/boot/grub" "$2"
efda854e
RM
235}
236
7e70395f
VS
237make_image ()
238{
239 source_directory="$1"
240 platform=$2
241 if ! test -e "${source_directory}"; then
242 return;
efda854e 243 fi
fc2208b0 244
a32d5c71 245 gettext_printf "Enabling %s support ...\n" "$2"
7e70395f 246
8ca86b3a 247 load_cfg="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`"
fc2208b0 248
92cd0f6e 249 (cat << EOF
c982589f 250search --fs-uuid --set=root ${iso_uuid}
92cd0f6e 251set prefix=(\${root})/boot/grub
fc2208b0 252EOF
92cd0f6e 253 for i in $(cat "${source_directory}/partmap.lst") ${modules} ; do
fc2208b0 254 echo "insmod $i"
8ca86b3a
VS
255 done ; ) > "${load_cfg}"
256
257 "$grub_mkimage" -O ${platform} -d "${source_directory}" -c "${load_cfg}" -o "$3" \
79451522 258 $grub_decompression_module search iso9660 $4
8ca86b3a
VS
259 rm -rf "${load_cfg}"
260}
261
262make_image_fwdisk ()
263{
264 source_directory="$1"
265 platform=$2
266 if ! test -e "${source_directory}"; then
267 return;
268 fi
269
270 gettext_printf "Enabling %s support ...\n" "$2"
271
272 "$grub_mkimage" -O ${platform} -d "${source_directory}" -p '()/boot/grub' -o "$3" \
79451522 273 $grub_decompression_module iso9660 $4
7e70395f
VS
274}
275
efda854e 276if [ "${override_dir}" = "" ] ; then
8ca86b3a
VS
277 if [ "$system_area" = auto ]; then
278 if test -e "${pc_dir}" || test -e "${ppc_dir}" \
279 || test -e "${efi32_dir}" || test -e "${efi64_dir}"; then
280 system_area=common;
281 elif test -e "${sparc64_dir}" ; then
282 system_area=sparc64;
ab1440bd
VS
283 elif test -e "${arcs_dir}" ; then
284 system_area=arcs;
8ca86b3a
VS
285 fi
286 fi
7210dca9 287 if test -e "${multiboot_dir}" ; then
070038f8 288 process_input_dir "${multiboot_dir}" i386-multiboot
7e70395f
VS
289 fi
290 if test -e "${coreboot_dir}" ; then
070038f8 291 process_input_dir "${coreboot_dir}" i386-coreboot
7e70395f
VS
292 fi
293 if test -e "${qemu_dir}" ; then
070038f8 294 process_input_dir "${qemu_dir}" i386-qemu
fc2208b0 295 fi
efda854e 296 if test -e "${pc_dir}" ; then
070038f8 297 process_input_dir "${pc_dir}" i386-pc
efda854e 298 fi
dbc56d8f
VS
299 if test -e "${i386_ieee1275_dir}" ; then
300 process_input_dir "${i386_ieee1275_dir}" i386-ieee1275
301 fi
ac0289ba 302 if test -e "${efi32_dir}" ; then
070038f8 303 process_input_dir "${efi32_dir}" i386-efi
ac0289ba
VS
304 fi
305 if test -e "${efi64_dir}" ; then
070038f8
VS
306 process_input_dir "${efi64_dir}" x86_64-efi
307 fi
308 if test -e "${ia64_dir}" ; then
309 process_input_dir "${ia64_dir}" ia64-efi
310 fi
311 if test -e "${mips_qemu_dir}" ; then
312 process_input_dir "${mips_qemu_dir}" mips-qemu_mips
313 fi
314 if test -e "${mipsel_qemu_dir}" ; then
315 process_input_dir "${mipsel_qemu_dir}" mipsel-qemu_mips
ac0289ba 316 fi
3f2bdd8f
VS
317 if test -e "${loongson_dir}" ; then
318 process_input_dir "${loongson_dir}" mipsel-loongson
319 fi
a79b8a15 320 if test -e "${ppc_dir}" ; then
07aec23c 321 process_input_dir "${ppc_dir}" powerpc-ieee1275
a79b8a15 322 fi
8ca86b3a
VS
323 if test -e "${sparc64_dir}" ; then
324 process_input_dir "${sparc64_dir}" sparc64-ieee1275
325 fi
ab1440bd
VS
326 if test -e "${arcs_dir}" ; then
327 process_input_dir "${arcs_dir}" mips-arc
328 fi
7f63a64f
VS
329 if test -e "${arc_dir}" ; then
330 process_input_dir "${arc_dir}" mipsel-arc
331 fi
efda854e 332else
b84f26c5 333 . "${override_dir}"/modinfo.sh
6ad6223e 334 process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform}
7210dca9 335 multiboot_dir=
efda854e 336 pc_dir=
ac0289ba
VS
337 efi32_dir=
338 efi64_dir=
070038f8 339 ia64_dir=
7e70395f
VS
340 coreboot_dir=
341 qemu_dir=
070038f8
VS
342 mipsel_qemu_dir=
343 mips_qemu_dir=
3f2bdd8f 344 loongson_dir=
a79b8a15 345 ppc_dir=
dbc56d8f 346 i386_ieee1275_dir=
8ca86b3a 347 sparc64_dir=
ab1440bd 348 arcs_dir=
7f63a64f 349 arc_dir=
6ad6223e 350 case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
070038f8
VS
351 i386-multiboot) multiboot_dir="${override_dir}" ;;
352 i386-coreboot) coreboot_dir="${override_dir}" ;;
353 i386-qemu) qemu_dir="${override_dir}" ;;
8ca86b3a
VS
354 i386-pc) pc_dir="${override_dir}"; system_area=common;;
355 i386-efi) efi32_dir="${override_dir}"; system_area=common ;;
356 x86_64-efi) efi64_dir="${override_dir}"; system_area=common ;;
070038f8
VS
357 ia64-efi) ia64_dir="${override_dir}" ;;
358 mipsel-qemu_mips) mipsel_qemu_dir="${override_dir}" ;;
3f2bdd8f 359 mipsel-loongson) loongson_dir="${override_dir}" ;;
070038f8 360 mips-qemu_mips) mips_qemu_dir="${override_dir}" ;;
8ca86b3a
VS
361 powerpc-ieee1275) ppc_dir="${override_dir}"; system_area=common ;;
362 sparc64-ieee1275) sparc64_dir="${override_dir}"; system_area=sparc64 ;;
ab1440bd 363 mips-arc) arcs_dir="${override_dir}"; system_area=arcs ;;
7f63a64f 364 mipsel-arc) arc_dir="${override_dir}" ;;
dbc56d8f 365 i386-ieee1275) i386_ieee1275_dir="${override_dir}" ;;
efda854e 366 esac
fc2208b0
RM
367fi
368
13ac4305
VS
369# obtain date-based UUID
370iso_uuid=$(date -u +%Y-%m-%d-%H-%M-%S-00)
371grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)"
372
52cc3ce0 373# build BIOS core.img
efda854e 374if test -e "${pc_dir}" ; then
a32d5c71 375 gettext_printf "Enabling %s support ...\n" "BIOS"
92cd0f6e
VS
376 load_cfg="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`"
377 core_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
378
379 (for i in $(cat "${pc_dir}/partmap.lst") ${modules} ; do
380 echo "insmod $i"
381 done ;) > "${load_cfg}"
0ae56929 382
92cd0f6e 383 "$grub_mkimage" -O i386-pc -d "${pc_dir}/" -o "${core_img}" -c "$load_cfg" --prefix=/boot/grub \
79451522 384 $grub_decompression_module iso9660 biosdisk
92cd0f6e 385 cat "${pc_dir}/cdboot.img" "${core_img}" > "${iso9660_dir}/boot/grub/i386-pc/eltorito.img"
0ae56929 386
8ca86b3a
VS
387 grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-load-size 4 -boot-info-table"
388 if [ "$system_area" = common ]; then
b49fe879
VS
389 if "${xorriso}" -as mkisofs -help 2>&1 | fgrep "grub2-boot-info" >/dev/null; then
390 grub_mkisofs_arguments="${grub_mkisofs_arguments} --grub2-boot-info --grub2-mbr ${pc_dir}/boot_hybrid.img"
391 else
392 gettext "Your xorriso doesn't support \`--grub2-boot-info'. Some features are disabled. Please use xorriso 1.2.9 or later."
393 echo
394 sysarea_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
395 cat "${pc_dir}/boot.img" "${core_img}" > "${sysarea_img}"
396 if [ "$(wc -c "${sysarea_img}" | awk '{ print $1; }')" -gt 32768 ]; then
397 gettext "Your xorriso doesn't support \`--grub2-boot-info'. Your core image is too big. Boot as disk is disabled. Please use xorriso 1.2.9 or later."
398 echo
399 else
400 grub_mkisofs_arguments="${grub_mkisofs_arguments} -G ${sysarea_img}"
401 fi
402 fi
8ca86b3a 403 fi
b49fe879
VS
404
405 rm -f "${core_img}"
fc2208b0
RM
406fi
407
7e70395f 408# build multiboot core.img
e0810df3 409make_image "${multiboot_dir}" i386-multiboot "${iso9660_dir}/boot/grub/i386-multiboot/core.elf" "pata ahci at_keyboard"
7e70395f 410
c4b456d3 411make_image_fwdisk "${i386_ieee1275_dir}" i386-ieee1275 "${iso9660_dir}/boot/grub/ofwx86.elf" ""
dbc56d8f 412
070038f8 413if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; then
b65ea155 414 efi_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
260ddb94 415 mkdir -p "${efi_dir}/efi/boot"
13ac4305 416
070038f8
VS
417 # build bootia64.efi
418 make_image "${ia64_dir}" ia64-efi "${efi_dir}"/efi/boot/bootia64.efi ""
7e70395f
VS
419 # build bootx64.efi
420 make_image "${efi64_dir}" x86_64-efi "${efi_dir}"/efi/boot/bootx64.efi ""
421 # build bootia32.efi
422 make_image "${efi32_dir}" i386-efi "${efi_dir}"/efi/boot/bootia32.efi ""
fc858482
VS
423 if [ -e "${efi_dir}"/efi/boot/bootia32.efi ]; then
424 # For old macs. Suggested by Peter Jones.
425 cp "${efi_dir}"/efi/boot/bootia32.efi "${efi_dir}"/efi/boot/boot.efi
426 fi
13ac4305 427
67ab8353
VS
428 if [ -e "${efi_dir}"/efi/boot/bootx64.efi ] || [ -e "${efi_dir}"/efi/boot/bootia32.efi ]; then
429 mkdir -p "${iso9660_dir}"/System/Library/CoreServices
430 fi
431
432 if [ -e "${efi_dir}"/efi/boot/bootx64.efi ] && [ -e "${efi_dir}"/efi/boot/bootia32.efi ]; then
433 "$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
434 elif [ -e "${efi_dir}"/efi/boot/bootx64.efi ]; then
435 cp "${efi_dir}"/efi/boot/bootx64.efi "${iso9660_dir}"/System/Library/CoreServices/boot.efi
436 elif [ -e "${efi_dir}"/efi/boot/bootia32.efi ]; then
437 cp "${efi_dir}"/efi/boot/bootia32.efi "${iso9660_dir}"/System/Library/CoreServices/boot.efi
438 fi
439
260ddb94
VS
440 mformat -C -f 2880 -L 16 -i "${iso9660_dir}"/efi.img ::
441 mcopy -s -i "${iso9660_dir}"/efi.img ${efi_dir}/efi ::/
ea9be8ea 442 rm -rf ${efi_dir}
d0d2daa6 443 grub_mkisofs_arguments="${grub_mkisofs_arguments} --efi-boot efi.img -efi-boot-part --efi-boot-image"
ac0289ba
VS
444fi
445
e0810df3
VS
446make_image_fwdisk "${ppc_dir}" powerpc-ieee1275 "${iso9660_dir}/boot/grub/powerpc-ieee1275/core.elf" ""
447if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] || [ -e "${iso9660_dir}/boot/grub/powerpc-ieee1275/core.elf" ]; then
a79b8a15
VS
448 mkdir -p "${iso9660_dir}"/System/Library/CoreServices
449 touch "${iso9660_dir}/mach_kernel"
450 cat > "${iso9660_dir}/System/Library/CoreServices/SystemVersion.plist" <<EOF
451<plist version="1.0">
452<dict>
453 <key>ProductBuildVersion</key>
454 <string></string>
455 <key>ProductName</key>
456 <string>${product_name}</string>
457 <key>ProductVersion</key>
458 <string>${product_version}</string>
459</dict>
460</plist>
461EOF
462 "$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"
463 echo "${product_name} ${product_version}" > "${iso9660_dir}/System/Library/CoreServices/.disk_label.contentDetails"
8ca86b3a 464 if [ "$system_area" = common ]; then
d0d2daa6 465 grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus -apm-block-size 2048 -hfsplus-file-creator-type chrp tbxj /System/Library/CoreServices/.disk_label"
8ca86b3a 466 fi
a79b8a15
VS
467fi
468
e0810df3 469if [ -e "${iso9660_dir}/boot/grub/powerpc-ieee1275/core.elf" ] ; then
a79b8a15 470 cp "${ppc_dir}/grub.chrp" "${iso9660_dir}"/System/Library/CoreServices/BootX
daaa64bd
VS
471 mkdir -p "${iso9660_dir}"/ppc/chrp
472 cp "${ppc_dir}/bootinfo.txt" "${iso9660_dir}"/ppc/bootinfo.txt
e0810df3 473 grub_mkisofs_arguments="${grub_mkisofs_arguments} /System/Library/CoreServices/grub.elf=${iso9660_dir}/boot/grub/powerpc-ieee1275/core.elf /boot/grub/powerpc.elf=${iso9660_dir}/boot/grub/powerpc-ieee1275/core.elf"
a79b8a15 474 # FIXME: add PreP
8ca86b3a
VS
475 if [ "$system_area" = common ]; then
476 grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus-file-creator-type chrp tbxi /System/Library/CoreServices/BootX -hfs-bless-by p /System/Library/CoreServices"
477 fi
478 grub_mkisofs_arguments="${grub_mkisofs_arguments} -sysid PPC"
a79b8a15
VS
479fi
480
8ca86b3a 481if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] && [ "$system_area" = common ]; then
a79b8a15
VS
482 grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfs-bless-by i /System/Library/CoreServices/boot.efi"
483fi
484
8ca86b3a
VS
485make_image_fwdisk "${sparc64_dir}" sparc64-ieee1275-cdcore "${iso9660_dir}/boot/grub/sparc64-ieee1275/core.img" ""
486if [ -e "${iso9660_dir}"/boot/grub/sparc64-ieee1275/core.img ] && [ "$system_area" = sparc64 ]; then
487 sysarea_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
488 dd if=/dev/zero count=1 bs=512 | cat - "${sparc64_dir}"/cdboot.img > "$sysarea_img"
489 grub_mkisofs_arguments="${grub_mkisofs_arguments} -G $sysarea_img -B , --grub2-sparc-core /boot/grub/sparc64-ieee1275/core.img"
490fi
491
ab1440bd
VS
492make_image "${arcs_dir}" mips-arc "${iso9660_dir}/boot/grub/mips-arc/core.img" ""
493if [ -e "${iso9660_dir}/boot/grub/mips-arc/core.img" ]; then
5e013e56 494 grub_mkisofs_arguments="${grub_mkisofs_arguments} /boot/grub/mips-arc/grub=${iso9660_dir}/boot/grub/mips-arc/core.img /boot/grub/mips-arc/sashARCS=${iso9660_dir}/boot/grub/mips-arc/core.img /boot/grub/mips-arc/sash=${iso9660_dir}/boot/grub/mips-arc/core.img"
ab1440bd
VS
495fi
496if [ -e "${iso9660_dir}/boot/grub/mips-arc/core.img" ] && [ "$system_area" = arcs ]; then
5e013e56 497 grub_mkisofs_arguments="${grub_mkisofs_arguments} -mips-boot /boot/grub/mips-arc/sashARCS -mips-boot /boot/grub/mips-arc/sash -mips-boot /boot/grub/mips-arc/grub"
ab1440bd
VS
498fi
499
7f63a64f
VS
500make_image "${arc_dir}" mipsel-arc "${iso9660_dir}/boot/grub/arc.exe" ""
501
e0810df3
VS
502make_image "${mipsel_qemu_dir}" mipsel-qemu_mips-elf "${iso9660_dir}/boot/grub/roms/mipsel-qemu_mips.elf" "pata"
503if [ -e "${iso9660_dir}/boot/grub/roms/mipsel-qemu_mips.elf" ] && [ -d "${rom_directory}" ]; then
504 cp "${iso9660_dir}/boot/grub/roms/mipsel-qemu_mips.elf" "${rom_directory}/mipsel-qemu_mips.elf"
070038f8 505fi
3f2bdd8f 506
eec3bb75
VS
507make_image "${loongson_dir}" mipsel-loongson-elf "${iso9660_dir}/boot/grub/loongson.elf" "pata -C xz"
508if [ -e "${iso9660_dir}/boot/grub/loongson.elf" ] && [ -d "${rom_directory}" ]; then
509 cp "${iso9660_dir}/boot/grub/loongson.elf" "${rom_directory}/mipsel-loongson.elf"
3f2bdd8f 510fi
e0810df3
VS
511make_image "${loongson_dir}" mipsel-yeeloong-flash "${iso9660_dir}/boot/grub/roms/mipsel-yeeloong.bin" "pata -C xz"
512if [ -e "${iso9660_dir}/boot/grub/roms/mipsel-yeeloong.bin" ] && [ -d "${rom_directory}" ]; then
513 cp "${iso9660_dir}/boot/grub/roms/mipsel-yeeloong.bin" "${rom_directory}/mipsel-yeeloong.bin"
3f2bdd8f
VS
514fi
515
e0810df3
VS
516make_image "${loongson_dir}" mipsel-fuloong2f-flash "${iso9660_dir}/boot/grub/roms/mipsel-fuloong2f.bin" "pata -C xz"
517if [ -e "${iso9660_dir}/boot/grub/roms/mipsel-fulong.bin" ] && [ -d "${rom_directory}" ]; then
518 cp "${iso9660_dir}/boot/grub/roms/mipsel-fulong.bin" "${rom_directory}/mipsel-fulong.bin"
3f2bdd8f
VS
519fi
520
e0810df3
VS
521make_image "${mips_qemu_dir}" mips-qemu_mips-elf "${iso9660_dir}/boot/grub/roms/mips-qemu_mips.elf" "pata"
522if [ -e "${iso9660_dir}/boot/grub/roms/mips-qemu_mips.elf" ] && [ -d "${rom_directory}" ]; then
523 cp "${iso9660_dir}/boot/grub/roms/mips-qemu_mips.elf" "${rom_directory}/mips-qemu_mips.elf"
070038f8 524fi
e0810df3
VS
525make_image "${qemu_dir}" i386-qemu "${iso9660_dir}/boot/grub/roms/qemu.img" "pata at_keyboard"
526if [ -e "${iso9660_dir}/boot/grub/roms/qemu.img" ] && [ -d "${rom_directory}" ]; then
527 cp "${iso9660_dir}/boot/grub/roms/qemu.img" "${rom_directory}/qemu.img"
7e70395f 528fi
e0810df3
VS
529make_image "${coreboot_dir}" i386-coreboot "${iso9660_dir}/boot/grub/roms/coreboot.elf" "pata ahci at_keyboard"
530if [ -e "${iso9660_dir}/boot/grub/roms/coreboot.elf" ] && [ -d "${rom_directory}" ]; then
531 cp "${iso9660_dir}/boot/grub/roms/coreboot.elf" "${rom_directory}/coreboot.elf"
7e70395f
VS
532fi
533
fc2208b0 534# build iso image
92cd0f6e
VS
535"${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}
536rm -rf "${iso9660_dir}"
fc2208b0 537
8ca86b3a 538rm -f "${sysarea_img}"
0ae56929 539
fc2208b0 540exit 0