summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorXiaofeng Yan <xiaofeng.yan@windriver.com>2011-03-04 18:42:17 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-03-04 22:26:42 +0000
commitf092542f0796c552ff1e45094908894ce34b7eb2 (patch)
tree85d7dd80c9091c02e4259c9504cfa4ffd240a9e4 /scripts
parentb8160345a040863c1876ff0747a4945114c51dac (diff)
downloadpoky-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-xscripts/creat-lsb-image148
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 @@
19red='\E[31;40m' 19red='\E[31;40m'
20green='\E[32;40m' 20green='\E[32;40m'
21USER=`whoami` 21USER=`whoami`
22MACHINE=$1 22ARCH=$1
23IMAGE_PATH=../build/tmp/deploy/images/ 23MACHINE_ARCH=` bitbake -e | grep ^MACHINE_ARCH | cut -d '=' -f2 | cut -d '"' -f2`
24IMAGE_PATH=` bitbake -e | grep ^POKYBASE | cut -d '=' -f2 | cut -d '"' -f2`/build/tmp/deploy/images/
24 25
25 26
26ECHO() 27ECHO()
@@ -39,9 +40,9 @@ exit_check()
39usage() 40usage()
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"
59cd $IMAGE_PATH 60cd $IMAGE_PATH
60 61
61#get architecture 62#get architecture
62case $MACHINE in 63PN=`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) 64if [ "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 67fi
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 68
91if [ $PN -eq 0 ];then 69if [ $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
94fi 72fi
73#set varible ARCH
74if [ ${ARCH} == x86 ];then
75 T_ARCH=ia32
76 P_ARCH=i486
77elif [ ${ARCH} == x86_64 ];then
78 T_ARCH=ia64
79 P_ARCH=ia64
80else
81 P_ARCH=ppc
82 T_ARCH=${ARCH}
83fi
95 84
85#umount lsbtmp
86if [ -d lsbtmp ];then
87 sudo umount lsbtmp
88fi
89
96#download lsb test suite 90#download lsb test suite
97if [ ! -f lsb-dist-testkit-4.0.2-1.${ARCH}.tar.gz ];then 91mkdir -p lsb-test-suite-${MACHINE_ARCH}
92if [ -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
101else 124else
102 ECHO "Find lsb test suite for ${MACHINE}" 125 ECHO "Can't find lsb test suite for ${MACHINE_ARCH}"
126fi
127cd ..
128if [ -L poky-image-lsb-${MACHINE_ARCH}.ext3 ];then
129 /bin/rm poky-image-lsb-${MACHINE_ARCH}.ext3
130 exit_check
103fi 131fi
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
111if [ -f poky-image-lsb-${MACHINE}-test.ext3 ];then 134if [ -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
117fi 140fi
118ECHO "creat a big ext3 file for lsb image with 3G..." 141ECHO "creat a big ext3 file for lsb image with 5G..."
119dd if=/dev/zero of=poky-image-lsb-${MACHINE}-test.ext3 bs=1M count=3000 142dd if=/dev/zero of=poky-image-lsb-${MACHINE_ARCH}-test.ext3 bs=1M count=5000
120exit_check 143exit_check
121ECHO "Format ext3 image,please input \"y\"" 144ECHO "Format ext3 image,please input \"y\""
122mkfs.ext3 poky-image-lsb-${MACHINE}-test.ext3 145mkfs.ext3 poky-image-lsb-${MACHINE_ARCH}-test.ext3
123tune2fs -j poky-image-lsb-${MACHINE}-test.ext3 146tune2fs -j poky-image-lsb-${MACHINE_ARCH}-test.ext3
124 147
125 148
126ECHO "get a lsb image with lsb test suite" 149ECHO "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
133sudo mount -o loop poky-image-lsb-${MACHINE}-test.ext3 lsbtmp 156sudo mount -o loop poky-image-lsb-${MACHINE_ARCH}-test.ext3 lsbtmp
134exit_check 157exit_check
135 158
136ECHO " ->Install file system..." 159ECHO " ->Install file system..."
137sudo tar jxf poky-image-lsb-${MACHINE}-${PN}.rootfs.tar.bz2 -C lsbtmp 160sudo tar jxf poky-image-lsb-${MACHINE_ARCH}-${PN}.rootfs.tar.bz2 -C lsbtmp
138exit_check 161exit_check
139 162
140ECHO " ->Install lsb test suite..." 163ECHO " ->Install lsb test suite..."
141sudo tar zxf lsb-dist-testkit-4.0.2-1.${ARCH}.tar.gz -C lsbtmp 164cd lsb-test-suite-${MACHINE_ARCH}
165sudo tar zxf lsb-dist-testkit-4.1.0-5.${T_ARCH}.tar.gz -C ../lsbtmp
166exit_check
167sudo mkdir ../lsbtmp/lsb-Application
168sudo cp *.rpm ../lsbtmp/lsb-Application
142exit_check 169exit_check
170cd ..
143 171
144if [ -f modules-*-${MACHINE}.tgz ];then 172if [ -f modules-*-${MACHINE_ARCH}.tgz ];then
145ECHO " ->Install moules of driver..." 173ECHO " ->Install moules of driver..."
146 sudo tar zxf modules-*-${MACHINE}.tgz -C lsbtmp/ 174 sudo tar zxf modules-*-${MACHINE_ARCH}.tgz -C lsbtmp/
147fi 175fi
148 176
149 177
150#mount lsbtmp 178#unmount lsbtmp
151sudo umount lsbtmp 179sudo umount lsbtmp
152exit_check 180exit_check
153sudo rm -rf lsbtmp 181sudo rm -rf lsbtmp
154 182
155#change file attribute 183#change file attribute
156sudo chown ${USER}:${USER} poky-image-lsb-${MACHINE}-test.ext3 184sudo chown ${USER}:${USER} poky-image-lsb-${MACHINE_ARCH}-test.ext3
157exit_check 185exit_check
158sudo chmod 755 poky-image-lsb-${MACHINE}-test.ext3 186sudo chmod 755 poky-image-lsb-${MACHINE_ARCH}-test.ext3
159exit_check 187exit_check
160 188
161#set up link 189#set up link
162if [ -L poky-image-lsb-${MACHINE}.ext3 ];then 190if [ -L poky-image-lsb-${MACHINE_ARCH}.ext3 ];then
163ECHO "Set up link" 191ECHO "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
166fi 194fi
167ln -s poky-image-lsb-${MACHINE}-test.ext3 poky-image-lsb-${MACHINE}.ext3 195ln -s poky-image-lsb-${MACHINE_ARCH}-test.ext3 poky-image-lsb-${MACHINE_ARCH}.ext3
168 196
169ECHO "LSB test environment is set successfully, Please run \"poky-qemu ${MACHINE}\" to start up lsb-image" 197ECHO "LSB test environment is set successfully, Please run this image on platform ${MACHINE_ARCH}"
170 198