ASoC: sun4i-codec: enable 12Khz and 24Khz audio sample rates
[sfrench/cifs-2.6.git] / arch / x86 / boot / genimage.sh
1 #!/bin/sh
2 #
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.
6 #
7 # Copyright (C) 2017 by Changbin Du <changbin.du@intel.com>
8 #
9 # Adapted from code in arch/x86/boot/Makefile by H. Peter Anvin and others
10 #
11 # "make fdimage/fdimage144/fdimage288/isoimage" script for x86 architecture
12 #
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
20 #
21
22 # Use "make V=1" to debug this script
23 case "${KBUILD_VERBOSE}" in
24 *1*)
25         set -x
26         ;;
27 esac
28
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
35         fi
36 }
37
38
39 export MTOOLSRC=$4
40 FIMAGE=$2
41 FBZIMAGE=$3
42 KCMDLINE=$5
43 FDINITRD=$6
44
45 # Make sure the files actually exist
46 verify "$FBZIMAGE"
47 verify "$MTOOLSRC"
48
49 genbzdisk() {
50         mformat a:
51         syslinux $FIMAGE
52         echo "$KCMDLINE" | mcopy - a:syslinux.cfg
53         if [ -f "$FDINITRD" ] ; then
54                 mcopy "$FDINITRD" a:initrd.img
55         fi
56         mcopy $FBZIMAGE a:linux
57 }
58
59 genfdimage144() {
60         dd if=/dev/zero of=$FIMAGE bs=1024 count=1440 2> /dev/null
61         mformat v:
62         syslinux $FIMAGE
63         echo "$KCMDLINE" | mcopy - v:syslinux.cfg
64         if [ -f "$FDINITRD" ] ; then
65                 mcopy "$FDINITRD" v:initrd.img
66         fi
67         mcopy $FBZIMAGE v:linux
68 }
69
70 genfdimage288() {
71         dd if=/dev/zero of=$FIMAGE bs=1024 count=2880 2> /dev/null
72         mformat w:
73         syslinux $FIMAGE
74         echo "$KCMDLINE" | mcopy - W:syslinux.cfg
75         if [ -f "$FDINITRD" ] ; then
76                 mcopy "$FDINITRD" w:initrd.img
77         fi
78         mcopy $FBZIMAGE w:linux
79 }
80
81 genisoimage() {
82         tmp_dir=`dirname $FIMAGE`/isoimage
83         rm -rf $tmp_dir
84         mkdir $tmp_dir
85         for i in lib lib64 share end ; do
86                 for j in syslinux ISOLINUX ; do
87                         if [ -f /usr/$i/$j/isolinux.bin ] ; then
88                                 isolinux=/usr/$i/$j/isolinux.bin
89                                 cp $isolinux $tmp_dir
90                         fi
91                 done
92                 for j in syslinux syslinux/modules/bios ; do
93                         if [ -f /usr/$i/$j/ldlinux.c32 ]; then
94                                 ldlinux=/usr/$i/$j/ldlinux.c32
95                                 cp $ldlinux $tmp_dir
96                         fi
97                 done
98                 if [ -n "$isolinux" -a -n "$ldlinux" ] ; then
99                         break
100                 fi
101                 if [ $i = end -a -z "$isolinux" ] ; then
102                         echo 'Need an isolinux.bin file, please install syslinux/isolinux.'
103                         exit 1
104                 fi
105         done
106         cp $FBZIMAGE $tmp_dir/linux
107         echo "$KCMDLINE" > $tmp_dir/isolinux.cfg
108         if [ -f "$FDINITRD" ] ; then
109                 cp "$FDINITRD" $tmp_dir/initrd.img
110         fi
111         mkisofs -J -r -input-charset=utf-8 -quiet -o $FIMAGE -b isolinux.bin \
112                 -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \
113                 $tmp_dir
114         isohybrid $FIMAGE 2>/dev/null || true
115         rm -rf $tmp_dir
116 }
117
118 case $1 in
119         bzdisk)     genbzdisk;;
120         fdimage144) genfdimage144;;
121         fdimage288) genfdimage288;;
122         isoimage)   genisoimage;;
123         *)          echo 'Unknown image format'; exit 1;
124 esac