diff options
author | Liping Ke <liping.ke@intel.com> | 2011-01-03 23:21:40 -0800 |
---|---|---|
committer | Saul Wold <sgw@linux.intel.com> | 2011-01-12 00:55:49 -0800 |
commit | 514e59c780ac24439ae0839fab311d843841bf68 (patch) | |
tree | 3130a2992cc9428db0440427dc9df74fd06662c9 /meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal | |
parent | 03072100f112b9690c1a99d1c406c098a9005a84 (diff) | |
download | poky-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>
Diffstat (limited to 'meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal')
-rwxr-xr-x | meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal | 209 |
1 files changed, 209 insertions, 0 deletions
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 | |||
25 | parse_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 | ||
48 | install_native_sdk() | ||
49 | { | ||
50 | |||
51 | echo_info "\nStart installing selected native ADT for archs: $YOCTOADT_TARGETS..." | ||
52 | |||
53 | # where the packages are installed. Currently only / is supported | ||
54 | NATIVE_INSTALL_DIR="/" | ||
55 | |||
56 | if [ -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 | ||
59 | fi | ||
60 | |||
61 | #Now begin to install native sdk and extract qemu rootfs which needs privilege rights | ||
62 | echo_info "#######################################################################" | ||
63 | echo_info "Please note from this point on installation requires sudo password ..." | ||
64 | echo_info "#######################################################################" | ||
65 | username='id -nu' | ||
66 | #we need to make this directory firstly since opkg need to use it. | ||
67 | OPKG_LOCK_DIR="$NATIVE_INSTALL_DIR/$OPKG_LIBDIR/opkg" | ||
68 | if [ ! -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 | ||
72 | elif [ ! -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 | ||
78 | else | ||
79 | echo_info "ADT has already been installed. Will update its contents..." | ||
80 | fi | ||
81 | |||
82 | #first update repository | ||
83 | OPKG_CMD="sudo $LOCAL_OPKG_LOC/bin/opkg-cl" | ||
84 | |||
85 | echo_info "Updating opkg..." | ||
86 | $OPKG_CMD -f $OPKG_CONFIG_FILE -o $NATIVE_INSTALL_DIR update &>> $YOCTOADT_INSTALL_LOG_FILE | ||
87 | echo_info "opkg update process ended..." | ||
88 | check_result | ||
89 | |||
90 | #install below must sdk-host packages | ||
91 | OPKG_INSTALL_CMD="$OPKG_CMD --force-overwrite" | ||
92 | OPKG_INSTALL_NATIVE_CMD="$OPKG_INSTALL_CMD -f $OPKG_CONFIG_FILE -o $NATIVE_INSTALL_DIR install" | ||
93 | |||
94 | echo_info "Installing pseudo nativesdk ...\n" | ||
95 | $OPKG_INSTALL_NATIVE_CMD pseudo-nativesdk &>> $YOCTOADT_INSTALL_LOG_FILE | ||
96 | check_result | ||
97 | echo_info "Installing opkg nativesdk ...\n" | ||
98 | $OPKG_INSTALL_NATIVE_CMD opkg-nativesdk &>> $YOCTOADT_INSTALL_LOG_FILE | ||
99 | check_result | ||
100 | echo_info "Installing pkgconfig nativesdk ...\n" | ||
101 | $OPKG_INSTALL_NATIVE_CMD pkgconfig-nativesdk &>> $YOCTOADT_INSTALL_LOG_FILE | ||
102 | check_result | ||
103 | |||
104 | for 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 | |||
121 | done | ||
122 | |||
123 | # Link the ld.so.cache file into the hosts filesystem | ||
124 | if [ ! -f "$POKY_NATIVE_SYSROOT/etc/ld.so.cache" ]; then | ||
125 | echo_info "Link the ld.so.cache file into the host filesystem" | ||
126 | sudo ln -s /etc/ld.so.cache $POKY_NATIVE_SYSROOT/etc/ld.so.cache | ||
127 | check_result | ||
128 | fi | ||
129 | |||
130 | if [ "$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 | ||
136 | fi | ||
137 | |||
138 | if [ "$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 | ||
142 | fi | ||
143 | |||
144 | echo_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 | |||
150 | install_target() | ||
151 | { | ||
152 | |||
153 | # rootfs extraction directory | ||
154 | target_sysroot_var="\$YOCTOADT_TARGET_SYSROOT_LOC_$1" | ||
155 | target_sysroot=`eval echo $target_sysroot_var` | ||
156 | |||
157 | if [ "$target_sysroot" == "" ]; then | ||
158 | return 0 | ||
159 | fi | ||
160 | |||
161 | target_sysroot_image_var="\$YOCTOADT_TARGET_SYSROOT_IMAGE_$1" | ||
162 | target_sysroot_image=`eval echo $target_sysroot_image_var` | ||
163 | if [ "$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 | ||
166 | fi | ||
167 | |||
168 | echo_info "Installing target sysroot for arch: $1, rootfs type: $target_sysroot_image, location: $target_sysroot" | ||
169 | |||
170 | sysroot_image_name="poky-image-$target_sysroot_image-qemu$1.tar.bz2" | ||
171 | #echo_info "Extracting rootfs: $sysroot_image_name, using pseudo..." | ||
172 | |||
173 | scripts/extract_rootfs $sysroot_image_name $target_sysroot $POKY_NATIVE_SYSROOT $user_inst_type | ||
174 | check_result | ||
175 | |||
176 | echo_info "Updating environment script with target sysroot location." | ||
177 | if [ "$1" == "x86" ]; then | ||
178 | env_filename=`ls $INSTALL_FOLDER/environment-setup-i586*` | ||
179 | else | ||
180 | env_filename=`ls $INSTALL_FOLDER/environment-setup-$1*` | ||
181 | fi | ||
182 | if [ ! -z "$env_filename" ]; then | ||
183 | sudo sed -i -e "s%##SDKTARGETSYSROOT##%$target_sysroot%g" $env_filename | ||
184 | else | ||
185 | echo_info "[ADT_INST] Error: Failed to find environment script for arch: $1" | ||
186 | return 1 | ||
187 | fi | ||
188 | |||
189 | |||
190 | } | ||
191 | |||
192 | |||
193 | #Main part | ||
194 | . scripts/data_define | ||
195 | . scripts/util | ||
196 | |||
197 | parse_config | ||
198 | |||
199 | #secondly we will start to install native tools | ||
200 | user_inst_type=$1 | ||
201 | install_native_sdk $user_inst_type | ||
202 | check_result | ||
203 | |||
204 | for arch_type in $YOCTOADT_SUPPORTED_TARGETS; do | ||
205 | install_target $arch_type | ||
206 | check_result | ||
207 | done | ||
208 | |||
209 | |||