summaryrefslogtreecommitdiffstats
path: root/scripts/creat-lsb-image
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/creat-lsb-image')
-rwxr-xr-xscripts/creat-lsb-image198
1 files changed, 0 insertions, 198 deletions
diff --git a/scripts/creat-lsb-image b/scripts/creat-lsb-image
deleted file mode 100755
index 657784cba4..0000000000
--- a/scripts/creat-lsb-image
+++ /dev/null
@@ -1,198 +0,0 @@
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`
22ARCH=$1
23MACHINE_ARCH=` bitbake -e | grep ^MACHINE_ARCH | cut -d '=' -f2 | cut -d '"' -f2`
24IMAGE_PATH=` bitbake -e | grep ^COREBASE | cut -d '=' -f2 | cut -d '"' -f2`/build/tmp/deploy/images/
25
26
27ECHO()
28{
29 echo -e "${green}$@"
30 tput sgr0
31}
32
33exit_check()
34{
35 if [ ! $? -eq 0 ]; then
36 exit $?
37 fi
38}
39
40usage()
41{
42 ECHO "${red}usage:you should input one of the next commmands according to detailed target platform:"
43 ECHO "creat-lsb-image x86"
44 ECHO "creat-lsb-image x86_64"
45 ECHO "creat-lsb-image ppc32"
46}
47
48#There should be a patameter to get machine type
49if [ $# -ne 1 ]; then
50 usage
51 exit 1
52fi
53
54#check lsb image
55if [ ! -d $IMAGE_PATH ];then
56 ECHO "${red}There isn't image directory"
57 exit 1
58fi
59ECHO "Enter directory $IMAGE_PATH"
60cd $IMAGE_PATH
61
62#get architecture
63PN=`find . -name core-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 ;}'`
64if [ "XPN" == "X" ];then
65 ECHO "${red}Don't find lsb image on platform, Please run \"core-image-lsb\" to generate lsb image"
66 exit 1
67fi
68
69if [ $PN -eq 0 ];then
70 ECHO "${red}Can't ${MACHINE_ARCH} rootfs.tar.gz,Please run core-image-lsb to get lsb image"
71 exit 1
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
84
85#umount lsbtmp
86if [ -d lsbtmp ];then
87 sudo umount lsbtmp
88fi
89
90#download lsb test suite
91mkdir -p lsb-test-suite-${MACHINE_ARCH}
92if [ -d lsb-test-suite-${MACHINE_ARCH} ];then
93 cd lsb-test-suite-${MACHINE_ARCH}
94 ECHO "Download lsb test suite, it could take some time..."
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
123 exit_check
124else
125 ECHO "Can't find lsb test suite for ${MACHINE_ARCH}"
126fi
127cd ..
128if [ -L core-image-lsb-${MACHINE_ARCH}.ext3 ];then
129 /bin/rm core-image-lsb-${MACHINE_ARCH}.ext3
130 exit_check
131fi
132
133#creat lsb image
134if [ -f core-image-lsb-${MACHINE_ARCH}-test.ext3 ];then
135 if [ -d lsbtmp ];then
136 sudo umount lsbtmp
137 fi
138 ECHO "Remove old lsb image..."
139 /bin/rm core-image-lsb-${MACHINE_ARCH}-test.ext3
140fi
141ECHO "creat a big ext3 file for lsb image with 5G..."
142dd if=/dev/zero of=core-image-lsb-${MACHINE_ARCH}-test.ext3 bs=1M count=5000
143exit_check
144ECHO "Format ext3 image,please input \"y\""
145mkfs.ext3 core-image-lsb-${MACHINE_ARCH}-test.ext3
146tune2fs -j core-image-lsb-${MACHINE_ARCH}-test.ext3
147
148
149ECHO "get a lsb image with lsb test suite"
150if [ ! -d lsbtmp ];then
151 mkdir lsbtmp
152fi
153
154
155#install file system and lsb test suite to lsb image
156sudo mount -o loop core-image-lsb-${MACHINE_ARCH}-test.ext3 lsbtmp
157exit_check
158
159ECHO " ->Install file system..."
160sudo tar jxf core-image-lsb-${MACHINE_ARCH}-${PN}.rootfs.tar.bz2 -C lsbtmp
161exit_check
162
163ECHO " ->Install lsb test suite..."
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
169exit_check
170cd ..
171
172if [ -f modules-*-${MACHINE_ARCH}.tgz ];then
173ECHO " ->Install moules of driver..."
174 sudo tar zxf modules-*-${MACHINE_ARCH}.tgz -C lsbtmp/
175fi
176
177
178#unmount lsbtmp
179sudo umount lsbtmp
180exit_check
181sudo rm -rf lsbtmp
182
183#change file attribute
184sudo chown ${USER}:${USER} core-image-lsb-${MACHINE_ARCH}-test.ext3
185exit_check
186sudo chmod 755 core-image-lsb-${MACHINE_ARCH}-test.ext3
187exit_check
188
189#set up link
190if [ -L core-image-lsb-${MACHINE_ARCH}.ext3 ];then
191ECHO "Set up link"
192 /bin/rm core-image-lsb-${MACHINE_ARCH}.ext3
193 exit_check
194fi
195ln -s core-image-lsb-${MACHINE_ARCH}-test.ext3 core-image-lsb-${MACHINE_ARCH}.ext3
196
197ECHO "LSB test environment is set successfully, Please run this image on platform ${MACHINE_ARCH}"
198