Add Tizen rootfs for armel
authorHyung-Kyu Choi <hk0110.choi@samsung.com>
Thu, 5 Jan 2017 05:48:10 +0000 (14:48 +0900)
committerHyung-Kyu Choi <hk0110.choi@samsung.com>
Thu, 5 Jan 2017 09:44:14 +0000 (18:44 +0900)
- This rootfs can be used for CoreCLR, CoreFX and Core-Setup.

Signed-off-by: Hyung-Kyu Choi <hk0110.choi@samsung.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/55a1b2f1ad9c1389712f064bb6cf58e1df71949e

src/coreclr/cross/armel/tizen-build-rootfs.sh [new file with mode: 0755]
src/coreclr/cross/armel/tizen/tizen.patch [new file with mode: 0644]
src/coreclr/cross/build-rootfs.sh

diff --git a/src/coreclr/cross/armel/tizen-build-rootfs.sh b/src/coreclr/cross/armel/tizen-build-rootfs.sh
new file mode 100755 (executable)
index 0000000..b77307c
--- /dev/null
@@ -0,0 +1,93 @@
+#!/usr/bin/env bash
+set -e
+
+__ARM_SOFTFP_CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+__TIZEN_CROSSDIR="$__ARM_SOFTFP_CrossDir/tizen"
+
+if [[ -z "$ROOTFS_DIR" ]]; then
+    echo "ROOTFS_DIR is not defined."
+    exit 1;
+fi
+
+# Clean-up (TODO-Cleanup: We may already delete  $ROOTFS_DIR at ./cross/build-rootfs.sh.)
+# hk0110
+if [ -d "$ROOTFS_DIR" ]; then
+    umount $ROOTFS_DIR/*
+    rm -rf $ROOTFS_DIR
+fi
+
+TIZEN_TMP_DIR=$ROOTFS_DIR/tizen_tmp
+TIZEN_TMP_DOWNLOAD_DIR=$TIZEN_TMP_DIR/download
+TIZEN_TMP_UNZIP_DIR=$TIZEN_TMP_DIR/unzip
+mkdir -p $TIZEN_TMP_DOWNLOAD_DIR
+mkdir -p $TIZEN_TMP_UNZIP_DIR
+
+download_files()
+{
+    # TODO: There will be a stable Tizen rootfs available later.
+    # Now we temporarily use live repo for developing dotnet for Tizen
+
+    TIZEN_DOWNLOAD_OPTIONS="-P $TIZEN_TMP_DOWNLOAD_DIR"
+    TIZEN_DOWNLOAD_CMD="wget $TIZEN_DOWNLOAD_OPTIONS"
+
+    TIZEN_BASE_ARM="http://download.tizen.org/releases/weekly/tizen/base/latest/repos/arm/packages/armv7l"
+    TIZEN_BASE_NOARCH="http://download.tizen.org/releases/weekly/tizen/base/latest/repos/arm/packages/noarch"
+    TIZEN_MOBILE_ARM="http://download.tizen.org/releases/weekly/tizen/mobile/latest/repos/arm-wayland/packages/armv7l"
+
+    # 1. basse packages
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/gcc-4.9.2-15.1.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/glibc-2.20-12.1.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/glibc-devel-2.20-12.1.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_NOARCH/linux-glibc-devel-3.10-1.3.noarch.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_MOBILE_ARM/libicu-devel-57.1-14.2.armv7l.rpm"
+
+    # 2. download rpms
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/lldb-3.8.1-2.7.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/lldb-devel-3.8.1-2.7.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/libuuid-2.28-8.1.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/libuuid-devel-2.28-8.1.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/libgcc-4.9.2-15.1.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/libstdc++-4.9.2-15.1.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/libstdc++-devel-4.9.2-15.1.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_MOBILE_ARM/libunwind-1.1-7.22.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_MOBILE_ARM/libunwind-devel-1.1-7.22.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_MOBILE_ARM/tizen-release-3.0.0-10.31.armv7l.rpm"
+
+    # 3. for corefx
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/libcom_err-1.42.13-2.8.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/libcom_err-devel-1.42.13-2.8.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/zlib-1.2.8-1.17.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/zlib-devel-1.2.8-1.17.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/libopenssl-1.0.2j-10.1.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_BASE_ARM/libopenssl-devel-1.0.2j-10.1.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_MOBILE_ARM/gssdp-0.14.4-4.2.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_MOBILE_ARM/gssdp-devel-0.14.4-4.2.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_MOBILE_ARM/krb5-1.10.2-3.1.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_MOBILE_ARM/krb5-devel-1.10.2-3.1.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_MOBILE_ARM/libcurl-7.50.2-17.2.armv7l.rpm"
+    $TIZEN_DOWNLOAD_CMD "$TIZEN_MOBILE_ARM/libcurl-devel-7.50.2-17.2.armv7l.rpm"
+}
+
+# Download files
+echo ">>Start downloading files"
+download_files
+echo "<<Finish downloading files"
+
+echo ">>Start constructing Tizen rootfs"
+TIZEN_RPM_FILES=`ls $TIZEN_TMP_DOWNLOAD_DIR/*.rpm`
+cd $ROOTFS_DIR
+for f in $TIZEN_RPM_FILES; do
+    rpm2cpio $f  | cpio -idm --quiet
+done
+echo "<<Finish constructing Tizen rootfs"
+
+# Cleanup tmp
+rm -rf $TIZEN_TMP_DIR
+
+# Configure Tizen rootfs
+echo ">>Start configuring Tizen rootfs"
+rm ./usr/lib/libunwind.so
+ln -s libunwind.so.8 ./usr/lib/libunwind.so
+ln -sfn asm-arm ./usr/include/asm
+patch -p1 < $__TIZEN_CROSSDIR/tizen.patch
+echo "<<Finish configuring Tizen rootfs"
diff --git a/src/coreclr/cross/armel/tizen/tizen.patch b/src/coreclr/cross/armel/tizen/tizen.patch
new file mode 100644 (file)
index 0000000..c92dc02
--- /dev/null
@@ -0,0 +1,33 @@
+diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so
+--- a/usr/lib/libc.so  2016-12-30 23:00:08.284951863 +0900
++++ b/usr/lib/libc.so  2016-12-30 23:00:32.140951815 +0900
+@@ -2,4 +2,4 @@
+    Use the shared library, but some functions are only in
+    the static library, so try that secondarily.  */
+ OUTPUT_FORMAT(elf32-littlearm)
+-GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a  AS_NEEDED ( /lib/ld-linux.so.3 ) )
++GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.3 ) )
+diff -u -r a/usr/lib/libpthread.so b/usr/lib/libpthread.so
+--- a/usr/lib/libpthread.so    2016-12-30 23:00:19.408951841 +0900
++++ b/usr/lib/libpthread.so    2016-12-30 23:00:39.068951801 +0900
+@@ -2,4 +2,4 @@
+    Use the shared library, but some functions are only in
+    the static library, so try that secondarily.  */
+ OUTPUT_FORMAT(elf32-littlearm)
+-GROUP ( /lib/libpthread.so.0 /usr/lib/libpthread_nonshared.a )
++GROUP ( libpthread.so.0 libpthread_nonshared.a )
+diff -u -r a/usr/lib/libpthread.so b/usr/lib/libpthread.so
+--- a/etc/os-release  2016-10-17 23:39:36.000000000 +0900
++++ b/etc/os-release  2017-01-05 14:34:39.099867682 +0900
+@@ -1,7 +1,7 @@
+ NAME=Tizen
+-VERSION="3.0.0 (Tizen3/Mobile)"
++VERSION="4.0.0 (Tizen4/Mobile)"
+ ID=tizen
+-VERSION_ID=3.0.0
+-PRETTY_NAME="Tizen 3.0.0 (Tizen3/Mobile)"
++VERSION_ID=4.0.0
++PRETTY_NAME="Tizen 4.0.0 (Tizen4/Mobile)"
+ ANSI_COLOR="0;36"
+-CPE_NAME="cpe:/o:tizen:tizen:3.0.0"
++CPE_NAME="cpe:/o:tizen:tizen:4.0.0"
index 529cc50..6f10c68 100755 (executable)
@@ -4,7 +4,7 @@ usage()
 {
     echo "Usage: $0 [BuildArch] [UbuntuCodeName] [lldbx.y]"
     echo "BuildArch can be: arm(default), armel, arm64, x86"
-    echo "UbuntuCodeName - optional, Code name for Ubuntu, can be: trusty(default), vivid, wily, xenial. If BuildArch is armel, UbuntuCodeName is ignored."
+    echo "UbuntuCodeName - optional, Code name for Ubuntu, can be: trusty(default), vivid, wily, xenial. If BuildArch is armel, UbuntuCodeName is jessie(default) or tizen."
     echo "lldbx.y - optional, LLDB version, can be: lldb3.6(default), lldb3.8"
 
     exit 1
@@ -73,6 +73,16 @@ for i in "$@"
             __UbuntuCodeName=jessie
             __UbuntuRepo="http://ftp.debian.org/debian/"
             ;;
+        tizen)
+            if [ "$__BuildArch" != "armel" ]; then
+                echo "Tizen is available only for armel."
+                usage;
+                exit 1;
+            fi
+            __UbuntuCodeName=
+            __UbuntuRepo=
+            __Tizen=tizen
+            ;;
         *)
             __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i"
             ;;
@@ -95,10 +105,18 @@ if [ -d "$__RootfsDir" ]; then
     rm -rf $__RootfsDir
 fi
 
-qemu-debootstrap --arch $__UbuntuArch $__UbuntuCodeName $__RootfsDir $__UbuntuRepo
-cp $__CrossDir/$__BuildArch/sources.list.$__UbuntuCodeName $__RootfsDir/etc/apt/sources.list
-chroot $__RootfsDir apt-get update
-chroot $__RootfsDir apt-get -f -y install
-chroot $__RootfsDir apt-get -y install $__UbuntuPackages
-chroot $__RootfsDir symlinks -cr /usr
-umount $__RootfsDir/*
+if [[ -n $__UbuntuCodeName ]]; then
+    qemu-debootstrap --arch $__UbuntuArch $__UbuntuCodeName $__RootfsDir $__UbuntuRepo
+    cp $__CrossDir/$__BuildArch/sources.list.$__UbuntuCodeName $__RootfsDir/etc/apt/sources.list
+    chroot $__RootfsDir apt-get update
+    chroot $__RootfsDir apt-get -f -y install
+    chroot $__RootfsDir apt-get -y install $__UbuntuPackages
+    chroot $__RootfsDir symlinks -cr /usr
+    umount $__RootfsDir/*
+elif [ "$__Tizen" == "tizen" ]; then
+    ROOTFS_DIR=$__RootfsDir $__CrossDir/$__BuildArch/tizen-build-rootfs.sh
+else
+    echo "Unsupported target platform."
+    usage;
+    exit 1
+fi