Sunday, May 7, 2017

Rust - the Programming Language on ARM (May 2017)

I have experimented with the programming language Rust on an ARM computer. For me, Rust would be the perfect language and Redox OS the perfect OS. ARM based processors are very interesting for the internet of things (IoT), but have also much potential for most desktop applications, not to speak of smartphones.

Environment: Odroid XU4  with Debian Jessie

I mostly experiment with Odroix XU4 with all files on a SSD; an inexpensive (< 150 Euro) but very comfortable and snappy environment. I start with Meveric's minimal Debian Jessie OS (https://forum.odroid.com/viewtopic.php?f=96&t=17542). Follow the instructions there to copy it to an SD card and install. After apt-get update and apt-get dist-upgrade copy all the files to a labeled partition of 4-15 GB on the SSD. (For example mount the SSD partition to /mnt and use
 rsync -aAXv --exclude="/dev/*" --exclude="/proc/*" --exclude="/sys/*" --exclude="/tmp/*" --exclude="/run/*" --exclude="/mnt/*" --exclude="/media/*" --exclude="/lost+found" --exclude="/stFolder/*" /* /mnt 
Then edit in /boot/boot.ini the setenv line to include  your partition label here brienz:
 setenv bootrootfs “console=tty1 console=ttySAC2,115200n8 root=LABEL=brienz rootwait ro fsck.repair=yes”
Reboot should start a snappy bare system, to which you add (following againg (https://forum.odroid.com/viewtopic.php?f=96&t=17542) a desktop with tasksel (for me XFCE4 works best) and add the recommended files.
This procedure gives  a nice and usable platform for experiments (and would be good enough for daily use). With gparted you can copy the partition and are ready to start each experiment with the same initial configuration (again, use labels to select the root, because all partitions have the same UUID).

Installing RUST - the language:

To prepare I added at the end of .bashrc
export RUSTUP_USE_HYPER=1
export PATH="$HOME/.cargo/bin:$PATH

and installed
sudo apt-get install curl linux-compiler-gcc-4.8-arm llvm clang-3.8
Then I followed the instrctions, which means using
    curl https://sh.rustup.rs -sSf | sh
Takes less than 5 minutes for download. To test:
rustc --version 
rustc 1.17.0 (56124baa9 2017-04-24) 

cargo --version
cargo 0.18.0 (fe7b0cdcf 2017-04-24)

Continue with the hello-world example from the Rust documentation.
My next plan is:
Installing Servo - the browser: