Revision 4c3b5a48

b/Makefile
47 47
-include $(SUBDIR_DEVICES_MAK_DEP)
48 48

  
49 49
%/config-devices.mak: default-configs/%.mak
50
	$(call quiet-command,$(SHELL) $(SRC_PATH)/make_device_config.sh $@ $<, "  GEN   $@")
50
	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/make_device_config.sh $@ $<, "  GEN   $@")
51 51
	@if test -f $@; then \
52 52
	  if cmp -s $@.old $@; then \
53 53
	    mv $@.tmp $@; \
......
76 76
config-host.h: config-host.h-timestamp
77 77
config-host.h-timestamp: config-host.mak
78 78
qemu-options.def: $(SRC_PATH)/qemu-options.hx
79
	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $@")
79
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
80 80

  
81 81
SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
82 82

  
......
118 118
trace.h: trace.h-timestamp
119 119
endif
120 120
trace.h-timestamp: $(SRC_PATH)/trace-events config-host.mak
121
	$(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -h < $< > $@,"  GEN   trace.h")
121
	$(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -h < $< > $@,"  GEN   trace.h")
122 122
	@cmp -s $@ trace.h || cp $@ trace.h
123 123

  
124 124
trace.c: trace.c-timestamp
125 125
trace.c-timestamp: $(SRC_PATH)/trace-events config-host.mak
126
	$(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -c < $< > $@,"  GEN   trace.c")
126
	$(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -c < $< > $@,"  GEN   trace.c")
127 127
	@cmp -s $@ trace.c || cp $@ trace.c
128 128

  
129 129
trace.o: trace.c $(GENERATED_HEADERS)
......
136 136
# rule file. So we use '.dtrace' instead
137 137
trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp
138 138
trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events config-host.mak
139
	$(call quiet-command,sh $(SRC_PATH)/tracetool --$(TRACE_BACKEND) -d < $< > $@,"  GEN   trace-dtrace.dtrace")
139
	$(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -d < $< > $@,"  GEN   trace-dtrace.dtrace")
140 140
	@cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace
141 141

  
142 142
trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS)
......
160 160
qemu-io$(EXESUF): qemu-io.o cmd.o qemu-tool.o qemu-error.o $(oslib-obj-y) $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y) qemu-timer-common.o
161 161

  
162 162
qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
163
	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $@")
163
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
164 164

  
165 165
check-qint.o check-qstring.o check-qdict.o check-qlist.o check-qfloat.o check-qjson.o: $(GENERATED_HEADERS)
166 166

  
......
282 282
	$(call quiet-command,texi2pdf $(TEXIFLAG) -I . $<,"  GEN   $@")
283 283

  
284 284
qemu-options.texi: $(SRC_PATH)/qemu-options.hx
285
	$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
285
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
286 286

  
287 287
qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
288
	$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
288
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
289 289

  
290 290
QMP/qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
291
	$(call quiet-command,sh $(SRC_PATH)/hxtool -q < $< > $@,"  GEN   $@")
291
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@,"  GEN   $@")
292 292

  
293 293
qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
294
	$(call quiet-command,sh $(SRC_PATH)/hxtool -t < $< > $@,"  GEN   $@")
294
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
295 295

  
296 296
qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
297 297
	$(call quiet-command, \
298
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu.pod && \
298
	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
299 299
	  pod2man --section=1 --center=" " --release=" " qemu.pod > $@, \
300 300
	  "  GEN   $@")
301 301

  
302 302
qemu-img.1: qemu-img.texi qemu-img-cmds.texi
303 303
	$(call quiet-command, \
304
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-img.pod && \
304
	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-img.pod && \
305 305
	  pod2man --section=1 --center=" " --release=" " qemu-img.pod > $@, \
306 306
	  "  GEN   $@")
307 307

  
308 308
qemu-nbd.8: qemu-nbd.texi
309 309
	$(call quiet-command, \
310
	  perl -Ww -- $(SRC_PATH)/texi2pod.pl $< qemu-nbd.pod && \
310
	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu-nbd.pod && \
311 311
	  pod2man --section=8 --center=" " --release=" " qemu-nbd.pod > $@, \
312 312
	  "  GEN   $@")
313 313

  
b/Makefile.target
52 52
endif
53 53

  
54 54
$(QEMU_PROG).stp:
55
	$(call quiet-command,sh $(SRC_PATH)/tracetool \
55
	$(call quiet-command,sh $(SRC_PATH)/scripts/tracetool \
56 56
		--$(TRACE_BACKEND) \
57 57
		--binary $(bindir)/$(QEMU_PROG) \
58 58
		--target-arch $(TARGET_ARCH) \
......
344 344
	$(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y))
345 345

  
346 346

  
347
gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/feature_to_c.sh
348
	$(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
347
gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
348
	$(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
349 349

  
350 350
hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
351
	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
351
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
352 352

  
353 353
qmp-commands.h: $(SRC_PATH)/qmp-commands.hx
354
	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
354
	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
355 355

  
356 356
clean:
357 357
	rm -f *.o *.a *~ $(PROGS) nwfpe/*.o fpu/*.o
b/configure
2266 2266
##########################################
2267 2267
# check if trace backend exists
2268 2268

  
2269
sh "$source_path/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
2269
sh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
2270 2270
if test "$?" -ne 0 ; then
2271 2271
  echo
2272 2272
  echo "Error: invalid trace backend"
/dev/null
1
#!/bin/sh
2

  
3
echo "/* Automatically generated by create_config - do not modify */"
4

  
5
while read line; do
6

  
7
case $line in
8
 VERSION=*) # configuration
9
    version=${line#*=}
10
    echo "#define QEMU_VERSION \"$version\""
11
    ;;
12
 PKGVERSION=*) # configuration
13
    pkgversion=${line#*=}
14
    echo "#define QEMU_PKGVERSION \"$pkgversion\""
15
    ;;
16
 prefix=* | [a-z]*dir=*) # directory configuration
17
    name=${line%=*}
18
    value=${line#*=}
19
    define_name=`echo $name | tr '[:lower:]' '[:upper:]'`
20
    eval "define_value=\"$value\""
21
    echo "#define CONFIG_QEMU_$define_name \"$define_value\""
22
    # save for the next definitions
23
    eval "$name=\$define_value"
24
    ;;
25
 CONFIG_AUDIO_DRIVERS=*)
26
    drivers=${line#*=}
27
    echo "#define CONFIG_AUDIO_DRIVERS \\"
28
    for drv in $drivers; do
29
      echo "    &${drv}_audio_driver,\\"
30
    done
31
    echo ""
32
    ;;
33
 CONFIG_BDRV_WHITELIST=*)
34
    echo "#define CONFIG_BDRV_WHITELIST \\"
35
    for drv in ${line#*=}; do
36
      echo "    \"${drv}\",\\"
37
    done
38
    echo "    NULL"
39
    ;;
40
 CONFIG_*=y) # configuration
41
    name=${line%=*}
42
    echo "#define $name 1"
43
    ;;
44
 CONFIG_*=*) # configuration
45
    name=${line%=*}
46
    value=${line#*=}
47
    echo "#define $name $value"
48
    ;;
49
 ARCH=*) # configuration
50
    arch=${line#*=}
51
    arch_name=`echo $arch | tr '[:lower:]' '[:upper:]'`
52
    echo "#define HOST_$arch_name 1"
53
    ;;
54
 HOST_USB=*)
55
    # do nothing
56
    ;;
57
 HOST_CC=*)
58
    # do nothing
59
    ;;
60
 HOST_*=y) # configuration
61
    name=${line%=*}
62
    echo "#define $name 1"
63
    ;;
64
 HOST_*=*) # configuration
65
    name=${line%=*}
66
    value=${line#*=}
67
    echo "#define $name $value"
68
    ;;
69
 TARGET_ARCH=*) # configuration
70
    target_arch=${line#*=}
71
    echo "#define TARGET_ARCH \"$target_arch\""
72
    ;;
73
 TARGET_BASE_ARCH=*) # configuration
74
    target_base_arch=${line#*=}
75
    if [ "$target_base_arch" != "$target_arch" ]; then
76
      base_arch_name=`echo $target_base_arch | tr '[:lower:]' '[:upper:]'`
77
      echo "#define TARGET_$base_arch_name 1"
78
    fi
79
    ;;
80
 TARGET_XML_FILES=*)
81
    # do nothing
82
    ;;
83
 TARGET_ABI_DIR=*)
84
    # do nothing
85
    ;;
86
 TARGET_ARCH2=*)
87
    # do nothing
88
    ;;
89
 TARGET_DIRS=*)
90
    # do nothing
91
    ;;
92
 TARGET_*=y) # configuration
93
    name=${line%=*}
94
    echo "#define $name 1"
95
    ;;
96
 TARGET_*=*) # configuration
97
    name=${line%=*}
98
    value=${line#*=}
99
    echo "#define $name $value"
100
    ;;
101
esac
102

  
103
done # read
/dev/null
1
#!/bin/sh
2

  
3
# Convert text files to compilable C arrays.
4
#
5
# Copyright (C) 2007 Free Software Foundation, Inc.
6
#
7
# This file is part of GDB.
8
#
9
# This program is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2 of the License, or
12
# (at your option) any later version.
13
#
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with this program; if not, see <http://www.gnu.org/licenses/>.
21

  
22
output=$1
23
shift
24

  
25
if test -z "$output" || test -z "$1"; then
26
  echo "Usage: $0 OUTPUTFILE INPUTFILE..."
27
  exit 1
28
fi
29

  
30
if test -e "$output"; then
31
  echo "Output file \"$output\" already exists; refusing to overwrite."
32
  exit 1
33
fi
34

  
35
for input; do
36
  arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'`
37

  
38
  ${AWK:-awk} 'BEGIN { n = 0
39
      print "static const char '$arrayname'[] = {"
40
      for (i = 0; i < 255; i++)
41
        _ord_[sprintf("%c", i)] = i
42
    } {
43
      split($0, line, "");
44
      printf "  "
45
      for (i = 1; i <= length($0); i++) {
46
        c = line[i]
47
        if (c == "'\''") {
48
          printf "'\''\\'\'''\'', "
49
        } else if (c == "\\") {
50
          printf "'\''\\\\'\'', "
51
        } else if (_ord_[c] >= 32 && _ord_[c] < 127) {
52
	  printf "'\''%s'\'', ", c
53
        } else {
54
          printf "'\''\\%03o'\'', ", _ord_[c]
55
        }
56
        if (i % 10 == 0)
57
          printf "\n   "
58
      }
59
      printf "'\''\\n'\'', \n"
60
    } END {
61
      print "  0 };"
62
    }' < $input >> $output
63
done
64

  
65
echo >> $output
66
echo "const char *const xml_builtin[][2] = {" >> $output
67

  
68
for input; do
69
  basename=`echo $input | sed 's,.*/,,'`
70
  arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'`
71
  echo "  { \"$basename\", $arrayname }," >> $output
72
done
73

  
74
echo "  { (char *)0, (char *)0 }" >> $output
75
echo "};" >> $output
b/gdbstub.h
38 38
int gdbserver_start(const char *port);
39 39
#endif
40 40

  
41
/* in gdbstub-xml.c, generated by feature_to_c.sh */
41
/* in gdbstub-xml.c, generated by scripts/feature_to_c.sh */
42 42
extern const char *const xml_builtin[][2];
43 43

  
44 44
#endif
/dev/null
1
#!/bin/sh
2

  
3
hxtoh()
4
{
5
    flag=1
6
    while read -r str; do
7
        case $str in
8
            HXCOMM*)
9
            ;;
10
            STEXI*|ETEXI*|SQMP*|EQMP*) flag=$(($flag^1))
11
            ;;
12
            *)
13
            test $flag -eq 1 && printf "%s\n" "$str"
14
            ;;
15
        esac
16
    done
17
}
18

  
19
hxtotexi()
20
{
21
    flag=0
22
    line=1
23
    while read -r str; do
24
        case "$str" in
25
            HXCOMM*)
26
            ;;
27
            STEXI*)
28
            if test $flag -eq 1 ; then
29
                echo "line $line: syntax error: expected ETEXI, found $str" >&2
30
                exit 1
31
            fi
32
            flag=1
33
            ;;
34
            ETEXI*)
35
            if test $flag -ne 1 ; then
36
                echo "line $line: syntax error: expected STEXI, found $str" >&2
37
                exit 1
38
            fi
39
            flag=0
40
            ;;
41
            SQMP*|EQMP*)
42
            if test $flag -eq 1 ; then
43
                echo "line $line: syntax error: expected ETEXI, found $str" >&2
44
                exit 1
45
            fi
46
            ;;
47
            DEFHEADING*)
48
            echo "$(expr "$str" : "DEFHEADING(\(.*\))")"
49
            ;;
50
            *)
51
            test $flag -eq 1 && echo "$str"
52
            ;;
53
        esac
54
        line=$((line+1))
55
    done
56
}
57

  
58
hxtoqmp()
59
{
60
    IFS=
61
    flag=0
62
    line=1
63
    while read -r str; do
64
        case "$str" in
65
            HXCOMM*)
66
            ;;
67
            SQMP*)
68
            if test $flag -eq 1 ; then
69
                echo "line $line: syntax error: expected EQMP, found $str" >&2
70
                exit 1
71
            fi
72
            flag=1
73
            ;;
74
            EQMP*)
75
            if test $flag -ne 1 ; then
76
                echo "line $line: syntax error: expected SQMP, found $str" >&2
77
                exit 1
78
            fi
79
            flag=0
80
            ;;
81
            STEXI*|ETEXI*)
82
            if test $flag -eq 1 ; then
83
                echo "line $line: syntax error: expected EQMP, found $str" >&2
84
                exit 1
85
            fi
86
            ;;
87
            *)
88
            test $flag -eq 1 && echo "$str"
89
            ;;
90
        esac
91
        line=$((line+1))
92
    done
93
}
94

  
95
case "$1" in
96
"-h") hxtoh ;;
97
"-t") hxtotexi ;;
98
"-q") hxtoqmp ;;
99
*) exit 1 ;;
100
esac
101

  
102
exit 0
/dev/null
1
#! /bin/sh
2
# Construct a target device config file from a default, pulling in any
3
# files from include directives.
4

  
5
dest=$1.tmp
6
dep=$1.d
7
src=$2
8
src_dir=`dirname $src`
9
all_includes=
10

  
11
process_includes () {
12
  cat $1 | grep '^include' | \
13
  while read include file ; do
14
    all_includes="$all_includes $src_dir/$file"
15
    process_includes $src_dir/$file
16
  done
17
}
18

  
19
f=$src
20
while [ -n "$f" ] ; do
21
  f=`tr -d '\r' < $f | awk '/^include / {printf "'$src_dir'/%s", $2}'`
22
  [ $? = 0 ] || exit 1
23
  all_includes="$all_includes $f"
24
done
25
process_includes $src > $dest
26

  
27
cat $src $all_includes | grep -v '^include' > $dest
28
echo "$1: $all_includes" > $dep
b/pc-bios/optionrom/Makefile
23 23
	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"  Building $(TARGET_DIR)$@")
24 24

  
25 25
%.bin: %.raw
26
	$(call quiet-command,$(SHELL) $(SRC_PATH)/pc-bios/optionrom/signrom.sh $< $@,"  Signing $(TARGET_DIR)$@")
26
	$(call quiet-command,$(SHELL) $(SRC_PATH)/scripts/signrom.sh $< $@,"  Signing $(TARGET_DIR)$@")
27 27

  
28 28
clean:
29 29
	rm -f *.o *.d *.raw *.img *.bin *~
/dev/null
1
#!/bin/sh
2

  
3
# Option ROM Signing utility
4
#
5
# This program 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 2 of the License, or
8
# (at your option) any later version.
9
#
10
# This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
17
#
18
# Copyright Novell Inc, 2009
19
#   Authors: Alexander Graf <agraf@suse.de>
20
#
21
# Syntax: signrom.sh <input> <output>
22

  
23
# did we get proper arguments?
24
test "$1" -a "$2" || exit 1
25

  
26
sum=0
27

  
28
# find out the file size
29
x=`dd if="$1" bs=1 count=1 skip=2 2>/dev/null | od -t u1 -A n`
30
#size=`expr $x \* 512 - 1`
31
size=$(( $x * 512 - 1 ))
32

  
33
# now get the checksum
34
nums=`od -A n -t u1 -v -N $size "$1"`
35
for i in ${nums}; do
36
    # add each byte's value to sum
37
    sum=`expr \( $sum + $i \) % 256`
38
done
39

  
40
sum=$(( (256 - $sum) % 256 ))
41
sum_octal=$( printf "%o" $sum )
42

  
43
# and write the output file
44
cp "$1" "$2"
45
printf "\\$sum_octal" | dd of="$2" bs=1 count=1 seek=$size conv=notrunc 2>/dev/null
/dev/null
1
#!/bin/sh
2
# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC program execution by the kernel
3

  
4
# load the binfmt_misc module
5
if [ ! -d /proc/sys/fs/binfmt_misc ]; then
6
  /sbin/modprobe binfmt_misc
7
fi
8
if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
9
  mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
10
fi
11

  
12
# probe cpu type
13
cpu=`uname -m`
14
case "$cpu" in
15
  i386|i486|i586|i686|i86pc|BePC|x86_64)
16
    cpu="i386"
17
  ;;
18
  m68k)
19
    cpu="m68k"
20
  ;;
21
  mips*)
22
    cpu="mips"
23
  ;;
24
  "Power Macintosh"|ppc|ppc64)
25
    cpu="ppc"
26
  ;;
27
  armv[4-9]*)
28
    cpu="arm"
29
  ;;
30
esac
31

  
32
# register the interpreter for each cpu except for the native one
33
if [ $cpu != "i386" ] ; then
34
    echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
35
    echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
36
fi
37
if [ $cpu != "alpha" ] ; then
38
    echo ':alpha:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-alpha:' > /proc/sys/fs/binfmt_misc/register
39
fi
40
if [ $cpu != "arm" ] ; then
41
    echo   ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-arm:' > /proc/sys/fs/binfmt_misc/register
42
    echo   ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-armeb:' > /proc/sys/fs/binfmt_misc/register
43
fi
44
if [ $cpu != "sparc" ] ; then
45
    echo   ':sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-sparc:' > /proc/sys/fs/binfmt_misc/register
46
fi
47
if [ $cpu != "ppc" ] ; then
48
    echo   ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-ppc:' > /proc/sys/fs/binfmt_misc/register
49
fi
50
if [ $cpu != "m68k" ] ; then
51
    echo   'Please check cpu value and header information for m68k!'
52
    echo   ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-m68k:' > /proc/sys/fs/binfmt_misc/register
53
fi
54
if [ $cpu != "mips" ] ; then
55
    # FIXME: We could use the other endianness on a MIPS host.
56
    echo   ':mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mips:' > /proc/sys/fs/binfmt_misc/register
57
    echo   ':mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mipsel:' > /proc/sys/fs/binfmt_misc/register
58
    echo   ':mipsn32:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mipsn32:' > /proc/sys/fs/binfmt_misc/register
59
    echo   ':mipsn32el:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mipsn32el:' > /proc/sys/fs/binfmt_misc/register
60
    echo   ':mips64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mips64:' > /proc/sys/fs/binfmt_misc/register
61
    echo   ':mips64el:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mips64el:' > /proc/sys/fs/binfmt_misc/register
62
fi
63
if [ $cpu != "sh" ] ; then
64
    echo    ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-sh4:' > /proc/sys/fs/binfmt_misc/register
65
    echo    ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-sh4eb:' > /proc/sys/fs/binfmt_misc/register
66
fi
b/qemu-doc.texi
2132 2132
@example
2133 2133
qemu-i386 tests/i386/ls
2134 2134
@end example
2135
You can look at @file{qemu-binfmt-conf.sh} so that
2135
You can look at @file{scripts/qemu-binfmt-conf.sh} so that
2136 2136
QEMU is automatically launched by the Linux kernel when you try to
2137 2137
launch x86 executables. It requires the @code{binfmt_misc} module in the
2138 2138
Linux kernel.
b/rules.mak
57 57
	@test -f $@ || cp $< $@
58 58

  
59 59
%.h-timestamp: %.mak
60
	$(call quiet-command, sh $(SRC_PATH)/create_config < $< > $@, "  GEN   $*.h")
60
	$(call quiet-command, sh $(SRC_PATH)/scripts/create_config < $< > $@, "  GEN   $*.h")
61 61
	@cmp $@ $*.h >/dev/null 2>&1 || cp $@ $*.h
62 62

  
63 63
# will delete the target of a rule if commands exit with a nonzero exit status
b/scripts/create_config
1
#!/bin/sh
2

  
3
echo "/* Automatically generated by create_config - do not modify */"
4

  
5
while read line; do
6

  
7
case $line in
8
 VERSION=*) # configuration
9
    version=${line#*=}
10
    echo "#define QEMU_VERSION \"$version\""
11
    ;;
12
 PKGVERSION=*) # configuration
13
    pkgversion=${line#*=}
14
    echo "#define QEMU_PKGVERSION \"$pkgversion\""
15
    ;;
16
 prefix=* | [a-z]*dir=*) # directory configuration
17
    name=${line%=*}
18
    value=${line#*=}
19
    define_name=`echo $name | tr '[:lower:]' '[:upper:]'`
20
    eval "define_value=\"$value\""
21
    echo "#define CONFIG_QEMU_$define_name \"$define_value\""
22
    # save for the next definitions
23
    eval "$name=\$define_value"
24
    ;;
25
 CONFIG_AUDIO_DRIVERS=*)
26
    drivers=${line#*=}
27
    echo "#define CONFIG_AUDIO_DRIVERS \\"
28
    for drv in $drivers; do
29
      echo "    &${drv}_audio_driver,\\"
30
    done
31
    echo ""
32
    ;;
33
 CONFIG_BDRV_WHITELIST=*)
34
    echo "#define CONFIG_BDRV_WHITELIST \\"
35
    for drv in ${line#*=}; do
36
      echo "    \"${drv}\",\\"
37
    done
38
    echo "    NULL"
39
    ;;
40
 CONFIG_*=y) # configuration
41
    name=${line%=*}
42
    echo "#define $name 1"
43
    ;;
44
 CONFIG_*=*) # configuration
45
    name=${line%=*}
46
    value=${line#*=}
47
    echo "#define $name $value"
48
    ;;
49
 ARCH=*) # configuration
50
    arch=${line#*=}
51
    arch_name=`echo $arch | tr '[:lower:]' '[:upper:]'`
52
    echo "#define HOST_$arch_name 1"
53
    ;;
54
 HOST_USB=*)
55
    # do nothing
56
    ;;
57
 HOST_CC=*)
58
    # do nothing
59
    ;;
60
 HOST_*=y) # configuration
61
    name=${line%=*}
62
    echo "#define $name 1"
63
    ;;
64
 HOST_*=*) # configuration
65
    name=${line%=*}
66
    value=${line#*=}
67
    echo "#define $name $value"
68
    ;;
69
 TARGET_ARCH=*) # configuration
70
    target_arch=${line#*=}
71
    echo "#define TARGET_ARCH \"$target_arch\""
72
    ;;
73
 TARGET_BASE_ARCH=*) # configuration
74
    target_base_arch=${line#*=}
75
    if [ "$target_base_arch" != "$target_arch" ]; then
76
      base_arch_name=`echo $target_base_arch | tr '[:lower:]' '[:upper:]'`
77
      echo "#define TARGET_$base_arch_name 1"
78
    fi
79
    ;;
80
 TARGET_XML_FILES=*)
81
    # do nothing
82
    ;;
83
 TARGET_ABI_DIR=*)
84
    # do nothing
85
    ;;
86
 TARGET_ARCH2=*)
87
    # do nothing
88
    ;;
89
 TARGET_DIRS=*)
90
    # do nothing
91
    ;;
92
 TARGET_*=y) # configuration
93
    name=${line%=*}
94
    echo "#define $name 1"
95
    ;;
96
 TARGET_*=*) # configuration
97
    name=${line%=*}
98
    value=${line#*=}
99
    echo "#define $name $value"
100
    ;;
101
esac
102

  
103
done # read
b/scripts/feature_to_c.sh
1
#!/bin/sh
2

  
3
# Convert text files to compilable C arrays.
4
#
5
# Copyright (C) 2007 Free Software Foundation, Inc.
6
#
7
# This file is part of GDB.
8
#
9
# This program is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2 of the License, or
12
# (at your option) any later version.
13
#
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with this program; if not, see <http://www.gnu.org/licenses/>.
21

  
22
output=$1
23
shift
24

  
25
if test -z "$output" || test -z "$1"; then
26
  echo "Usage: $0 OUTPUTFILE INPUTFILE..."
27
  exit 1
28
fi
29

  
30
if test -e "$output"; then
31
  echo "Output file \"$output\" already exists; refusing to overwrite."
32
  exit 1
33
fi
34

  
35
for input; do
36
  arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'`
37

  
38
  ${AWK:-awk} 'BEGIN { n = 0
39
      print "static const char '$arrayname'[] = {"
40
      for (i = 0; i < 255; i++)
41
        _ord_[sprintf("%c", i)] = i
42
    } {
43
      split($0, line, "");
44
      printf "  "
45
      for (i = 1; i <= length($0); i++) {
46
        c = line[i]
47
        if (c == "'\''") {
48
          printf "'\''\\'\'''\'', "
49
        } else if (c == "\\") {
50
          printf "'\''\\\\'\'', "
51
        } else if (_ord_[c] >= 32 && _ord_[c] < 127) {
52
	  printf "'\''%s'\'', ", c
53
        } else {
54
          printf "'\''\\%03o'\'', ", _ord_[c]
55
        }
56
        if (i % 10 == 0)
57
          printf "\n   "
58
      }
59
      printf "'\''\\n'\'', \n"
60
    } END {
61
      print "  0 };"
62
    }' < $input >> $output
63
done
64

  
65
echo >> $output
66
echo "const char *const xml_builtin[][2] = {" >> $output
67

  
68
for input; do
69
  basename=`echo $input | sed 's,.*/,,'`
70
  arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'`
71
  echo "  { \"$basename\", $arrayname }," >> $output
72
done
73

  
74
echo "  { (char *)0, (char *)0 }" >> $output
75
echo "};" >> $output
b/scripts/hxtool
1
#!/bin/sh
2

  
3
hxtoh()
4
{
5
    flag=1
6
    while read -r str; do
7
        case $str in
8
            HXCOMM*)
9
            ;;
10
            STEXI*|ETEXI*|SQMP*|EQMP*) flag=$(($flag^1))
11
            ;;
12
            *)
13
            test $flag -eq 1 && printf "%s\n" "$str"
14
            ;;
15
        esac
16
    done
17
}
18

  
19
hxtotexi()
20
{
21
    flag=0
22
    line=1
23
    while read -r str; do
24
        case "$str" in
25
            HXCOMM*)
26
            ;;
27
            STEXI*)
28
            if test $flag -eq 1 ; then
29
                echo "line $line: syntax error: expected ETEXI, found $str" >&2
30
                exit 1
31
            fi
32
            flag=1
33
            ;;
34
            ETEXI*)
35
            if test $flag -ne 1 ; then
36
                echo "line $line: syntax error: expected STEXI, found $str" >&2
37
                exit 1
38
            fi
39
            flag=0
40
            ;;
41
            SQMP*|EQMP*)
42
            if test $flag -eq 1 ; then
43
                echo "line $line: syntax error: expected ETEXI, found $str" >&2
44
                exit 1
45
            fi
46
            ;;
47
            DEFHEADING*)
48
            echo "$(expr "$str" : "DEFHEADING(\(.*\))")"
49
            ;;
50
            *)
51
            test $flag -eq 1 && echo "$str"
52
            ;;
53
        esac
54
        line=$((line+1))
55
    done
56
}
57

  
58
hxtoqmp()
59
{
60
    IFS=
61
    flag=0
62
    line=1
63
    while read -r str; do
64
        case "$str" in
65
            HXCOMM*)
66
            ;;
67
            SQMP*)
68
            if test $flag -eq 1 ; then
69
                echo "line $line: syntax error: expected EQMP, found $str" >&2
70
                exit 1
71
            fi
72
            flag=1
73
            ;;
74
            EQMP*)
75
            if test $flag -ne 1 ; then
76
                echo "line $line: syntax error: expected SQMP, found $str" >&2
77
                exit 1
78
            fi
79
            flag=0
80
            ;;
81
            STEXI*|ETEXI*)
82
            if test $flag -eq 1 ; then
83
                echo "line $line: syntax error: expected EQMP, found $str" >&2
84
                exit 1
85
            fi
86
            ;;
87
            *)
88
            test $flag -eq 1 && echo "$str"
89
            ;;
90
        esac
91
        line=$((line+1))
92
    done
93
}
94

  
95
case "$1" in
96
"-h") hxtoh ;;
97
"-t") hxtotexi ;;
98
"-q") hxtoqmp ;;
99
*) exit 1 ;;
100
esac
101

  
102
exit 0
b/scripts/make_device_config.sh
1
#! /bin/sh
2
# Construct a target device config file from a default, pulling in any
3
# files from include directives.
4

  
5
dest=$1.tmp
6
dep=$1.d
7
src=$2
8
src_dir=`dirname $src`
9
all_includes=
10

  
11
process_includes () {
12
  cat $1 | grep '^include' | \
13
  while read include file ; do
14
    all_includes="$all_includes $src_dir/$file"
15
    process_includes $src_dir/$file
16
  done
17
}
18

  
19
f=$src
20
while [ -n "$f" ] ; do
21
  f=`tr -d '\r' < $f | awk '/^include / {printf "'$src_dir'/%s", $2}'`
22
  [ $? = 0 ] || exit 1
23
  all_includes="$all_includes $f"
24
done
25
process_includes $src > $dest
26

  
27
cat $src $all_includes | grep -v '^include' > $dest
28
echo "$1: $all_includes" > $dep
b/scripts/qemu-binfmt-conf.sh
1
#!/bin/sh
2
# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC program execution by the kernel
3

  
4
# load the binfmt_misc module
5
if [ ! -d /proc/sys/fs/binfmt_misc ]; then
6
  /sbin/modprobe binfmt_misc
7
fi
8
if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
9
  mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
10
fi
11

  
12
# probe cpu type
13
cpu=`uname -m`
14
case "$cpu" in
15
  i386|i486|i586|i686|i86pc|BePC|x86_64)
16
    cpu="i386"
17
  ;;
18
  m68k)
19
    cpu="m68k"
20
  ;;
21
  mips*)
22
    cpu="mips"
23
  ;;
24
  "Power Macintosh"|ppc|ppc64)
25
    cpu="ppc"
26
  ;;
27
  armv[4-9]*)
28
    cpu="arm"
29
  ;;
30
esac
31

  
32
# register the interpreter for each cpu except for the native one
33
if [ $cpu != "i386" ] ; then
34
    echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
35
    echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
36
fi
37
if [ $cpu != "alpha" ] ; then
38
    echo ':alpha:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-alpha:' > /proc/sys/fs/binfmt_misc/register
39
fi
40
if [ $cpu != "arm" ] ; then
41
    echo   ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-arm:' > /proc/sys/fs/binfmt_misc/register
42
    echo   ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-armeb:' > /proc/sys/fs/binfmt_misc/register
43
fi
44
if [ $cpu != "sparc" ] ; then
45
    echo   ':sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-sparc:' > /proc/sys/fs/binfmt_misc/register
46
fi
47
if [ $cpu != "ppc" ] ; then
48
    echo   ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-ppc:' > /proc/sys/fs/binfmt_misc/register
49
fi
50
if [ $cpu != "m68k" ] ; then
51
    echo   'Please check cpu value and header information for m68k!'
52
    echo   ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-m68k:' > /proc/sys/fs/binfmt_misc/register
53
fi
54
if [ $cpu != "mips" ] ; then
55
    # FIXME: We could use the other endianness on a MIPS host.
56
    echo   ':mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mips:' > /proc/sys/fs/binfmt_misc/register
57
    echo   ':mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mipsel:' > /proc/sys/fs/binfmt_misc/register
58
    echo   ':mipsn32:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mipsn32:' > /proc/sys/fs/binfmt_misc/register
59
    echo   ':mipsn32el:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mipsn32el:' > /proc/sys/fs/binfmt_misc/register
60
    echo   ':mips64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mips64:' > /proc/sys/fs/binfmt_misc/register
61
    echo   ':mips64el:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mips64el:' > /proc/sys/fs/binfmt_misc/register
62
fi
63
if [ $cpu != "sh" ] ; then
64
    echo    ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-sh4:' > /proc/sys/fs/binfmt_misc/register
65
    echo    ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-sh4eb:' > /proc/sys/fs/binfmt_misc/register
66
fi
b/scripts/signrom.sh
1
#!/bin/sh
2

  
3
# Option ROM Signing utility
4
#
5
# This program 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 2 of the License, or
8
# (at your option) any later version.
9
#
10
# This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
17
#
18
# Copyright Novell Inc, 2009
19
#   Authors: Alexander Graf <agraf@suse.de>
20
#
21
# Syntax: signrom.sh <input> <output>
22

  
23
# did we get proper arguments?
24
test "$1" -a "$2" || exit 1
25

  
26
sum=0
27

  
28
# find out the file size
29
x=`dd if="$1" bs=1 count=1 skip=2 2>/dev/null | od -t u1 -A n`
30
#size=`expr $x \* 512 - 1`
31
size=$(( $x * 512 - 1 ))
32

  
33
# now get the checksum
34
nums=`od -A n -t u1 -v -N $size "$1"`
35
for i in ${nums}; do
36
    # add each byte's value to sum
37
    sum=`expr \( $sum + $i \) % 256`
38
done
39

  
40
sum=$(( (256 - $sum) % 256 ))
41
sum_octal=$( printf "%o" $sum )
42

  
43
# and write the output file
44
cp "$1" "$2"
45
printf "\\$sum_octal" | dd of="$2" bs=1 count=1 seek=$size conv=notrunc 2>/dev/null
b/scripts/simpletrace.py
1
#!/usr/bin/env python
2
#
3
# Pretty-printer for simple trace backend binary trace files
4
#
5
# Copyright IBM, Corp. 2010
6
#
7
# This work is licensed under the terms of the GNU GPL, version 2.  See
8
# the COPYING file in the top-level directory.
9
#
10
# For help see docs/tracing.txt
11

  
12
import sys
13
import struct
14
import re
15

  
16
header_event_id = 0xffffffffffffffff
17
header_magic    = 0xf2b177cb0aa429b4
18
header_version  = 0
19

  
20
trace_fmt = '=QQQQQQQQ'
21
trace_len = struct.calcsize(trace_fmt)
22
event_re  = re.compile(r'(disable\s+)?([a-zA-Z0-9_]+)\(([^)]*)\).*')
23

  
24
def err(msg):
25
    sys.stderr.write(msg + '\n')
26
    sys.exit(1)
27

  
28
def parse_events(fobj):
29
    """Parse a trace-events file."""
30

  
31
    def get_argnames(args):
32
        """Extract argument names from a parameter list."""
33
        return tuple(arg.split()[-1].lstrip('*') for arg in args.split(','))
34

  
35
    events = {}
36
    event_num = 0
37
    for line in fobj:
38
        m = event_re.match(line.strip())
39
        if m is None:
40
            continue
41

  
42
        disable, name, args = m.groups()
43
        events[event_num] = (name,) + get_argnames(args)
44
        event_num += 1
45
    return events
46

  
47
def read_record(fobj):
48
    """Deserialize a trace record from a file."""
49
    s = fobj.read(trace_len)
50
    if len(s) != trace_len:
51
        return None
52
    return struct.unpack(trace_fmt, s)
53

  
54
def read_trace_file(fobj):
55
    """Deserialize trace records from a file."""
56
    header = read_record(fobj)
57
    if header is None or \
58
       header[0] != header_event_id or \
59
       header[1] != header_magic or \
60
       header[2] != header_version:
61
        err('not a trace file or incompatible version')
62

  
63
    while True:
64
        rec = read_record(fobj)
65
        if rec is None:
66
            break
67

  
68
        yield rec
69

  
70
class Formatter(object):
71
    def __init__(self, events):
72
        self.events = events
73
        self.last_timestamp = None
74

  
75
    def format_record(self, rec):
76
        if self.last_timestamp is None:
77
            self.last_timestamp = rec[1]
78
        delta_ns = rec[1] - self.last_timestamp
79
        self.last_timestamp = rec[1]
80

  
81
        event = self.events[rec[0]]
82
        fields = [event[0], '%0.3f' % (delta_ns / 1000.0)]
83
        for i in xrange(1, len(event)):
84
            fields.append('%s=0x%x' % (event[i], rec[i + 1]))
85
        return ' '.join(fields)
86

  
87
if len(sys.argv) != 3:
88
    err('usage: %s <trace-events> <trace-file>' % sys.argv[0])
89

  
90
events = parse_events(open(sys.argv[1], 'r'))
91
formatter = Formatter(events)
92
for rec in read_trace_file(open(sys.argv[2], 'rb')):
93
    print formatter.format_record(rec)
b/scripts/texi2pod.pl
1
#! /usr/bin/perl -w
2

  
3
#   Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
4

  
5
# This file is part of GCC.
6

  
7
# GCC is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 2, or (at your option)
10
# any later version.
11

  
12
# GCC is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
# GNU General Public License for more details.
16

  
17
# You should have received a copy of the GNU General Public License
18
# along with GCC; see the file COPYING.  If not,
19
# see <http://www.gnu.org/licenses/>.
20

  
21
# This does trivial (and I mean _trivial_) conversion of Texinfo
22
# markup to Perl POD format.  It's intended to be used to extract
23
# something suitable for a manpage from a Texinfo document.
24

  
25
$output = 0;
26
$skipping = 0;
27
%sects = ();
28
$section = "";
29
@icstack = ();
30
@endwstack = ();
31
@skstack = ();
32
@instack = ();
33
$shift = "";
34
%defs = ();
35
$fnno = 1;
36
$inf = "";
37
$ibase = "";
38
@ipath = ();
39

  
40
while ($_ = shift) {
41
    if (/^-D(.*)$/) {
42
	if ($1 ne "") {
43
	    $flag = $1;
44
	} else {
45
	    $flag = shift;
46
	}
47
	$value = "";
48
	($flag, $value) = ($flag =~ /^([^=]+)(?:=(.+))?/);
49
	die "no flag specified for -D\n"
50
	    unless $flag ne "";
51
	die "flags may only contain letters, digits, hyphens, dashes and underscores\n"
52
	    unless $flag =~ /^[a-zA-Z0-9_-]+$/;
53
	$defs{$flag} = $value;
54
    } elsif (/^-I(.*)$/) {
55
	if ($1 ne "") {
56
	    $flag = $1;
57
	} else {
58
	    $flag = shift;
59
	}
60
        push (@ipath, $flag);
61
    } elsif (/^-/) {
62
	usage();
63
    } else {
64
	$in = $_, next unless defined $in;
65
	$out = $_, next unless defined $out;
66
	usage();
67
    }
68
}
69

  
70
if (defined $in) {
71
    $inf = gensym();
72
    open($inf, "<$in") or die "opening \"$in\": $!\n";
73
    $ibase = $1 if $in =~ m|^(.+)/[^/]+$|;
74
} else {
75
    $inf = \*STDIN;
76
}
77

  
78
if (defined $out) {
79
    open(STDOUT, ">$out") or die "opening \"$out\": $!\n";
80
}
81

  
82
while(defined $inf) {
83
while(<$inf>) {
84
    # Certain commands are discarded without further processing.
85
    /^\@(?:
86
	 [a-z]+index		# @*index: useful only in complete manual
87
	 |need			# @need: useful only in printed manual
88
	 |(?:end\s+)?group	# @group .. @end group: ditto
89
	 |page			# @page: ditto
90
	 |node			# @node: useful only in .info file
91
	 |(?:end\s+)?ifnottex   # @ifnottex .. @end ifnottex: use contents
92
	)\b/x and next;
93

  
94
    chomp;
95

  
96
    # Look for filename and title markers.
97
    /^\@setfilename\s+([^.]+)/ and $fn = $1, next;
98
    /^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next;
99

  
100
    # Identify a man title but keep only the one we are interested in.
101
    /^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do {
102
	if (exists $defs{$1}) {
103
	    $fn = $1;
104
	    $tl = postprocess($2);
105
	}
106
	next;
107
    };
108

  
109
    # Look for blocks surrounded by @c man begin SECTION ... @c man end.
110
    # This really oughta be @ifman ... @end ifman and the like, but such
111
    # would require rev'ing all other Texinfo translators.
112
    /^\@c\s+man\s+begin\s+([A-Z]+)\s+([A-Za-z0-9-]+)/ and do {
113
	$output = 1 if exists $defs{$2};
114
        $sect = $1;
115
	next;
116
    };
117
    /^\@c\s+man\s+begin\s+([A-Z]+)/ and $sect = $1, $output = 1, next;
118
    /^\@c\s+man\s+end/ and do {
119
	$sects{$sect} = "" unless exists $sects{$sect};
120
	$sects{$sect} .= postprocess($section);
121
	$section = "";
122
	$output = 0;
123
	next;
124
    };
125

  
126
    # handle variables
127
    /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do {
128
	$defs{$1} = $2;
129
	next;
130
    };
131
    /^\@clear\s+([a-zA-Z0-9_-]+)/ and do {
132
	delete $defs{$1};
133
	next;
134
    };
135

  
136
    next unless $output;
137

  
138
    # Discard comments.  (Can't do it above, because then we'd never see
139
    # @c man lines.)
140
    /^\@c\b/ and next;
141

  
142
    # End-block handler goes up here because it needs to operate even
143
    # if we are skipping.
144
    /^\@end\s+([a-z]+)/ and do {
145
	# Ignore @end foo, where foo is not an operation which may
146
	# cause us to skip, if we are presently skipping.
147
	my $ended = $1;
148
	next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex|copying)$/;
149

  
150
	die "\@end $ended without \@$ended at line $.\n" unless defined $endw;
151
	die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw;
152

  
153
	$endw = pop @endwstack;
154

  
155
	if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) {
156
	    $skipping = pop @skstack;
157
	    next;
158
	} elsif ($ended =~ /^(?:example|smallexample|display)$/) {
159
	    $shift = "";
160
	    $_ = "";	# need a paragraph break
161
	} elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
162
	    $_ = "\n=back\n";
163
	    $ic = pop @icstack;
164
	} elsif ($ended eq "multitable") {
165
	    $_ = "\n=back\n";
166
	} else {
167
	    die "unknown command \@end $ended at line $.\n";
168
	}
169
    };
170

  
171
    # We must handle commands which can cause skipping even while we
172
    # are skipping, otherwise we will not process nested conditionals
173
    # correctly.
174
    /^\@ifset\s+([a-zA-Z0-9_-]+)/ and do {
175
	push @endwstack, $endw;
176
	push @skstack, $skipping;
177
	$endw = "ifset";
178
	$skipping = 1 unless exists $defs{$1};
179
	next;
180
    };
181

  
182
    /^\@ifclear\s+([a-zA-Z0-9_-]+)/ and do {
183
	push @endwstack, $endw;
184
	push @skstack, $skipping;
185
	$endw = "ifclear";
186
	$skipping = 1 if exists $defs{$1};
187
	next;
188
    };
189

  
190
    /^\@(ignore|menu|iftex|copying)\b/ and do {
191
	push @endwstack, $endw;
192
	push @skstack, $skipping;
193
	$endw = $1;
194
	$skipping = 1;
195
	next;
196
    };
197

  
198
    next if $skipping;
199

  
200
    # Character entities.  First the ones that can be replaced by raw text
201
    # or discarded outright:
202
    s/\@copyright\{\}/(c)/g;
203
    s/\@dots\{\}/.../g;
204
    s/\@enddots\{\}/..../g;
205
    s/\@([.!? ])/$1/g;
206
    s/\@[:-]//g;
207
    s/\@bullet(?:\{\})?/*/g;
208
    s/\@TeX\{\}/TeX/g;
209
    s/\@pounds\{\}/\#/g;
210
    s/\@minus(?:\{\})?/-/g;
211
    s/\\,/,/g;
212

  
213
    # Now the ones that have to be replaced by special escapes
214
    # (which will be turned back into text by unmunge())
215
    s/&/&amp;/g;
216
    s/\@\{/&lbrace;/g;
217
    s/\@\}/&rbrace;/g;
218
    s/\@\@/&at;/g;
219

  
220
    # Inside a verbatim block, handle @var specially.
221
    if ($shift ne "") {
222
	s/\@var\{([^\}]*)\}/<$1>/g;
223
    }
224

  
225
    # POD doesn't interpret E<> inside a verbatim block.
226
    if ($shift eq "") {
227
	s/</&lt;/g;
228
	s/>/&gt;/g;
229
    } else {
230
	s/</&LT;/g;
231
	s/>/&GT;/g;
232
    }
233

  
234
    # Single line command handlers.
235

  
236
    /^\@include\s+(.+)$/ and do {
237
	push @instack, $inf;
238
	$inf = gensym();
239
	$file = postprocess($1);
240

  
241
	# Try cwd and $ibase, then explicit -I paths.
242
	$done = 0;
243
	foreach $path ("", $ibase, @ipath) {
244
	    $mypath = $file;
245
	    $mypath = $path . "/" . $mypath if ($path ne "");
246
	    open($inf, "<" . $mypath) and ($done = 1, last);
247
	}
248
	die "cannot find $file" if !$done;
249
	next;
250
    };
251

  
252
    /^\@(?:section|unnumbered|unnumberedsec|center)\s+(.+)$/
253
	and $_ = "\n=head2 $1\n";
254
    /^\@subsection\s+(.+)$/
255
	and $_ = "\n=head3 $1\n";
256
    /^\@subsubsection\s+(.+)$/
257
	and $_ = "\n=head4 $1\n";
258

  
259
    # Block command handlers:
260
    /^\@itemize(?:\s+(\@[a-z]+|\*|-))?/ and do {
261
	push @endwstack, $endw;
262
	push @icstack, $ic;
263
	if (defined $1) {
264
	    $ic = $1;
265
	} else {
266
	    $ic = '*';
267
	}
268
	$_ = "\n=over 4\n";
269
	$endw = "itemize";
270
    };
271

  
272
    /^\@enumerate(?:\s+([a-zA-Z0-9]+))?/ and do {
273
	push @endwstack, $endw;
274
	push @icstack, $ic;
275
	if (defined $1) {
276
	    $ic = $1 . ".";
277
	} else {
278
	    $ic = "1.";
279
	}
280
	$_ = "\n=over 4\n";
281
	$endw = "enumerate";
282
    };
283

  
284
    /^\@multitable\s.*/ and do {
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff