summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiaofeng Yan <xiaofeng.yan@windriver.com>2010-12-10 15:46:49 +0800
committerSaul Wold <Saul.Wold@intel.com>2010-12-10 22:01:40 -0800
commitf39dae9f155b2f73c54fa5fc1bedd69f2ff87386 (patch)
treedbf5bac336c8f0ab39692a069a0a888178dd1662
parentbc61818ac096fff071540c174b6660ca31b9ba30 (diff)
downloadpoky-f39dae9f155b2f73c54fa5fc1bedd69f2ff87386.tar.gz
creat-lsb-image: download lsb test suite and creat a image with lsb test suite
If we make a test with lsb test suite, then we must creat a large image with lsb test suite. three function in this script: 1 download lsb test suite 2 creat a block file with 3G 3 install file system of poky-image-lsb, modules of driver and lsb test suite Signed-off-by: Xiaofeng Yan <xiaofeng.yan@windriver.com>
-rwxr-xr-xscripts/creat-lsb-image170
1 files changed, 170 insertions, 0 deletions
diff --git a/scripts/creat-lsb-image b/scripts/creat-lsb-image
new file mode 100755
index 0000000000..71d9215d41
--- /dev/null
+++ b/scripts/creat-lsb-image
@@ -0,0 +1,170 @@
1#!/bin/bash
2#
3# Copyright (c) 2005-2010 Wind River Systems, Inc.
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 version 2 as
7# published by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12# See the GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
19red='\E[31;40m'
20green='\E[32;40m'
21USER=`whoami`
22MACHINE=$1
23IMAGE_PATH=../build/tmp/deploy/images/
24
25
26ECHO()
27{
28 echo -e "${green}$@"
29 tput sgr0
30}
31
32exit_check()
33{
34 if [ ! $? -eq 0 ]; then
35 exit $?
36 fi
37}
38
39usage()
40{
41 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 qemux86-64"
44 ECHO "creat-lsb-image qemuppc"
45}
46
47#There should be a patameter to get machine type
48if [ $# -ne 1 ]; then
49 usage
50 exit 1
51fi
52
53#check lsb image
54if [ ! -d $IMAGE_PATH ];then
55 ECHO "${red}There isn't image directory"
56 exit 1
57fi
58ECHO "Enter directory $IMAGE_PATH"
59cd $IMAGE_PATH
60
61#get architecture
62case $MACHINE in
63 qemux86)
64 ARCH=ia32
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 if [ "XPN" == "X" ];then
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
89esac
90
91if [ $PN -eq 0 ];then
92 ECHO "${red}Can't ${MACHINE} rootfs.tar.gz,Please run poky-image-lsb to get lsb image"
93 exit 1
94fi
95
96#download lsb test suite
97if [ ! -f lsb-dist-testkit-4.0.2-1.${ARCH}.tar.gz ];then
98 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
100 exit_check
101else
102 ECHO "Find lsb test suite for ${MACHINE}"
103fi
104
105#if [ -L poky-image-lsb-${MACHINE}.ext3 ];then
106# /bin/rm poky-image-lsb-${MACHINE}.ext3
107# exit_check
108#fi
109
110#creat lsb image
111if [ -f poky-image-lsb-${MACHINE}-test.ext3 ];then
112 if [ -d lsbtmp ];then
113 sudo umount lsbtmp
114 fi
115 ECHO "Remove old lsb image..."
116 /bin/rm poky-image-lsb-${MACHINE}-test.ext3
117fi
118ECHO "creat a big ext3 file for lsb image with 3G..."
119dd if=/dev/zero of=poky-image-lsb-${MACHINE}-test.ext3 bs=1M count=3000
120exit_check
121ECHO "Format ext3 image,please input \"y\""
122mkfs.ext3 poky-image-lsb-${MACHINE}-test.ext3
123tune2fs -j poky-image-lsb-${MACHINE}-test.ext3
124
125
126ECHO "get a lsb image with lsb test suite"
127if [ ! -d lsbtmp ];then
128 mkdir lsbtmp
129fi
130
131
132#install file system and lsb test suite to lsb image
133sudo mount -o loop poky-image-lsb-${MACHINE}-test.ext3 lsbtmp
134exit_check
135
136ECHO " ->Install file system..."
137sudo tar jxf poky-image-lsb-${MACHINE}-${PN}.rootfs.tar.bz2 -C lsbtmp
138exit_check
139
140ECHO " ->Install lsb test suite..."
141sudo tar zxf lsb-dist-testkit-4.0.2-1.${ARCH}.tar.gz -C lsbtmp
142exit_check
143
144if [ -f modules-*-${MACHINE}.tgz ];then
145ECHO " ->Install moules of driver..."
146 sudo tar zxf modules-*-${MACHINE}.tgz -C lsbtmp/
147fi
148
149
150#mount lsbtmp
151sudo umount lsbtmp
152exit_check
153sudo rm -rf lsbtmp
154
155#change file attribute
156sudo chown ${USER}:${USER} poky-image-lsb-${MACHINE}-test.ext3
157exit_check
158sudo chmod 755 poky-image-lsb-${MACHINE}-test.ext3
159exit_check
160
161#set up link
162if [ -L poky-image-lsb-${MACHINE}.ext3 ];then
163ECHO "Set up link"
164 /bin/rm poky-image-lsb-${MACHINE}.ext3
165 exit_check
166fi
167ln -s poky-image-lsb-${MACHINE}-test.ext3 poky-image-lsb-${MACHINE}.ext3
168
169ECHO "LSB test environment is set successfully, Please run \"poky-qemu ${MACHINE}\" to start up lsb-image"
170