summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiping Ke <liping.ke@intel.com>2011-01-03 23:21:40 -0800
committerSaul Wold <sgw@linux.intel.com>2011-01-12 00:55:49 -0800
commit514e59c780ac24439ae0839fab311d843841bf68 (patch)
tree3130a2992cc9428db0440427dc9df74fd06662c9
parent03072100f112b9690c1a99d1c406c098a9005a84 (diff)
downloadpoky-514e59c780ac24439ae0839fab311d843841bf68.tar.gz
adt-intaller feature implementation, including the bitbake recipe file for creating the intaller tar file under /tmp/deploy/sdk, and the adt-installer script files and config files, set the reference to adt repo entry empty before it's setup
Signed-off-by: Jessica Zhang <jessica.zhang@intel.com>
-rwxr-xr-xmeta/recipes-devtools/installer/adt-installer/adt_installer367
-rw-r--r--meta/recipes-devtools/installer/adt-installer/adt_installer.conf52
-rw-r--r--meta/recipes-devtools/installer/adt-installer/opkg/conf/opkg-sdk-i586.conf7
-rw-r--r--meta/recipes-devtools/installer/adt-installer/opkg/conf/opkg-sdk-x86_64.conf7
-rwxr-xr-xmeta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal209
-rw-r--r--meta/recipes-devtools/installer/adt-installer/scripts/data_define40
-rwxr-xr-xmeta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs67
-rw-r--r--meta/recipes-devtools/installer/adt-installer/scripts/util104
-rw-r--r--meta/recipes-devtools/installer/adt-installer_1.0.bb84
9 files changed, 937 insertions, 0 deletions
diff --git a/meta/recipes-devtools/installer/adt-installer/adt_installer b/meta/recipes-devtools/installer/adt-installer/adt_installer
new file mode 100755
index 0000000000..d47be4123b
--- /dev/null
+++ b/meta/recipes-devtools/installer/adt-installer/adt_installer
@@ -0,0 +1,367 @@
1#/bin/bash
2# Yocto ADT Installer
3#
4# Copyright 2010-2011 by Intel Corp.
5#
6# Permission is hereby granted, free of charge, to any person obtaining a copy
7# of this software and associated documentation files (the "Software"), to deal
8# in the Software without restriction, including without limitation the rights
9# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10# copies of the Software, and to permit persons to whom the Software is
11# furnished to do so, subject to the following conditions:
12
13# The above copyright notice and this permission notice shall be included in
14# all copies or substantial portions of the Software.
15
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22# THE SOFTWARE.
23
24
25usage ()
26{
27
28 INST_ARCH=`uname -m`
29 INST_OS=`uname -o| tr '[A-Z]' '[a-z]'`
30 INST_KR=`uname -r| tr '[A-Z]' '[a-z]'`
31
32 echo_info "#########################################################################"
33 echo_info "# Welcome to Yocto Application Developement Tools (ADT) Installer"
34 echo_info "# "
35 echo_info "# Host Machine:\t\t\t\t"$INST_ARCH
36 echo_info "# OS info:\t\t\t\t$INST_KR"
37 echo_info "# Yocto ADT version to be installed:\t$YOCTOADT_VERSION"
38 echo_info "# supported target architectures:\t$YOCTOADT_SUPPORTED_TARGETS"
39 echo_info "# supported target root_fs images:\t$YOCTOADT_SUPPORTED_ROOTFS"
40 echo_info "#########################################################################\n"
41
42 echo_info "Systemwide installation. Installation will occur under $INSTALL_FOLDER\n"
43 echo_info "############################################################################"
44 echo_info "# Your system installation configurations from adt_installer.conf"
45 echo_info "############################################################################"
46
47 echo_info "# Cross toolchains:\t\t$YOCTOADT_TARGETS"
48 echo_info "# Install Qemu:\t\t\t$YOCTOADT_QEMU"
49 echo_info "# Install NFS utilities:\t$YOCTOADT_NFS_UTIL"
50 #echo_info "# Install bitbake + UI:\t\t$YOCTOADT_BITBAKE"
51 #echo_info "# Install poky metadata:\t$YOCTOADT_METADATA"
52 #echo_info "############################################################################\n"
53
54 echo_info "\n##############################################################################"
55 echo_info "# Your rootfs image(s) and target sysroot selections from adt_installer.conf"
56 echo_info "##############################################################################"
57prompt=1
58for arch_type in $YOCTOADT_SUPPORTED_TARGETS; do
59 download_images $arch_type $prompt
60done
61 echo_info "############################################################################\n"
62 select_install_type
63}
64
65validate_config()
66{
67
68 for selected_arch_type in $YOCTOADT_TARGETS; do
69 found=0
70 for supported_arch_type in $YOCTOADT_SUPPORTED_TARGETS; do
71 if [ "$selected_arch_type" == "$supported_arch_type" ]; then
72 found=1
73 break
74 fi
75 done
76 if [ $found == 0 ]; then
77 echo_info "[ADT_INST] Error: YOCTADT_TARGETS in adt_installer.conf contains invalid entries: $YOCTOADT_TARGETS. Valid values are: $YOCTOADT_SUPPORTED_TARGETS"
78 echo -e "\n#############################################################################"
79 echo -e "# Meet error(s) when installing Yocto ADT! Please check log file for details. "
80 echo -e "#############################################################################\n"
81 exit -1
82 fi
83 done
84
85 for arch_type in $YOCTOADT_SUPPORTED_TARGETS; do
86 #select_target_var="\$YOCTOADT_TARGET_$arch_type"
87 #select_target=`eval echo $select_target_var`
88
89 #if [ "$select_target" != "Y" ] || [ "$selected_target" != "y" ]; then
90 # continue;
91 #fi
92
93 target_sysroot_image_var="\$YOCTOADT_TARGET_SYSROOT_IMAGE_$arch_type"
94 target_sysroot_image=`eval echo $target_sysroot_image_var`
95
96
97 select_rootfs_var="\$YOCTOADT_ROOTFS_$arch_type"
98 select_rootfs=`eval echo $select_rootfs_var`
99
100 if [ "$select_rootfs" == "" ] && [ "$target_sysroot_image" == "" ]; then
101 continue;
102 fi
103
104 for image_type in $select_rootfs; do
105#validate rootfs type defined in YOCTOADT_ROOTFS_{ARCH} is valid and in YOCTOADT_SUPPORTED_ROOTFS
106 found=0
107 for supported_rootfs_type in $YOCTOADT_SUPPORTED_ROOTFS; do
108 if [ "$image_type" == "$supported_rootfs_type" ]; then
109 found=1
110 break
111 fi
112 done
113 if [ $found == 0 ]; then
114#the rootfs type listed for downloading is not valid
115 echo_info "[ADT_INST] Error: Selected YOCTOADT_ROOTFS_$arch_type value: $image_type, is not valid! Valid values are: $YOCTOADT_SUPPORTED_ROOTFS "
116 echo -e "\n#############################################################################"
117 echo -e "# Meet error(s) when installing Yocto ADT! Please check log file for details. "
118 echo -e "#############################################################################\n"
119 exit -1
120 fi
121 done
122
123 found=0
124 for image_type in $select_rootfs; do
125#validate that rootfs to be extracted must be in the item: YOCTOADT_ROOTFS_${ARCH}
126 if [ "$target_sysroot_image" == "$image_type" ]; then
127 found=1
128 break
129 fi
130 done
131# the rootfs image to be extracted is not selected
132 if [ $found == 0 ]; then
133 echo_info "[ADT_INST] Error: YOCTOADT_TARGET_SYSROOT_IMAGE_$arch_type selection: $target_sysroot_image is not included in YOCTOADT_ROOTFS_$arch_type selections: $select_rootfs"
134 echo -e "\n#############################################################################"
135 echo -e "# Meet error(s) when installing Yocto ADT! Please check log file for details. "
136 echo -e "#############################################################################\n"
137 exit -1
138 fi
139 done
140}
141
142
143#detect opkg installed or not, for installing sdk, we will use
144#this installed local opkg
145install_opkg()
146{
147if [ ! -x "$LOCAL_OPKG_LOC/bin/opkg-cl" ]; then
148 echo_info "OPKG is not setup, setting up opkg in local, which is required for installing yocto ADT...\n"
149
150 if [ -d $LOCAL_OPKG_LOC ]; then
151 echo_info "Deleting old OPKG folder, which doesn't contain executables... "
152 rm -rf $LOCAL_OPKG_LOC
153 fi
154
155 parent_folder=`eval echo $PWD`
156 cd $LOCAL_OPKG_FOLDER
157 check_result
158
159 opkg_source_dir=`ls -d opkg-*`
160
161 if [ $opkg_source_dir == "" ]; then
162 echo_info "[ADT_INST] Error: OPKG source directory is not found!"
163 echo -e "\n#############################################################################"
164 echo -e "# Meet error(s) when installing Yocto ADT! Please check log file for details. "
165 echo -e "#############################################################################\n"
166 exit -1
167 fi
168
169 cd $opkg_source_dir
170 check_result
171
172 echo_info "Configure opkg ...\n"
173 ./configure --prefix=$parent_folder/$LOCAL_OPKG_LOC --with-opkglibdir=$OPKG_LIBDIR --disable-curl --disable-ssl-curl --disable-gpg --disable-shave >> $parent_folder/$YOCTOADT_INSTALL_LOG_FILE
174 check_result
175
176 echo_info "Make opkg ...\n"
177 make &>> $parent_folder/$YOCTOADT_INSTALL_LOG_FILE
178 check_result
179
180 echo_info "Make Install opkg ...\n"
181 make install &>> $parent_folder/$YOCTOADT_INSTALL_LOG_FILE
182 #if meet error when installing opkg, cancel the installation
183 check_result
184
185 cd $parent_folder
186 echo_info "Successfully installed OPKG.\n"
187fi
188}
189
190confirm_download()
191{
192#avoid repeated reminding
193if [ "$override_oldfile" == 1 ]; then
194 return $pre_result
195else
196 override_oldfile=1
197fi
198
199while true; do
200 #echo_info "[ADT_INST] Files [$1] already exists. If you continue downloading, old files will be overrided."
201 #echo_info "[ADT_INST] Further prompts will not be given if there're more existing files to be downloaded."
202 #echo_info "[ADT_INST] Do you want to continue downloading? Please enter Y/N:"
203 echo_info "\nFile [$1] already exists, which means you've downloaded the qemu kernel and rootfs file(s) before. If you choose continue downloading, old files will be overridden."
204 echo_info "[ADT_INST] Do you want to continue downloading? Please enter Y/N:"
205 read YOCTOADT_INSTALL
206 YOCTOADT_INSTALL=`tr '[a-z]' '[A-Z]'<<<"$YOCTOADT_INSTALL"`
207 if [ "$YOCTOADT_INSTALL" == "Y" ]; then
208 pre_result=0
209 return 0
210 elif [ "$YOCTOADT_INSTALL" == "N" ]; then
211 pre_result=1
212 return 1
213 fi
214done
215}
216
217download_file()
218{
219if [ -f "$LOCAL_DOWNLOAD/$1" ]; then
220 confirm_download $1
221 result="$?"
222 if [ ! "$result" == "0" ]; then
223 return
224 else
225 echo "Removing old file [$1]"
226 rm -rf "$LOCAL_DOWNLOAD/$1"
227 fi
228fi
229echo_info "Downloading file: $1..."
230wget "$YOCTOADT_IPKG_REPO/$1" -P $LOCAL_DOWNLOAD --progress=bar:force 2>&1 | tee -a "$YOCTOADT_INSTALL_LOG_FILE"
231}
232
233
234
235#Need two input params, $1 -- arch_type(arm powerpc x86 mips) $2 rootfs_image_type (a list of sdk sato minimal lsb)
236get_qemu_image()
237{
238 if [ "$1" == "x86" ]; then
239 qemu_kernel="bzImage-qemu$1.bin"
240 elif [ "$1" == "arm" ]; then
241 qemu_kernel="zImage-qemu$1.bin"
242 else
243 qemu_kernel="zImage-qemu$1.bin"
244 fi
245
246 #echo_info "[ADT_INST] Downloading qemu kernel binary: $qemu_kernel"
247 download_file $qemu_kernel
248 check_result
249
250 for image_type in $select_rootfs; do
251 #echo_info "[ADT_INST] Downloading rootfs file: poky-image-$image_type-qemu$1.tar.bz2"
252 filename="poky-image-$image_type-qemu$1.tar.bz2"
253 download_file $filename
254 check_result
255 done
256}
257
258download_images()
259{
260 #select_target_var="\$YOCTOADT_TARGET_$1"
261 #select_target=`eval echo $select_target_var`
262
263 #if [ "$select_target" == "Y" ]; then
264 select_rootfs_var="\$YOCTOADT_ROOTFS_$1"
265 select_sysroot_image_var="\$YOCTOADT_TARGET_SYSROOT_IMAGE_$1"
266 select_sysroot_var="\$YOCTOADT_TARGET_SYSROOT_LOC_$1"
267 select_rootfs=`eval echo $select_rootfs_var`
268 select_sysroot_image=`eval echo $select_sysroot_image_var`
269 select_sysroot=`eval echo $select_sysroot_var`
270
271 if [ "$select_rootfs" != "" ]; then
272 if [ $2 ]; then
273 #echo_info "\n############################################################################"
274 #echo_info "# To be downloaded rootfs image details defined in adt_installer.conf"
275 #echo_info "############################################################################"
276 echo_info "# Target architecture:\t\t$1"
277 echo_info "# Root_fs images:\t\t$select_rootfs"
278 echo_info "# Target sysroot image:\t\t$select_sysroot_image"
279 echo_info "# Target sysroot loc:\t\t$select_sysroot"
280 echo_info "\n"
281 #echo_info "############################################################################\n"
282 else
283 get_qemu_image $1 $select_rootfs
284 fi
285 fi
286}
287
288
289
290
291#Main body of installer
292
293clear
294
295run_path=`dirname $0`
296cd $run_path
297
298if [ ! -f "scripts/util" ]; then
299 echo -e "[ADT_INST] Error: Script file: util, can't be found under: $run_path!"
300 echo -e "\n#############################################################################"
301 echo -e "# Meet error(s) when installing Yocto ADT! Please check log file for details. "
302 echo -e "#############################################################################\n"
303 exit -1
304fi
305
306if [ ! -f "scripts/adt_installer_internal" ]; then
307 echo -e "[ADT_INST] Error: Script file: adt_installer_internal, can't be found under: $run_path!"
308 echo -e "\n#############################################################################"
309 echo -e "# Meet error(s) when installing Yocto ADT! Please check log file for details. "
310 echo -e "#############################################################################\n"
311 exit -1
312fi
313
314config_file="adt_installer.conf"
315if [ ! -f "$config_file" ]; then
316 echo_info "[ADT_INST] Error: Installation configuration file: adt_installer.conf is not found!\n"
317 echo_info "\n##################################################################################"
318 echo_info "# Meet error(s) when installing Yocto ADT. Please check log file for details. "
319 echo_info "##################################################################################\n"
320 exit -1
321fi
322
323. scripts/data_define
324. scripts/util
325
326
327if [ -f "$YOCTOADT_INSTALL_LOG_FILE" ]; then
328 rm $YOCTOADT_INSTALL_LOG_FILE
329fi
330
331
332usage
333
334user_inst_type="$?"
335
336validate_config
337check_result
338#firstly we need to install opkg host
339install_opkg
340
341#Create folders for holding rootfs/qemu images
342if [ ! -d "$LOCAL_DOWNLOAD" ]; then
343 echo_info "Creating new images downloading folder: $LOCAL_DOWNLOAD ..."
344 mkdir -p $LOCAL_DOWNLOAD
345fi
346
347#downloading required qemu images/rootfs
348if [ "$user_inst_type" == "0" ]; then
349 override_oldfile=1
350else
351 override_oldfile=0
352fi
353
354for arch_type in $YOCTOADT_SUPPORTED_TARGETS; do
355 download_images $arch_type
356done
357
358scripts/adt_installer_internal $user_inst_type
359
360result="$?"
361#echo_info "\n############################################################"
362if [ "$result" == "0" ]; then
363 echo_info "\n############################################################"
364 echo_info "# Yocto ADT has been successfully installed."
365 echo_info "############################################################\n"
366fi
367
diff --git a/meta/recipes-devtools/installer/adt-installer/adt_installer.conf b/meta/recipes-devtools/installer/adt-installer/adt_installer.conf
new file mode 100644
index 0000000000..a31e5595d2
--- /dev/null
+++ b/meta/recipes-devtools/installer/adt-installer/adt_installer.conf
@@ -0,0 +1,52 @@
1# Yocto ADT Installer Configuration File
2#
3# Copyright 2010-2011 by Intel Corp.
4#
5# Permission is hereby granted, free of charge, to any person obtaining a copy
6# of this software and associated documentation files (the "Software"), to deal
7# in the Software without restriction, including without limitation the rights
8# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9# copies of the Software, and to permit persons to whom the Software is
10# furnished to do so, subject to the following conditions:
11
12# The above copyright notice and this permission notice shall be included in
13# all copies or substantial portions of the Software.
14
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21# THE SOFTWARE.
22
23
24# Your yocto distro repository, this should include IPKG based packages and root filesystem files where the installation is based on
25
26YOCTOADT_IPKG_REPO="http://"
27
28# The following are for system wide setup
29# Target architectures that you want to setup host cross dev environment for
30# valid values are: powerpc, mips, arm, x86, x86_64 with space separation between entries
31YOCTOADT_TARGETS="arm x86"
32# Whether install qemu or not, valid entries are: Y/N
33YOCTOADT_QEMU="Y"
34# Whether install user-mode nfs or not, valid entries are: Y/N. If you want to use Yocto Eclipse plug-in as your dev IDE, you need to select both qemu and NFS
35YOCTOADT_NFS_UTIL="Y"
36
37# These 2 values will be supported in the furture installer
38#YOCTOADT_BITBAKE="Y"
39#YOCTOADT_METADATA="Y"
40
41#The followings are for setting up specific target architecture
42#YOCTOADT_ROOTFS_$arch is for specifying what root filesystem image files you want to download from the repository. The valid values to replace $arch are: arm, x86, x86_64, powerpc, mips. The valid image files are: minimal, sato, sdk and lsb. If you want to download multiple images, the entries are space separated
43YOCTOADT_ROOTFS_arm="minimal sato"
44#Specify which root filesystem file to use to extract as target sysroot. Please ensure the entry is in the list of downloaded root filesystem files that specified above in YOCTOADT_ROOTFS_$arch
45YOCTOADT_TARGET_SYSROOT_IMAGE_arm="minimal"
46#The location where the target sysroot will be setup
47YOCTOADT_TARGET_SYSROOT_LOC_arm="$HOME/test-yocto/arm"
48
49#Here's another example for setting up target arch of x86, by uncommenting it will trigger the installer to download and setup 2 sysroot environment for 2 target arches: arm and x86. If you want to add more target arch support, you can append more entries by following these samples
50#YOCTOADT_ROOTFS_x86="sdk"
51#YOCTOADT_TARGET_SYSROOT_IMAGE_x86="sdk"
52#YOCTOADT_TARGET_SYSROOT_LOC_x86="$HOME/test-yocto/x86"
diff --git a/meta/recipes-devtools/installer/adt-installer/opkg/conf/opkg-sdk-i586.conf b/meta/recipes-devtools/installer/adt-installer/opkg/conf/opkg-sdk-i586.conf
new file mode 100644
index 0000000000..36e585c4a6
--- /dev/null
+++ b/meta/recipes-devtools/installer/adt-installer/opkg/conf/opkg-sdk-i586.conf
@@ -0,0 +1,7 @@
1arch all 1
2arch any 6
3arch noarch 11
4arch i586-nativesdk 16
5src oe http://
6src oe-all http://
7src oe-i586-nativesdk http://
diff --git a/meta/recipes-devtools/installer/adt-installer/opkg/conf/opkg-sdk-x86_64.conf b/meta/recipes-devtools/installer/adt-installer/opkg/conf/opkg-sdk-x86_64.conf
new file mode 100644
index 0000000000..3ab49309d3
--- /dev/null
+++ b/meta/recipes-devtools/installer/adt-installer/opkg/conf/opkg-sdk-x86_64.conf
@@ -0,0 +1,7 @@
1arch all 1
2arch any 6
3arch noarch 11
4arch x86_64-nativesdk 16
5src oe http://
6src oe-all http://
7src oe-x86_64-nativesdk http://
diff --git a/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal b/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
new file mode 100755
index 0000000000..78e5c97436
--- /dev/null
+++ b/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
@@ -0,0 +1,209 @@
1#!/bin/bash
2
3# Yocto ADT Installer
4#
5# Copyright 2010-2011 by Intel Corp.
6#
7# Permission is hereby granted, free of charge, to any person obtaining a copy
8# of this software and associated documentation files (the "Software"), to deal
9# in the Software without restriction, including without limitation the rights
10# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11# copies of the Software, and to permit persons to whom the Software is
12# furnished to do so, subject to the following conditions:
13
14# The above copyright notice and this permission notice shall be included in
15# all copies or substantial portions of the Software.
16
17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23# THE SOFTWARE.
24
25parse_config()
26{
27 INST_ARCH=`uname -m`
28
29 case $INST_ARCH in
30 i[3-6]86)
31 OPKG_CONFIG_FILE=$YOCTOADT_OPKG_CONF_FILE_32
32 POKY_NATIVE_SYSROOT="$INSTALL_FOLDER/sysroots/i586-pokysdk-linux/"
33 ;;
34 x86_64)
35 OPKG_CONFIG_FILE=$YOCTOADT_OPKG_CONF_FILE_64
36 POKY_NATIVE_SYSROOT="$INSTALL_FOLDER/sysroots/x86_64-pokysdk-linux/"
37 ;;
38 *)
39 echo_info "[ADT_INST] Error: Installation Machine is not supported!"
40 exit -1
41 ;;
42 esac
43}
44
45
46#let us install a qemu-native firstly
47#installation step 2
48install_native_sdk()
49{
50
51echo_info "\nStart installing selected native ADT for archs: $YOCTOADT_TARGETS..."
52
53# where the packages are installed. Currently only / is supported
54NATIVE_INSTALL_DIR="/"
55
56if [ -d "$INSTALL_FOLDER" ]; then
57 echo_info "\nNative ADT installation directory \"$INSTALL_FOLDER\" already exists! Continue installation will override its contents!"
58 confirm_install $1
59fi
60
61#Now begin to install native sdk and extract qemu rootfs which needs privilege rights
62echo_info "#######################################################################"
63echo_info "Please note from this point on installation requires sudo password ..."
64echo_info "#######################################################################"
65username='id -nu'
66#we need to make this directory firstly since opkg need to use it.
67OPKG_LOCK_DIR="$NATIVE_INSTALL_DIR/$OPKG_LIBDIR/opkg"
68if [ ! -d "$OPKG_LOCK_DIR" ]; then
69 sudo mkdir -p $OPKG_LOCK_DIR
70 echo_info "Successfully create directory $OPKG_LOCK_DIR. "
71#if user delete /opt/poky, while dangling folders there, report error
72elif [ ! -d "$INSTALL_FOLDER" ]; then
73 echo_info "\nDangling opkg cache folder $OPKG_LOCK_DIR detected. Continue installation will remove the folder!"
74 confirm_install $1
75 sudo rm -rf $OPKG_LOCK_DIR
76 sudo mkdir -p $OPKG_LOCK_DIR
77#if user are updating installing, just let him/her go, give her/him prompt
78else
79 echo_info "ADT has already been installed. Will update its contents..."
80fi
81
82#first update repository
83OPKG_CMD="sudo $LOCAL_OPKG_LOC/bin/opkg-cl"
84
85echo_info "Updating opkg..."
86$OPKG_CMD -f $OPKG_CONFIG_FILE -o $NATIVE_INSTALL_DIR update &>> $YOCTOADT_INSTALL_LOG_FILE
87echo_info "opkg update process ended..."
88check_result
89
90#install below must sdk-host packages
91OPKG_INSTALL_CMD="$OPKG_CMD --force-overwrite"
92OPKG_INSTALL_NATIVE_CMD="$OPKG_INSTALL_CMD -f $OPKG_CONFIG_FILE -o $NATIVE_INSTALL_DIR install"
93
94echo_info "Installing pseudo nativesdk ...\n"
95$OPKG_INSTALL_NATIVE_CMD pseudo-nativesdk &>> $YOCTOADT_INSTALL_LOG_FILE
96check_result
97echo_info "Installing opkg nativesdk ...\n"
98$OPKG_INSTALL_NATIVE_CMD opkg-nativesdk &>> $YOCTOADT_INSTALL_LOG_FILE
99check_result
100echo_info "Installing pkgconfig nativesdk ...\n"
101$OPKG_INSTALL_NATIVE_CMD pkgconfig-nativesdk &>> $YOCTOADT_INSTALL_LOG_FILE
102check_result
103
104for native_target_type in $YOCTOADT_TARGETS; do
105 native_target_type=`echo "$native_target_type" | sed -e 's/x86_64/x86-64/' -e 's/x86$/i586/'`
106 echo_info "Installing cross toolchain for $native_target_type ..."
107 echo_info "Installing binutils for $native_target_type ..."
108 $OPKG_INSTALL_NATIVE_CMD binutils-cross-canadian-$native_target_type &>> $YOCTOADT_INSTALL_LOG_FILE
109 check_result
110 echo_info "Installing gcc for $native_target_type ..."
111 $OPKG_INSTALL_NATIVE_CMD gcc-cross-canadian-$native_target_type &>> $YOCTOADT_INSTALL_LOG_FILE
112 check_result
113 echo_info "Installing gdb for $native_target_type ..."
114 $OPKG_INSTALL_NATIVE_CMD gdb-cross-canadian-$native_target_type &>> $YOCTOADT_INSTALL_LOG_FILE
115 check_result
116
117 echo_info "Installing envrionement file for $native_target_type ..."
118 $OPKG_INSTALL_NATIVE_CMD meta-environment-$native_target_type &>> $YOCTOADT_INSTALL_LOG_FILE
119 check_result
120
121done
122
123# Link the ld.so.cache file into the hosts filesystem
124if [ ! -f "$POKY_NATIVE_SYSROOT/etc/ld.so.cache" ]; then
125echo_info "Link the ld.so.cache file into the host filesystem"
126sudo ln -s /etc/ld.so.cache $POKY_NATIVE_SYSROOT/etc/ld.so.cache
127check_result
128fi
129
130if [ "$YOCTOADT_QEMU" == "Y" ] || [ "$YOCTOADT_QEMU" = "y" ]; then
131 echo_info "\nInstalling qemu native ..."
132 $OPKG_INSTALL_NATIVE_CMD qemu-nativesdk &>> $YOCTOADT_INSTALL_LOG_FILE
133 check_result
134 $OPKG_INSTALL_NATIVE_CMD qemu-helper-nativesdk &>> $YOCTOADT_INSTALL_LOG_FILE
135 check_result
136fi
137
138if [ "$YOCTOADT_NFS_UTIL" == "Y" ] || [ "$YOCTOADT_NFS_UTIL" == "y" ]; then
139 echo_info "\nInstalling unfs ..."
140 $OPKG_INSTALL_NATIVE_CMD unfs-server-nativesdk &>> $YOCTOADT_INSTALL_LOG_FILE
141 check_result
142fi
143
144echo_info "\nSuccessfully installed selected native ADT!"
145}
146
147#Need three input params, $1 -- arch_type(arm powerpc x86 mips) #2 -- user installation type
148#customer or scilent
149
150install_target()
151{
152
153# rootfs extraction directory
154target_sysroot_var="\$YOCTOADT_TARGET_SYSROOT_LOC_$1"
155target_sysroot=`eval echo $target_sysroot_var`
156
157if [ "$target_sysroot" == "" ]; then
158 return 0
159fi
160
161target_sysroot_image_var="\$YOCTOADT_TARGET_SYSROOT_IMAGE_$1"
162target_sysroot_image=`eval echo $target_sysroot_image_var`
163if [ "$target_sysroot_image" == "" ]; then
164 echo_info "[ADT_INST] Error: YOCTOADT_TARGET_SYSROOT_IMAGE_$1 selection is empty, failed to create target sysroot!"
165 return 1
166fi
167
168echo_info "Installing target sysroot for arch: $1, rootfs type: $target_sysroot_image, location: $target_sysroot"
169
170sysroot_image_name="poky-image-$target_sysroot_image-qemu$1.tar.bz2"
171 #echo_info "Extracting rootfs: $sysroot_image_name, using pseudo..."
172
173scripts/extract_rootfs $sysroot_image_name $target_sysroot $POKY_NATIVE_SYSROOT $user_inst_type
174check_result
175
176echo_info "Updating environment script with target sysroot location."
177if [ "$1" == "x86" ]; then
178 env_filename=`ls $INSTALL_FOLDER/environment-setup-i586*`
179else
180 env_filename=`ls $INSTALL_FOLDER/environment-setup-$1*`
181fi
182if [ ! -z "$env_filename" ]; then
183 sudo sed -i -e "s%##SDKTARGETSYSROOT##%$target_sysroot%g" $env_filename
184else
185 echo_info "[ADT_INST] Error: Failed to find environment script for arch: $1"
186 return 1
187fi
188
189
190}
191
192
193#Main part
194. scripts/data_define
195. scripts/util
196
197parse_config
198
199#secondly we will start to install native tools
200user_inst_type=$1
201install_native_sdk $user_inst_type
202check_result
203
204for arch_type in $YOCTOADT_SUPPORTED_TARGETS; do
205 install_target $arch_type
206 check_result
207done
208
209
diff --git a/meta/recipes-devtools/installer/adt-installer/scripts/data_define b/meta/recipes-devtools/installer/adt-installer/scripts/data_define
new file mode 100644
index 0000000000..e975077ede
--- /dev/null
+++ b/meta/recipes-devtools/installer/adt-installer/scripts/data_define
@@ -0,0 +1,40 @@
1#!/bin/bash
2
3# Yocto ADT Installer
4#
5# Copyright 2010-2011 by Intel Corp.
6#
7# Permission is hereby granted, free of charge, to any person obtaining a copy
8# of this software and associated documentation files (the "Software"), to deal
9# in the Software without restriction, including without limitation the rights
10# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11# copies of the Software, and to permit persons to whom the Software is
12# furnished to do so, subject to the following conditions:
13
14# The above copyright notice and this permission notice shall be included in
15# all copies or substantial portions of the Software.
16
17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23# THE SOFTWARE.
24
25config_file="adt_installer.conf"
26source $config_file
27
28LOCAL_OPKG_LOC="./opkg/build/opkg"
29LOCAL_OPKG_FOLDER="./opkg/build"
30OPKG_LIBDIR="/var/lib"
31
32# List all supported root fs types and target types,
33# it will be used in user configuration validity checking
34YOCTOADT_SUPPORTED_ROOTFS="minimal sato sdk lsb"
35YOCTOADT_SUPPORTED_TARGETS="x86 x86_64 arm powerpc mips"
36# Different host (32 bit or 64 bit) will have different opkg
37# configuration files
38YOCTOADT_OPKG_CONF_FILE_32="./opkg/conf/opkg-sdk-i586.conf"
39YOCTOADT_OPKG_CONF_FILE_64="./opkg/conf/opkg-sdk-x86_64.conf"
40INSTALL_FOLDER=/opt/poky/$YOCTOADT_VERSION
diff --git a/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs b/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
new file mode 100755
index 0000000000..3dd47f0f75
--- /dev/null
+++ b/meta/recipes-devtools/installer/adt-installer/scripts/extract_rootfs
@@ -0,0 +1,67 @@
1#!/bin/bash
2
3# Yocto ADT Installer
4#
5# Copyright 2010-2011 by Intel Corp.
6#
7# Permission is hereby granted, free of charge, to any person obtaining a copy
8# of this software and associated documentation files (the "Software"), to deal
9# in the Software without restriction, including without limitation the rights
10# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11# copies of the Software, and to permit persons to whom the Software is
12# furnished to do so, subject to the following conditions:
13
14# The above copyright notice and this permission notice shall be included in
15# all copies or substantial portions of the Software.
16
17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23# THE SOFTWARE.
24
25extract_rootfs()
26{
27
28 native_sysroot=$3
29 target_sysroot=$2
30 PSEUDO_COMMAND="$native_sysroot/usr/bin/pseudo"
31 PSEUDO_OPTS="-P $natvie_sysroot/usr"
32 TAR_OPTS="-xjf"
33 PSEUDO_OPTS="-P $native_sysroot/usr"
34
35
36 rm -rf $PSEUDO_LOCALSTATEDIR
37
38 if [ -d "$target_sysroot" ]; then
39 echo_info "\nTarget sysroot location: $target_sysroot, already exists! If you continue installation, this folder will be re-created."
40 confirm_install $4
41 rm -rf "$target_sysroot"
42 fi
43
44 if [ ! -d "$target_sysroot" ]; then
45 echo_info "Creating directory $target_sysroot..."
46 mkdir -p "$target_sysroot"
47 fi
48
49 mkdir -p "$target_sysroot/var/pseudo"
50 touch "$target_sysroot/var/pseudo/pseudo.pid"
51 PSEUDO_LOCALSTATEDIR="$target_sysroot/var/pseudo"
52 export PSEUDO_LOCALSTATEDIR
53
54 echo_info "Extracting rootfs: $1, using pseudo..."
55 $PSEUDO_COMMAND $PSEUDO_OPTS tar -C $2 "$TAR_OPTS" $LOCAL_DOWNLOAD/$1 &>> $YOCTOADT_INSTALL_LOG_FILE
56 check_result
57}
58
59#Main part
60. scripts/util
61
62#Parameter detail is listed below:
63#Param 4: Silent install or customize install
64#Param 3: POKY_NATIVE_SYSROOT
65#Param 2: user defined rootfs extraction directory
66#param 1: sysroot image name
67extract_rootfs $1 $2 $3 $4
diff --git a/meta/recipes-devtools/installer/adt-installer/scripts/util b/meta/recipes-devtools/installer/adt-installer/scripts/util
new file mode 100644
index 0000000000..4b88feea5a
--- /dev/null
+++ b/meta/recipes-devtools/installer/adt-installer/scripts/util
@@ -0,0 +1,104 @@
1#!/bin/bash
2
3# Yocto ADT Installer
4#
5# Copyright 2010-2011 by Intel Corp.
6#
7# Permission is hereby granted, free of charge, to any person obtaining a copy
8# of this software and associated documentation files (the "Software"), to deal
9# in the Software without restriction, including without limitation the rights
10# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11# copies of the Software, and to permit persons to whom the Software is
12# furnished to do so, subject to the following conditions:
13
14# The above copyright notice and this permission notice shall be included in
15# all copies or substantial portions of the Software.
16
17# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23# THE SOFTWARE.
24
25echo_info()
26{
27 echo -e $1 | tee -a $YOCTOADT_INSTALL_LOG_FILE
28}
29
30select_install_type()
31{
32# If choosing silent install, all older installation data will be
33# overriden without user's interaction
34while true; do
35 #echo_info "[ADT_INST] Silent install means overrides all existing older"
36 #echo_info "[ADT_INST] data and the installation needs least user interaction"
37 #echo_info "[ADT_INST] If you want to use silent installation, please enter S:"
38 #echo_info "[ADT_INST] If you want to customize installation, please enter C:"
39 #echo_info "[ADT_INST} If you want to exit current installation, please enter X:"
40 echo_info "There're two ways you can do installation: silent mode or interactive mode. To choose silent mode, which means you opt for the system to override the existing data under the specified installation directories without prompting for your confirmation. Please be cautious with this selection which may trigger your losing data. With the interactive mode, you have to closely monitor the installation process, since it will prompt you each step it needs to override some existing data. To choose silent mode, please enter [S], for interactive mode, please enter [I] or [X] to exit the installation."
41 echo_info "[ADT_INST] Please enter your selections here:"
42 read YOCTOADT_SEL
43 YOCTOADT_SEL=`tr '[a-z]' '[A-Z]'<<<"$YOCTOADT_SEL"`
44 if [ "$YOCTOADT_SEL" == "S" ]; then
45 return "0"
46 elif [ "$YOCTOADT_SEL" == "I" ]; then
47 return "1"
48 elif [ "$YOCTOADT_SEL" == "X" ]; then
49 echo_info "\n############################################################"
50 echo_info "# User cancelled installation!"
51 echo_info "############################################################\n"
52 exit 1
53 fi
54done
55
56
57}
58
59confirm_install()
60{
61# below are prompt, make sure user still want to install even meet
62# some prompts
63
64#User likes to enjoy silent installation, we will not break his
65#installation process here
66if [ "$1" == "0" ]; then
67 return
68fi
69
70while true; do
71 echo_info "[ADT_INST] Do you want to continue installation? Please enter Y/N:"
72 read YOCTOADT_INSTALL
73 YOCTOADT_INSTALL=`tr '[a-z]' '[A-Z]'<<<"$YOCTOADT_INSTALL"`
74 if [ "$YOCTOADT_INSTALL" == "Y" ]; then
75 break
76 elif [ "$YOCTOADT_INSTALL" == "N" ]; then
77 echo_info "\n############################################################"
78 echo_info "# User cancelled installation!"
79 echo_info "############################################################\n"
80 exit 1
81 fi
82done
83}
84
85check_result()
86{
87 result="$?"
88 if [ "$result" == "-1" ]; then
89 echo_info "\n#############################################################################"
90 echo_info "# Meet error(s) when installing Yocto ADT! Please check log file for details. "
91 echo_info "#############################################################################\n"
92 exit -1
93 elif [ "$result" == "1" ]; then
94 exit -1
95 fi
96}
97
98# yocto adt installation log file
99YOCTOADT_INSTALL_LOG_FILE="adt_installer.log"
100# Temp folders holding qemu/rootfs downloaded images
101# It will be put into the installation folder
102LOCAL_DOWNLOAD="./download_image"
103
104
diff --git a/meta/recipes-devtools/installer/adt-installer_1.0.bb b/meta/recipes-devtools/installer/adt-installer_1.0.bb
new file mode 100644
index 0000000000..226e375c3f
--- /dev/null
+++ b/meta/recipes-devtools/installer/adt-installer_1.0.bb
@@ -0,0 +1,84 @@
1# Yocto ADT Installer bb file
2#
3# Copyright 2010-2011 by Intel Corp.
4#
5# Permission is hereby granted, free of charge, to any person obtaining a copy
6# of this software and associated documentation files (the "Software"), to deal
7# in the Software without restriction, including without limitation the rights
8# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9# copies of the Software, and to permit persons to whom the Software is
10# furnished to do so, subject to the following conditions:
11
12# The above copyright notice and this permission notice shall be included in
13# all copies or substantial portions of the Software.
14
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21# THE SOFTWARE.
22
23
24DESCRIPTION = "Meta package for creating sdk installer tarball"
25LIC_FILES_CHKSUM = "file://${POKYBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
26 file://${POKYBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
27LICENSE = "MIT"
28
29ALLOW_EMPTY = "1"
30
31PACKAGES = ""
32PACKAGE_ARCH = "all"
33
34PR = "r0"
35
36ADT_DEPLOY = "${TMPDIR}/deploy/sdk/"
37ADT_DIR = "${WORKDIR}/adt-installer/"
38YOCTOADT_VERSION = "${SDK_VERSION}"
39
40inherit deploy
41
42SRC_URI = "http://opkg.googlecode.com/files/opkg-0.1.8.tar.gz \
43 file://adt_installer \
44 file://scripts/adt_installer_internal \
45 file://scripts/util \
46 file://scripts/data_define \
47 file://scripts/extract_rootfs \
48 file://adt_installer.conf \
49 file://opkg/conf/opkg-sdk-x86_64.conf \
50 file://opkg/conf/opkg-sdk-i586.conf \
51 "
52SRC_URI[md5sum] = "c714ce0e4863bf1315e3b6913ffe3299"
53SRC_URI[sha256sum] = "ff94bf30bd662d49c4b5057e3a0818d062731adaa555d59abd677ec32a3c1c60"
54
55fakeroot do_deploy () {
56 cd ${WORKDIR}
57 mkdir -p ${ADT_DEPLOY}
58 rm -f ${ADT_DEPLOY}/adt-installer.tar.bz2
59 rm -rf ${ADT_DIR}
60 mkdir -p ${ADT_DIR}/opkg/build
61 cp -r opkg ${ADT_DIR}/
62 cp -r opkg-0.1.8 ${ADT_DIR}/opkg/build/
63 cp -r scripts ${ADT_DIR}/
64 cp adt_installer ${ADT_DIR}
65 cp adt_installer.conf ${ADT_DIR}
66 echo 'YOCTOADT_VERSION=${SDK_VERSION}' > ${ADT_DIR}/temp.conf
67 cat ${ADT_DIR}/adt_installer.conf >> ${ADT_DIR}/temp.conf
68 mv ${ADT_DIR}/temp.conf ${ADT_DIR}/adt_installer.conf
69 tar cfj adt_installer.tar.bz2 adt-installer
70 cp ${WORKDIR}/adt_installer.tar.bz2 ${ADT_DEPLOY}
71}
72
73do_patch[noexec] = "1"
74do_install[noexec] = "1"
75do_configure[noexec] = "1"
76do_compile[noexec] = "1"
77do_package[noexec] = "1"
78do_package_write[noexec] = "1"
79do_package_write_ipk[noexec] = "1"
80do_package_write_rpm[noexec] = "1"
81do_package_write_deb[noexec] = "1"
82do_poplulate_sysroot[noexec] = "1"
83
84addtask deploy before do_populate_sysroot after do_unpack