runtime icon indicating copy to clipboard operation
runtime copied to clipboard

[Release: Virtual ARM Device] Linux ARM Emulator to Build/Run .Net Core

Open leemgs opened this issue 10 years ago • 68 comments

Here is Linux/ARM Emulator as a virtual ARM device to help system developers that don't have any real embedded devices such as Raspberry Pi2 Board, Samsung ARM Chromebook, and Odroid (X)U3 Board. It means that you can easily build .net core source and run an executable ARM binary on the emulator.

Virtual ARM Device: Linux/ARM Emulator to build/run .Net Core

  • Note: We will continually update this webpage to share changed contents whenever you upload the latest version. (This webpage is last modified on Jul-15-2016 by Geunsik Lim.)

Requirements

  1. Host OS: Ubuntu 14.04 LTS X64 PC (Required RAM Size: 2GiB+)
  2. Target Architecture: ARMV7LE

Major Goal

  1. To enable Linux/ARM Continuous Integration (CI) based on QEMU/chroot
  2. To build & run dotnet core components (e.g, coreclr and corefx) like sandbox
  3. To provide the system developers (that don't have embedded boards) with Virtual ARM Device

Download

  • Download the latest version 20160610.4 of Linux/ARM Emulator:
  1. Default packages: https://dncorerepo.blob.core.windows.net/armemulator/linux-arm-emulator-20160610.4.tar.pbz2 https://dncorerepo.blob.core.windows.net/armemulator/linux-arm-emulator-20160610.4.tar.pbz2.md5
  2. Optional packages: https://dncorerepo.blob.core.windows.net/armemulator/rootfs-u1404.20160607.ext4.tar.pbz2 https://dncorerepo.blob.core.windows.net/armemulator/rootfs-u1404.20160607.ext4.tar.pbz2.md5
  • Archive for keeping the older versions (Thanks to Bruce Hoult) http://hoult.org/coreclr/

Getting Started: "Linux/ARM Emulator"

Step 1: Decompress the compress file with pbzip2 command for parallelism (And, the existing bzip2 command is also compatible to decompress the file.)

   u1404$leemgs> sudo apt-get install pbzip2 
   u1404$leemgs> sudo ln -s /usr/bin/pbzip2 /usr/bin/pbunzip2
   u1404$leemgs> sudo time tar --use-compress-prog=pbunzip2 -xvf ./linux-arm-emulator-2016****.tar.pbz2

Step 2: Run ./start.sh (Please, refer to ./doc/README.txt for more details)

Step 3: .Net Core world!!!

   arm@emul#>  cd /dotnet/runtime-hardfp-debug-mode-***
   arm@emul#> time ./corerun -c ./  /dotnet/example/hello.exe
   arm@emul#> time ./corerun -c ./  /dotnet/example/MS****/Hello.exe linux
   arm@emul#> time ./corerun -c ./  /dotnet/example/MS****/Hello.exe freebsd
   arm@emul#> time ./corerun -c ./  /dotnet/example/MS****/Hello.exe mac
   arm@emul#> time ./corerun -c ./  /dotnet/example/FloatTest.exe

Step 4: Screenshot: Execution time experiment between debug build and release build You can see more screenshots at https://github.com/dotnet/coreclr/issues/3784

linux-arm-emulator-20160426-1600 4

emulator-test-debug-and-release

emulator-ncurse-hello-debug-and-release

Build the latest CoreCLR/CoreFX firsthand on Ubuntu 14.04 X64

Compilation with Ubuntu/ARM rootFS for Ubuntu/ARM
  • CoreCLR (w/ cross-build on Ubuntu 14.04 X64): instruction - https://github.com/dotnet/coreclr/tree/master/Documentation/building sudo time ./cross/build-rootfs.sh arm cp -arf ./cross/rootfs/arm /work/dotnet/rootfs-coreclr/ time ROOTFS_DIR=/work/dotnet/rootfs-coreclr/arm ./build.sh arm debug verbose clean cross
  • CoreFX (w/ cross-build on Ubuntu 14.04 X64): instruction - https://github.com/dotnet/corefx/blob/master/Documentation/building/unix-instructions.md sudo time ./cross/build-rootfs.sh arm cp -arf ./cross/rootfs/arm /work/dotnet/rootfs-corefx/ time ROOTFS_DIR=/work/dotnet/rootfs-corefx/arm ./build.sh native arm debug clean cross time ./build.sh managed debug clean verbose
Compilation with Linux/ARM Emulator rootFS for Linux/ARM
  • CoreCLR (w/ native-build on Linux/ARM Emulator): cd ./linux-arm-emulator-2016**** ./start.sh - select Menu '3' source /dot/setenv/setenv_coreclr.sh cd /nfs/coreclr/ (Please, read ./doc/NFS.txt file for details) time ./build.sh arm-softfp cross clean verbose
  • CoreCLR (w/ cross-build on Ubuntu 14.04 X64):

sudo mount ./linux-arm-emulator/platform/rootfs-tm1.ext4 /work/dotnet/rootfs-coreclr/linux-arm-emulator cd ./coreclr/

> vi ./cross/arm-softfp/toolchain.cmake

diff --git a/cross/arm-softfp/toolchain.cmake b/cross/arm-softfp/toolchain.cmake
index 407ab53..ee5a4a3 100644
--- a/cross/arm-softfp/toolchain.cmake
+++ b/cross/arm-softfp/toolchain.cmake
@@ -6,6 +6,7 @@ set(CMAKE_SYSTEM_PROCESSOR armv7l)

 ## Specify the toolchain
 set(TOOLCHAIN "arm-linux-gnueabi")
+set(TOOLCHAIN_CUSTOM "armv7l-tizen-linux-gnueabi/4.9.2")
 set(TOOLCHAIN_PREFIX ${TOOLCHAIN}-)
 #set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
 #set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
@@ -20,8 +21,8 @@ add_compile_options(-mfpu=vfpv3)
 add_compile_options(--sysroot=${CROSS_ROOTFS})

 set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -target ${TOOLCHAIN}")
-set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -B${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN}")
-set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -L${CROSS_ROOTFS}/lib/${TOOLCHAIN}")
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -B${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN_CUSTOM}")
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -L${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN_CUSTOM}")
 set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} --sysroot=${CROSS_ROOTFS}")

> vi ./cross-build-corclr-emul.sh

------------- coreclr cross-build: start ----------------------------
#!/usr/bin/env bash
chroot="/work/dotnet/rootfs-coreclr/linux-arm-emulator"

ROOTFS_DIR=${chroot} CPLUS_INCLUDE_PATH="$chroot/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/include/c++/:$chroot/usr/lib/gcc/armv7l-tizen-linux-gnueabi/4.9.2/include/c++/armv7l-tizen-linux-gnueabi/:$chroot/usr/include/llvm/:$chroot/usr/include/llvm-c/:$chroot/usr/local/include" CXXFLAGS="-Wno-deprecated-declarations" ./build.sh arm-softfp cross debug clean verbose clang3.6

------------- coreclr cross-build: end ----------------------------
  • CoreFX (w/ native-build on Linux/ARM Emulator):

      **In Progress!!!**
    

Do unit test of coreCLR on Raspberry Pi2 board

work@pi2$ cd coreclr/tests/ work@pi2$ time ./runtest.sh \
--testRootDir=/home/pi/coreclr/bin/tests/Windows_NT.x64.Debug
--testNativeBinDir=/home/pi/coreclr/bin/obj/Linux.arm.Debug/tests
--coreClrBinDir=/home/pi/coreclr/bin/Product/Linux.arm.Debug
--mscorlibDir=/home/pi/coreclr/bin/Product/Linux.arm.Debug
--coreFxBinDir=/home/pi/corefx/bin/Linux.AnyCPU.Debug
--coreFxNativeBinDir=/home/pi/corefx/bin/Linux.arm.Debug

Todo

  1. Stabilize the file system consistency of guestOS
  2. Support SSHFS
  3. Completely separated a floating point (e.g., softfp and hard-fp) infrastructure

Changelog

  • Refer to the ./doc/CHANGELOG.txt file.

End.

leemgs avatar Mar 18 '16 06:03 leemgs

:+1:

manu-st avatar Mar 18 '16 07:03 manu-st

We have attached the latest version of Linux/ARM Emulator via Dropbox. If someone can support a free web storage with unlimited space compared to the Dropbox service in order to archive Linux/ARM Emulator version, we will continually upload new version of the Emulator there. Actually, We can not keep the old versions of Linux/ARM Emulator, because the free account of Dropbox is limited with ~2GiB.

leemgs avatar Mar 18 '16 13:03 leemgs

@richlander Any chance you could get this hosted?

benpye avatar Mar 19 '16 21:03 benpye

Awesome!

mmitche avatar Mar 21 '16 17:03 mmitche

@richlander , Can you support a hosting service for more effective communication of .net core Linux/ARM?

@benpye, Yesterday, I figured out that OneDrive (~15GiB) had supported the web storage space bigger than Dropbox (~2GiB). I am thinking to move to OnDrive insted of Dropbox as workaround at next release if we cannot find any volunteers that can support mass web storage.

\CC: @MyungJoo

leemgs avatar Mar 21 '16 21:03 leemgs

"pbzip2" is compatible with regular "bzip2" thus the following ordinary command

tar jxvf ./linux-arm-emulator-20160318-1530.tar.pbz2

can be used instead of

sudo time tar --use-compress-prog=pbunzip2 -xvf ./linux-arm-emulator-20160318-1530.tar.pbz2

mkborg avatar Mar 22 '16 09:03 mkborg

Instead, you will have slow decompression speed by using bzip2 w/o pbzip2.

leemgs avatar Mar 22 '16 09:03 leemgs

Decompression speed doesn't matter for me. Short and standard command line is preferable.

I would also prefer 'xz' compression since it has much better compression rate and reduces download time.

mkborg avatar Mar 22 '16 10:03 mkborg

\CC: @benpye , @jkotas , @myungjoo , @manu-silicon , @lemmaa , @prajwal-aithal

We have uploaded the updated version of the "Linux/ARM Emulator". From now on, we will upload the next version via OneDrive (~15GiB) instead of Dropbox (~2GiB).

  • Download "Linux/ARM Emulator ver. 20160323-1130" : https://onedrive.live.com/redir?resid=C93799B86B006829!160&authkey=!AHzZwWUReM20WTg&ithint=file%2cpbz2

linux-arm-emulator-ver-20160323-screen

leemgs avatar Mar 23 '16 02:03 leemgs

I could host files on my personal server at hoult.org if it's useful. I'm using this emulator at work @[email protected].

I'm moving literally right now from a core2duo with 150 GB to a Xeon E3-1231 v3 (pretty much an i7 4770 I think) with 1.4 TB. I wouldn't miss 50 or 100 GB or more.

brucehoult avatar Mar 23 '16 10:03 brucehoult

I've mirrored the above files to http://hoult.org/coreclr/

ba4d218 http://hoult.org/coreclr/linux-arm-emulator-20160318-1530.2.pub.tar.pbz2 eca9767 http://hoult.org/coreclr/linux-arm-emulator-20160323-1130.tar.bz2

brucehoult avatar Mar 23 '16 12:03 brucehoult

@brucehoult , Thank you for supporting the mirroring service to archive the old versions of the Linux/ARM Emulator (for evaluating .net core)

leemgs avatar Mar 23 '16 12:03 leemgs

:+1:

seanshpark avatar Mar 24 '16 02:03 seanshpark

We have released update version of "Linux/ARM Emulator" (ver. 20160404-1330) on Apr-04-2016.

  • Download: https://onedrive.live.com/redir?resid=C93799B86B006829!161&authkey=!ACih0q8TpEkahqM&ithint=file%2cpbz2

\CC: @manu-silicon , @benpye , @jkotas , @myungjoo, @prajwal-aithal , @lemmaa , @brucehoult

leemgs avatar Apr 04 '16 06:04 leemgs

Mirrored to http://hoult.org/coreclr/linux-arm-emulator-20160404-1330.tar.pbz2

brucehoult avatar Apr 04 '16 10:04 brucehoult

@leemgs do the changes in the new emulator include updating the included build of coreclr to track github?

brucehoult avatar Apr 04 '16 10:04 brucehoult

@brucehoult , the changes in the new emulator are included ./doc/CHANGELOG.txt file. And we will maintain the emulator with github.com (e.g., https://github.com/leemgs/linux-arm-emulator) in the near future after finishing some procedures.

leemgs avatar Apr 04 '16 11:04 leemgs

\CC: @hongsekim , @wateret

leemgs avatar Apr 06 '16 23:04 leemgs

Awesome work! I saw you already found hosting already. Keep going! If you need any infrastructure service that I can help like storage or CI please let me know. I can put it on our Azure account, no problem at all.

galvesribeiro avatar Apr 15 '16 17:04 galvesribeiro

@galvesribeiro , 👍 Thank you so much. Could you provide the your storage as another mirror service to archive old versions?

leemgs avatar Apr 15 '16 22:04 leemgs