3 # This file is subject to the terms and conditions of the GNU General Public
4 # License. See the file "COPYING" in the main directory of this archive
7 # Copyright (C) 2017 by Changbin Du <changbin.du@intel.com>
9 # Adapted from code in arch/x86/boot/Makefile by H. Peter Anvin and others
11 # "make fdimage/fdimage144/fdimage288/isoimage" script for x86 architecture
15 # $2 - target image file
16 # $3 - kernel bzImage file
17 # $4 - mtool configuration file
19 # $6 - inird image file
22 # Use "make V=1" to debug this script
23 case "${KBUILD_VERBOSE}" in
30 if [ ! -f "$1" ]; then
32 echo " *** Missing file: $1" 1>&2
45 # Make sure the files actually exist
52 echo "$KCMDLINE" | mcopy
- a
:syslinux.cfg
53 if [ -f "$FDINITRD" ] ; then
54 mcopy
"$FDINITRD" a
:initrd.img
56 mcopy
$FBZIMAGE a
:linux
61 dd if=/dev
/zero of
=$FIMAGE bs
=1024 count
=1440 2> /dev
/null
64 echo "$KCMDLINE" | mcopy
- v
:syslinux.cfg
65 if [ -f "$FDINITRD" ] ; then
66 mcopy
"$FDINITRD" v
:initrd.img
68 mcopy
$FBZIMAGE v
:linux
73 dd if=/dev
/zero of
=$FIMAGE bs
=1024 count
=2880 2> /dev
/null
76 echo "$KCMDLINE" | mcopy
- W
:syslinux.cfg
77 if [ -f "$FDINITRD" ] ; then
78 mcopy
"$FDINITRD" w
:initrd.img
80 mcopy
$FBZIMAGE w
:linux
84 tmp_dir
=`dirname $FIMAGE`/isoimage
87 for i
in lib lib64 share
; do
88 for j
in syslinux ISOLINUX
; do
89 if [ -f /usr
/$i/$j/isolinux.bin
] ; then
90 isolinux
=/usr
/$i/$j/isolinux.bin
93 for j
in syslinux syslinux
/modules
/bios
; do
94 if [ -f /usr
/$i/$j/ldlinux.c32
]; then
95 ldlinux
=/usr
/$i/$j/ldlinux.c32
98 if [ -n "$isolinux" -a -n "$ldlinux" ] ; then
102 if [ -z "$isolinux" ] ; then
103 echo 'Need an isolinux.bin file, please install syslinux/isolinux.'
106 if [ -z "$ldlinux" ] ; then
107 echo 'Need an ldlinux.c32 file, please install syslinux/isolinux.'
110 cp $isolinux $tmp_dir
112 cp $FBZIMAGE $tmp_dir/linux
113 echo "$KCMDLINE" > $tmp_dir/isolinux.cfg
114 if [ -f "$FDINITRD" ] ; then
115 cp "$FDINITRD" $tmp_dir/initrd.img
117 genisoimage
-J -r -input-charset=utf-8
-quiet -o $FIMAGE \
118 -b isolinux.bin
-c boot.
cat -no-emul-boot -boot-load-size 4 \
119 -boot-info-table $tmp_dir
120 isohybrid
$FIMAGE 2>/dev
/null || true
126 fdimage144
) genfdimage144
;;
127 fdimage288
) genfdimage288
;;
129 *) echo 'Unknown image format'; exit 1;