diff options
author | Xiaofeng Yan <xiaofeng.yan@windriver.com> | 2011-03-04 18:42:17 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-03-04 22:26:42 +0000 |
commit | f092542f0796c552ff1e45094908894ce34b7eb2 (patch) | |
tree | 85d7dd80c9091c02e4259c9504cfa4ffd240a9e4 /scripts | |
parent | b8160345a040863c1876ff0747a4945114c51dac (diff) | |
download | poky-f092542f0796c552ff1e45094908894ce34b7eb2.tar.gz |
creat-lsb-image: Add some functions for creating a appropriate image to make lsb test
Add all pakcages from LSB Test Suite from linux foundation web.
(From OE-Core rev: fc87e45c24eaee29dc3f803eca4f8e303cc582cb)
Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/creat-lsb-image | 148 |
1 files changed, 88 insertions, 60 deletions
diff --git a/scripts/creat-lsb-image b/scripts/creat-lsb-image index 71d9215d41..3802e2f344 100755 --- a/scripts/creat-lsb-image +++ b/scripts/creat-lsb-image | |||
@@ -19,8 +19,9 @@ | |||
19 | red='\E[31;40m' | 19 | red='\E[31;40m' |
20 | green='\E[32;40m' | 20 | green='\E[32;40m' |
21 | USER=`whoami` | 21 | USER=`whoami` |
22 | MACHINE=$1 | 22 | ARCH=$1 |
23 | IMAGE_PATH=../build/tmp/deploy/images/ | 23 | MACHINE_ARCH=` bitbake -e | grep ^MACHINE_ARCH | cut -d '=' -f2 | cut -d '"' -f2` |
24 | IMAGE_PATH=` bitbake -e | grep ^POKYBASE | cut -d '=' -f2 | cut -d '"' -f2`/build/tmp/deploy/images/ | ||
24 | 25 | ||
25 | 26 | ||
26 | ECHO() | 27 | ECHO() |
@@ -39,9 +40,9 @@ exit_check() | |||
39 | usage() | 40 | usage() |
40 | { | 41 | { |
41 | ECHO "${red}usage:you should input one of the next commmands according to detailed target platform:" | 42 | ECHO "${red}usage:you should input one of the next commmands according to detailed target platform:" |
42 | ECHO "creat-lsb-image qemux86" | 43 | ECHO "creat-lsb-image x86" |
43 | ECHO "creat-lsb-image qemux86-64" | 44 | ECHO "creat-lsb-image x86_64" |
44 | ECHO "creat-lsb-image qemuppc" | 45 | ECHO "creat-lsb-image ppc32" |
45 | } | 46 | } |
46 | 47 | ||
47 | #There should be a patameter to get machine type | 48 | #There should be a patameter to get machine type |
@@ -59,68 +60,90 @@ ECHO "Enter directory $IMAGE_PATH" | |||
59 | cd $IMAGE_PATH | 60 | cd $IMAGE_PATH |
60 | 61 | ||
61 | #get architecture | 62 | #get architecture |
62 | case $MACHINE in | 63 | PN=`find . -name poky-image-lsb-${MACHINE_ARCH}\*.rootfs.tar.bz2 -type f | awk -F- 'BEGIN{ max=0;} {if( NR!=0 && $5>max ) max=$5 }END{ printf "%d" ,max ;}'` |
63 | qemux86) | 64 | if [ "XPN" == "X" ];then |
64 | ARCH=ia32 | 65 | ECHO "${red}Don't find lsb image on platform, Please run \"poky-image-lsb\" to generate lsb image" |
65 | PN=`find . -name poky-image-lsb-${MACHINE}\*.rootfs.tar.bz2 -type f | awk -F- 'BEGIN{ max=0;} {if( NR!=0 && $5>max ) max=$5 }END{ printf "%d" ,max ;}'` | 66 | exit 1 |
66 | if [ "XPN" == "X" ];then | 67 | fi |
67 | ECHO "${red}Don't find lsb image on platform, Please run \"poky-image-lsb\" to generate lsb image" | ||
68 | exit 1 | ||
69 | fi | ||
70 | ;; | ||
71 | qemux86-64) | ||
72 | ARCH=x86_64 | ||
73 | PN=`find . -nam! e poky-image-lsb-${MACHINE}\*.rootfs.tar.bz2 -type f | awk -F- 'BEGIN{ max=0; } {if( NR!=0 && $6>max ) max=$6 }END{ printf "%d" ,max ;}'` | ||
74 | if [ "X${PN}" == "X" ];then | ||
75 | ECHO "${red}Don't find lsb image on platform, Please run \"poky-image-lsb\" to generate lsb image" | ||
76 | exit 1 | ||
77 | fi | ||
78 | ;; | ||
79 | qemuppc) | ||
80 | ARCH=ppc32 | ||
81 | PN=`find . -name poky-image-lsb-${MACHINE}\*.rootfs.tar.bz2 -type f | awk -F- 'BEGIN{ max=0;} {if( NR!=0 && $5>max ) max=$5 }END{ printf "%d" ,max ;}'` | ||
82 | if [ "XPN" == "X" ];then | ||
83 | ECHO "${red}Don't find lsb image on platform, Please run \"poky-image-lsb\" to generate lsb image" | ||
84 | fi | ||
85 | ;; | ||
86 | *) | ||
87 | ECHO "${red}Don't support lsb test for platform ${MACHINE}" | ||
88 | exit 1 | ||
89 | esac | ||
90 | 68 | ||
91 | if [ $PN -eq 0 ];then | 69 | if [ $PN -eq 0 ];then |
92 | ECHO "${red}Can't ${MACHINE} rootfs.tar.gz,Please run poky-image-lsb to get lsb image" | 70 | ECHO "${red}Can't ${MACHINE_ARCH} rootfs.tar.gz,Please run poky-image-lsb to get lsb image" |
93 | exit 1 | 71 | exit 1 |
94 | fi | 72 | fi |
73 | #set varible ARCH | ||
74 | if [ ${ARCH} == x86 ];then | ||
75 | T_ARCH=ia32 | ||
76 | P_ARCH=i486 | ||
77 | elif [ ${ARCH} == x86_64 ];then | ||
78 | T_ARCH=ia64 | ||
79 | P_ARCH=ia64 | ||
80 | else | ||
81 | P_ARCH=ppc | ||
82 | T_ARCH=${ARCH} | ||
83 | fi | ||
95 | 84 | ||
85 | #umount lsbtmp | ||
86 | if [ -d lsbtmp ];then | ||
87 | sudo umount lsbtmp | ||
88 | fi | ||
89 | |||
96 | #download lsb test suite | 90 | #download lsb test suite |
97 | if [ ! -f lsb-dist-testkit-4.0.2-1.${ARCH}.tar.gz ];then | 91 | mkdir -p lsb-test-suite-${MACHINE_ARCH} |
92 | if [ -d lsb-test-suite-${MACHINE_ARCH} ];then | ||
93 | cd lsb-test-suite-${MACHINE_ARCH} | ||
98 | ECHO "Download lsb test suite, it could take some time..." | 94 | ECHO "Download lsb test suite, it could take some time..." |
99 | wget -c -t 5 http://ftp.linuxfoundation.org/pub/lsb/bundles/released-4.0.0/dist-testkit/lsb-dist-testkit-4.0.2-1.${ARCH}.tar.gz | 95 | wget -c -t 5 http://ftp.linuxfoundation.org/pub/lsb/bundles/released-4.1.0/dist-testkit/lsb-dist-testkit-4.1.0-5.${T_ARCH}.tar.gz |
96 | exit_check | ||
97 | ECHO "Download lsb-xdg-utils-4.0.0-2.${P_ARCH}.rpm" | ||
98 | wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/lsbdev/released-4.1.0/binary/${T_ARCH}/lsb-xdg-utils-4.0.0-2.${P_ARCH}.rpm | ||
99 | exit_check | ||
100 | ECHO "Downlocad lsb-apache-2.2.8-2.lsb4.${P_ARCH}.rpm" | ||
101 | wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-apache-2.2.14-3.lsb4.${P_ARCH}.rpm | ||
102 | exit_check | ||
103 | ECHO "Downlocad lsb-tcl-8.5.1-2.lsb4.${P_ARCH}.rpm" | ||
104 | wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-tcl-8.5.7-6.lsb4.${P_ARCH}.rpm | ||
105 | exit_check | ||
106 | ECHO "Downlocad lsb-expect-5.43.0-7.lsb4.${P_ARCH}.rpm" | ||
107 | wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-expect-5.43.0-11.lsb4.${P_ARCH}.rpm | ||
108 | exit_check | ||
109 | ECHO "Downlocad lsb-groff-1.19.2-4.lsb4.${P_ARCH}.rpm" | ||
110 | wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-groff-1.20.1-5.lsb4.${P_ARCH}.rpm | ||
111 | exit_check | ||
112 | ECHO "Downlocad lsb-raptor-1.4.16-2.lsb4.${P_ARCH}.rpm" | ||
113 | wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-raptor-1.4.19-3.lsb4.${P_ARCH}.rpm | ||
114 | exit_check | ||
115 | ECHO "Downlocad lsb-xpdf-1.01-7.lsb4.${P_ARCH}.rpm" | ||
116 | wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-xpdf-1.01-10.lsb4.${P_ARCH}.rpm | ||
117 | exit_check | ||
118 | ECHO "Downlocad lsb-samba-3.0.28a-3.lsb4.${P_ARCH}.rpm" | ||
119 | wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-samba-3.4.3-5.lsb4.${P_ARCH}.rpm | ||
120 | exit_check | ||
121 | ECHO "Downlocad lsb-rsync-3.0.0-2.lsb4.${P_ARCH}.rpm" | ||
122 | wget -c -t 5 http://ftp.linux-foundation.org/pub/lsb/app-battery/released-4.1.0/${T_ARCH}/lsb-rsync-3.0.6-3.lsb4.${P_ARCH}.rpm | ||
100 | exit_check | 123 | exit_check |
101 | else | 124 | else |
102 | ECHO "Find lsb test suite for ${MACHINE}" | 125 | ECHO "Can't find lsb test suite for ${MACHINE_ARCH}" |
126 | fi | ||
127 | cd .. | ||
128 | if [ -L poky-image-lsb-${MACHINE_ARCH}.ext3 ];then | ||
129 | /bin/rm poky-image-lsb-${MACHINE_ARCH}.ext3 | ||
130 | exit_check | ||
103 | fi | 131 | fi |
104 | |||
105 | #if [ -L poky-image-lsb-${MACHINE}.ext3 ];then | ||
106 | # /bin/rm poky-image-lsb-${MACHINE}.ext3 | ||
107 | # exit_check | ||
108 | #fi | ||
109 | 132 | ||
110 | #creat lsb image | 133 | #creat lsb image |
111 | if [ -f poky-image-lsb-${MACHINE}-test.ext3 ];then | 134 | if [ -f poky-image-lsb-${MACHINE_ARCH}-test.ext3 ];then |
112 | if [ -d lsbtmp ];then | 135 | if [ -d lsbtmp ];then |
113 | sudo umount lsbtmp | 136 | sudo umount lsbtmp |
114 | fi | 137 | fi |
115 | ECHO "Remove old lsb image..." | 138 | ECHO "Remove old lsb image..." |
116 | /bin/rm poky-image-lsb-${MACHINE}-test.ext3 | 139 | /bin/rm poky-image-lsb-${MACHINE_ARCH}-test.ext3 |
117 | fi | 140 | fi |
118 | ECHO "creat a big ext3 file for lsb image with 3G..." | 141 | ECHO "creat a big ext3 file for lsb image with 5G..." |
119 | dd if=/dev/zero of=poky-image-lsb-${MACHINE}-test.ext3 bs=1M count=3000 | 142 | dd if=/dev/zero of=poky-image-lsb-${MACHINE_ARCH}-test.ext3 bs=1M count=5000 |
120 | exit_check | 143 | exit_check |
121 | ECHO "Format ext3 image,please input \"y\"" | 144 | ECHO "Format ext3 image,please input \"y\"" |
122 | mkfs.ext3 poky-image-lsb-${MACHINE}-test.ext3 | 145 | mkfs.ext3 poky-image-lsb-${MACHINE_ARCH}-test.ext3 |
123 | tune2fs -j poky-image-lsb-${MACHINE}-test.ext3 | 146 | tune2fs -j poky-image-lsb-${MACHINE_ARCH}-test.ext3 |
124 | 147 | ||
125 | 148 | ||
126 | ECHO "get a lsb image with lsb test suite" | 149 | ECHO "get a lsb image with lsb test suite" |
@@ -130,41 +153,46 @@ fi | |||
130 | 153 | ||
131 | 154 | ||
132 | #install file system and lsb test suite to lsb image | 155 | #install file system and lsb test suite to lsb image |
133 | sudo mount -o loop poky-image-lsb-${MACHINE}-test.ext3 lsbtmp | 156 | sudo mount -o loop poky-image-lsb-${MACHINE_ARCH}-test.ext3 lsbtmp |
134 | exit_check | 157 | exit_check |
135 | 158 | ||
136 | ECHO " ->Install file system..." | 159 | ECHO " ->Install file system..." |
137 | sudo tar jxf poky-image-lsb-${MACHINE}-${PN}.rootfs.tar.bz2 -C lsbtmp | 160 | sudo tar jxf poky-image-lsb-${MACHINE_ARCH}-${PN}.rootfs.tar.bz2 -C lsbtmp |
138 | exit_check | 161 | exit_check |
139 | 162 | ||
140 | ECHO " ->Install lsb test suite..." | 163 | ECHO " ->Install lsb test suite..." |
141 | sudo tar zxf lsb-dist-testkit-4.0.2-1.${ARCH}.tar.gz -C lsbtmp | 164 | cd lsb-test-suite-${MACHINE_ARCH} |
165 | sudo tar zxf lsb-dist-testkit-4.1.0-5.${T_ARCH}.tar.gz -C ../lsbtmp | ||
166 | exit_check | ||
167 | sudo mkdir ../lsbtmp/lsb-Application | ||
168 | sudo cp *.rpm ../lsbtmp/lsb-Application | ||
142 | exit_check | 169 | exit_check |
170 | cd .. | ||
143 | 171 | ||
144 | if [ -f modules-*-${MACHINE}.tgz ];then | 172 | if [ -f modules-*-${MACHINE_ARCH}.tgz ];then |
145 | ECHO " ->Install moules of driver..." | 173 | ECHO " ->Install moules of driver..." |
146 | sudo tar zxf modules-*-${MACHINE}.tgz -C lsbtmp/ | 174 | sudo tar zxf modules-*-${MACHINE_ARCH}.tgz -C lsbtmp/ |
147 | fi | 175 | fi |
148 | 176 | ||
149 | 177 | ||
150 | #mount lsbtmp | 178 | #unmount lsbtmp |
151 | sudo umount lsbtmp | 179 | sudo umount lsbtmp |
152 | exit_check | 180 | exit_check |
153 | sudo rm -rf lsbtmp | 181 | sudo rm -rf lsbtmp |
154 | 182 | ||
155 | #change file attribute | 183 | #change file attribute |
156 | sudo chown ${USER}:${USER} poky-image-lsb-${MACHINE}-test.ext3 | 184 | sudo chown ${USER}:${USER} poky-image-lsb-${MACHINE_ARCH}-test.ext3 |
157 | exit_check | 185 | exit_check |
158 | sudo chmod 755 poky-image-lsb-${MACHINE}-test.ext3 | 186 | sudo chmod 755 poky-image-lsb-${MACHINE_ARCH}-test.ext3 |
159 | exit_check | 187 | exit_check |
160 | 188 | ||
161 | #set up link | 189 | #set up link |
162 | if [ -L poky-image-lsb-${MACHINE}.ext3 ];then | 190 | if [ -L poky-image-lsb-${MACHINE_ARCH}.ext3 ];then |
163 | ECHO "Set up link" | 191 | ECHO "Set up link" |
164 | /bin/rm poky-image-lsb-${MACHINE}.ext3 | 192 | /bin/rm poky-image-lsb-${MACHINE_ARCH}.ext3 |
165 | exit_check | 193 | exit_check |
166 | fi | 194 | fi |
167 | ln -s poky-image-lsb-${MACHINE}-test.ext3 poky-image-lsb-${MACHINE}.ext3 | 195 | ln -s poky-image-lsb-${MACHINE_ARCH}-test.ext3 poky-image-lsb-${MACHINE_ARCH}.ext3 |
168 | 196 | ||
169 | ECHO "LSB test environment is set successfully, Please run \"poky-qemu ${MACHINE}\" to start up lsb-image" | 197 | ECHO "LSB test environment is set successfully, Please run this image on platform ${MACHINE_ARCH}" |
170 | 198 | ||