iwlwifi: mvm: fix version check for GEO_TX_POWER_LIMIT support
[linux/fpc-iii.git] / arch / x86 / boot / genimage.sh
blob6a10d52a41452d941c22e197fa50b4ebd93ba0d5
1 #!/bin/sh
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
5 # for more details.
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
13 # Arguments:
14 # $1 - fdimage format
15 # $2 - target image file
16 # $3 - kernel bzImage file
17 # $4 - mtool configuration file
18 # $5 - kernel cmdline
19 # $6 - inird image file
22 # Use "make V=1" to debug this script
23 case "${KBUILD_VERBOSE}" in
24 *1*)
25 set -x
27 esac
29 verify () {
30 if [ ! -f "$1" ]; then
31 echo "" 1>&2
32 echo " *** Missing file: $1" 1>&2
33 echo "" 1>&2
34 exit 1
39 export MTOOLSRC=$4
40 FIMAGE=$2
41 FBZIMAGE=$3
42 KCMDLINE=$5
43 FDINITRD=$6
45 # Make sure the files actually exist
46 verify "$FBZIMAGE"
48 genbzdisk() {
49 verify "$MTOOLSRC"
50 mformat a:
51 syslinux $FIMAGE
52 echo "$KCMDLINE" | mcopy - a:syslinux.cfg
53 if [ -f "$FDINITRD" ] ; then
54 mcopy "$FDINITRD" a:initrd.img
56 mcopy $FBZIMAGE a:linux
59 genfdimage144() {
60 verify "$MTOOLSRC"
61 dd if=/dev/zero of=$FIMAGE bs=1024 count=1440 2> /dev/null
62 mformat v:
63 syslinux $FIMAGE
64 echo "$KCMDLINE" | mcopy - v:syslinux.cfg
65 if [ -f "$FDINITRD" ] ; then
66 mcopy "$FDINITRD" v:initrd.img
68 mcopy $FBZIMAGE v:linux
71 genfdimage288() {
72 verify "$MTOOLSRC"
73 dd if=/dev/zero of=$FIMAGE bs=1024 count=2880 2> /dev/null
74 mformat w:
75 syslinux $FIMAGE
76 echo "$KCMDLINE" | mcopy - W:syslinux.cfg
77 if [ -f "$FDINITRD" ] ; then
78 mcopy "$FDINITRD" w:initrd.img
80 mcopy $FBZIMAGE w:linux
83 geniso() {
84 tmp_dir=`dirname $FIMAGE`/isoimage
85 rm -rf $tmp_dir
86 mkdir $tmp_dir
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
92 done
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
97 done
98 if [ -n "$isolinux" -a -n "$ldlinux" ] ; then
99 break
101 done
102 if [ -z "$isolinux" ] ; then
103 echo 'Need an isolinux.bin file, please install syslinux/isolinux.'
104 exit 1
106 if [ -z "$ldlinux" ] ; then
107 echo 'Need an ldlinux.c32 file, please install syslinux/isolinux.'
108 exit 1
110 cp $isolinux $tmp_dir
111 cp $ldlinux $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
121 rm -rf $tmp_dir
124 case $1 in
125 bzdisk) genbzdisk;;
126 fdimage144) genfdimage144;;
127 fdimage288) genfdimage288;;
128 isoimage) geniso;;
129 *) echo 'Unknown image format'; exit 1;
130 esac