summaryrefslogtreecommitdiffstats
path: root/scripts/poky-qemu
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/poky-qemu')
-rwxr-xr-xscripts/poky-qemu64
1 files changed, 36 insertions, 28 deletions
diff --git a/scripts/poky-qemu b/scripts/poky-qemu
index 9e604b5a10..bc312e0fb6 100755
--- a/scripts/poky-qemu
+++ b/scripts/poky-qemu
@@ -51,6 +51,37 @@ SCRIPT_KERNEL_OPT=""
51 51
52TMPDIR="" 52TMPDIR=""
53 53
54# Determine whether the file is a kernel or QEMU image, and set the
55# appropriate variables
56process_filename() {
57 filename=$1
58
59 # Extract the filename extension
60 EXT=`echo $filename | awk -F . '{ print \$NF }'`
61 # A file ending in .bin is a kernel
62 if [ "x$EXT" = "xbin" ]; then
63 if [ -z "$KERNEL" ]; then
64 KERNEL=$filename
65 else
66 echo "Error: conflicting KERNEL args [$KERNEL] and [$filename]"
67 usage
68 fi
69 elif [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" ||
70 "x$EXT" == "xjffs2" ]]; then
71 # A file ending in a supportted fs type is a rootfs image
72 if [[ -z "$FSTYPE" || "$FSTYPE" == "$EXT" ]]; then
73 FSTYPE=$EXT
74 ROOTFS=$filename
75 else
76 echo "Error: conflicting FSTYPE types [$FSTYPE] and [$EXT]"
77 usage
78 fi
79 else
80 echo "Error: unknown file arg [$filename]"
81 usage
82 fi
83}
84
54# Parse command line args without requiring specific ordering. It's a 85# Parse command line args without requiring specific ordering. It's a
55# bit more complex, but offers a great user experience. 86# bit more complex, but offers a great user experience.
56i=1 87i=1
@@ -66,7 +97,7 @@ while [ $i -le $# ]; do
66 fi 97 fi
67 ;; 98 ;;
68 "ext2" | "ext3" | "jffs2" | "nfs") 99 "ext2" | "ext3" | "jffs2" | "nfs")
69 if [ -z "$FSTYPE" ]; then 100 if [[ -z "$FSTYPE" || "$FSTYPE" == "$arg" ]]; then
70 FSTYPE=$arg 101 FSTYPE=$arg
71 else 102 else
72 echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]" 103 echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]"
@@ -75,8 +106,8 @@ while [ $i -le $# ]; do
75 ;; 106 ;;
76 *-image-*) 107 *-image-*)
77 if [ -z "$ROOTFS" ]; then 108 if [ -z "$ROOTFS" ]; then
78 if [ -e "$arg" ]; then 109 if [ -f "$arg" ]; then
79 ROOTFS=$arg 110 process_filename $arg
80 else 111 else
81 ROOTFS=$arg 112 ROOTFS=$arg
82 LAZY_ROOTFS="true" 113 LAZY_ROOTFS="true"
@@ -111,30 +142,7 @@ while [ $i -le $# ]; do
111 usage 142 usage
112 fi 143 fi
113 elif [ -f "$arg" ]; then 144 elif [ -f "$arg" ]; then
114 # Extract the filename extension 145 process_filename $arg
115 EXT=`echo $arg | awk -F . '{ print \$NF }'`
116 # A file ending in .bin is a kernel
117 if [ "x$EXT" = "xbin" ]; then
118 if [ -z "$KERNEL" ]; then
119 KERNEL=$arg
120 else
121 echo "Error: conflicting KERNEL args [$KERNEL] and [$arg]"
122 usage
123 fi
124 elif [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" ||
125 "x$EXT" == "xjffs2" ]]; then
126 # A file ending in a supportted fs type is a rootfs image
127 if [[ -z "$FSTYPE" || "$FSTYPE" == "$EXT" ]]; then
128 FSTYPE=$EXT
129 ROOTFS=$arg
130 else
131 echo "Error: conflicting FSTYPE types [$FSTYPE] and [$arg]"
132 usage
133 fi
134 else
135 echo "Error: unknown file arg [$arg]"
136 usage
137 fi
138 else 146 else
139 echo "Error: unable to classify arg [$arg]" 147 echo "Error: unable to classify arg [$arg]"
140 usage 148 usage
@@ -155,7 +163,7 @@ if [[ "$FSTYPE" == "nfs" && -z "$ROOTFS" ]]; then
155fi 163fi
156 164
157if [ -z "$MACHINE" ]; then 165if [ -z "$MACHINE" ]; then
158 MACHINE=`basename $KERNEL | sed -r -e 's#.*-([a-z]+[0-9\-]*)-?[0-9]*..*#\1#'` 166 MACHINE=`basename $KERNEL | sed 's/.*-\(qemux86-64\|qemux86\|qemuarm\|qemumips\|qemuppc\).*/\1/'`
159 if [ -z "$MACHINE" ]; then 167 if [ -z "$MACHINE" ]; then
160 echo "Error: Unable to set MACHINE from kernel filename [$KERNEL]" 168 echo "Error: Unable to set MACHINE from kernel filename [$KERNEL]"
161 usage 169 usage