Patchwork [1/1] adt_installer: fix issue with x86_64

login
register
mail settings
Submitter Laurentiu Palcu
Date Feb. 26, 2014, 1:54 p.m.
Message ID <72cf90ecf51d88becfaf037b6233c78e8c6e4a9c.1393422829.git.laurentiu.palcu@intel.com>
Download mbox | patch
Permalink /patch/67479/
State New
Headers show

Comments

Laurentiu Palcu - Feb. 26, 2014, 1:54 p.m.
When the default tune for x86_64 was changed to core2-64, the
environment setup script name did not contain x86 anymore. Hence, the
adt_installer failed for x86_64.

This commit contains a generic fix and is supposed to work with any kind
of machine/tune setting. It's actually extracting the environment script
name using 'opkg files meta-environment-MACHINE'. So, no need to do any
other sort of searches. We know exactly which is the environment setup
script for the specified machine.

[YOCTO #5806]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 .../adt-installer/scripts/adt_installer_internal   |   61 +++++++++++---------
 1 file changed, 35 insertions(+), 26 deletions(-)

Patch

diff --git a/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal b/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
index e3422f5..432ba41 100755
--- a/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
+++ b/meta/recipes-devtools/installer/adt-installer/scripts/adt_installer_internal
@@ -64,6 +64,23 @@  get_sudo_app()
   fi
 }
 
+# this function accepts arch_type (x86, x86_64, arm, ppc, mips) as the first
+# argument, returning the location of the target rootfs
+get_target_rootfs_location() {
+	[ -z "$1" ] && return
+
+	arch_type=$1
+	# rootfs extraction directory
+	target_sysroot_var="\$YOCTOADT_TARGET_SYSROOT_LOC_$arch_type"
+	target_sysroot=`eval echo $target_sysroot_var`
+
+	if [ "$target_sysroot" == "" ]; then
+		return
+	else
+		echo "`readlink -m $target_sysroot`"
+	fi
+}
+
 
 #let us install a qemu-native firstly
 #installation step 2
@@ -134,6 +151,22 @@  for target_type in $YOCTOADT_TARGETS; do
   echo_info "Installing cross canadian packages for $machine ..."
   $OPKG_INSTALL_NATIVE_CMD packagegroup-cross-canadian-$machine &>> $YOCTOADT_INSTALL_LOG_FILE
   check_result
+
+  target_sysroot=`get_target_rootfs_location $target_type`
+  [ -z "$target_sysroot" ] && continue
+
+  # get the environment setup script paths: original (the one before relocation)
+  # and relocated
+  env_script_original=`$OPKG_CMD -f $OPKG_CONFIG_FILE -o $NATIVE_INSTALL_DIR files meta-environment-$machine|\
+							grep environment-setup`
+  env_script_relocated=$INSTALL_FOLDER/${env_script_original##*/}
+
+  # opkg will not install packagegroup-cross-canadian package if it was already
+  # installed. So, the environment script is in one place or the other.
+  [ -e "$env_script_original" ] && env_script=$env_script_original
+  [ -e "$env_script_relocated" ] && env_script=$env_script_relocated
+
+  $SUDO sed -i -e "s%##SDKTARGETSYSROOT##%$target_sysroot%g" $env_script
 done
 
 if [ "$YOCTOADT_QEMU" == "Y" ] || [ "$YOCTOADT_QEMU" = "y" ]; then
@@ -232,15 +265,8 @@  echo_info "\nSuccessfully installed selected native ADT!"
 install_target()
 {
 
-# rootfs extraction directory
-target_sysroot_var="\$YOCTOADT_TARGET_SYSROOT_LOC_$1"
-target_sysroot=`eval echo $target_sysroot_var`
-
-if [ "$target_sysroot" == "" ]; then
-  return 0
-else
-  target_sysroot=`readlink -m $target_sysroot`
-fi
+target_sysroot=`get_target_rootfs_location $1`
+[ -z "$target_sysroot" ] && return 0
 
 target_sysroot_image_var="\$YOCTOADT_TARGET_SYSROOT_IMAGE_$1"
 target_sysroot_image=`eval echo $target_sysroot_image_var`
@@ -261,23 +287,6 @@  SUDO=$(get_sudo_app $target_sysroot)
 
 $SUDO scripts/extract_rootfs $sysroot_image_name $target_sysroot $OECORE_NATIVE_SYSROOT $user_inst_type
 check_result
-
-echo_info "Updating environment script with target sysroot location."
-if [ "$1" == "x86"  ]; then
-  env_filename=`ls $INSTALL_FOLDER/environment-setup-i586*`
-else
-  env_filename=`ls $INSTALL_FOLDER/environment-setup-$1*`
-fi
-
-if [ ! -z "$env_filename" ]; then
-  SUDO=$(get_sudo_app $INSTALL_FOLDER)
-  $SUDO sed -i -e "s%##SDKTARGETSYSROOT##%$target_sysroot%g" $env_filename
-else
-  echo_info "[ADT_INST] Error: Failed to find environment script for arch: $1"
-  return 1 
-fi
-
-
 }