[aarch64-port-dev ] aarch64-port-dev Digest, Vol 4, Issue 1
Andrea Gallo
andrea.gallo at linaro.org
Mon Jun 17 12:56:43 PDT 2013
Sorry for sending a blank email, just wanted to congratulate with Ed,
encouraging and exciting days ahead :-)
On 17/giu/2013, at 21:01, "aarch64-port-dev-request at openjdk.java.net" <
aarch64-port-dev-request at openjdk.java.net> wrote:
Send aarch64-port-dev mailing list submissions to
aarch64-port-dev at openjdk.java.net
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.openjdk.java.net/mailman/listinfo/aarch64-port-dev
or, via email, send a message with subject or body 'help' to
aarch64-port-dev-request at openjdk.java.net
You can reach the person managing the list at
aarch64-port-dev-owner at openjdk.java.net
When replying, please edit your Subject line so it is more specific
than "Re: Contents of aarch64-port-dev digest..."
Today's Topics:
1. OpenJDK8/Zero cross compile build for Foundation model
(Edward Nevill)
----------------------------------------------------------------------
Message: 1
Date: Mon, 17 Jun 2013 13:50:24 +0100
From: Edward Nevill <ed at camswl.com>
Subject: [aarch64-port-dev ] OpenJDK8/Zero cross compile build for
Foundation model
To: aarch64-port-dev at openjdk.java.net
Message-ID: <51BF0610.9020000 at camswl.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi all,
I have got a cross compile build of OpenJDK8/Zero working for the ARM
foundation model (ARM's aarch64 simulator).
I have made binaries of the images available should people wish to try
this out directly, and I have also included details on how to build from
the source below.
Firstly the build in OpenJDK8 has been changed completely. The top level
jdk8 directory now contains a ./configure. This has a
--with-jvm-variants= argument. From jdk8-b85 onwards it is possible to
build zero out of the box by simply doing
./configure --with-jvm-variants=zero
make
The support for cross compiling also seems to have been vastly improved.
The following options are available to ./configure.
--with-sys-root= <location of your cross compile sysroot>
--openjdk-target= <cross compile 'target'>
Armed with these options, a properly configured sysroot and a few
patches as given below it was possible to get OpenJDK cross compiling
for aarc64 with relatively little difficulty.
Well done to those who worked on the new build system in OpenJDK8 - it
is a vast improvement.
Setting up and running the binaries
-----------------------------------------------
First of all I will described how you can download the Foundation model
(ARM's aarch64 simulator) and get a Java binary up and running.
Note: In all of the below I am running Fedora 18 x86 64 bit. Your
mileage on other OS/Distro may vary.
First of all you will need to download the foundation model from ARM's
website at
http://www.arm.com/products/tools/models/fast-models/foundation-model.php
At the bottom of the page under "Get started with Foundation Models"
click on "download now". You will be asked to login. If you have
prevously registered for an ARM account login, otherwise you will need
to check the license terms, ensure that you are happy with them and
register for an ARM account.
After logging in above, on the right hand side of the next page under
"ARM V8 Foundation Model" click "Download Now".
The name of the file I downloaded was "FM000-KT-00035-r0p8-48rel5.tgz".
Obviously the name of the file you download may differ depending on the
version number you download, but if you want to download exactly the
same version number you can look for it under "Display older versions".
Untar this archive. It will create a directory 'Foundation_v8pkg'. cd to
this directory
tar xfz FM000-KT-00035-r0p8-48rel5.tgz
cd Foundation_v8pkg
Next you will need to download a boot image and an SD disk image.
To download the boot image do
wget
http://releases.linaro.org/13.05/openembedded/aarch64/img-foundation.axf
The SD disk image may be downloaded from
http://people.linaro.org/~edward.nevill/sd.img.gz
Decompress it using
gzip -d sd.img.gz
To boot the image in the foundation model do
./models/Linux64_GCC-4.1/Foundation_v8 --image img-foundation.axf
--block-device sd.img --network=nat
Now, an xterm window will open and Linux will boot in the aarch64
simulator. After a short while you will get the root '#' prompt. The
root home directory has been pre populated with the following
# ls
Queens.class
Queens.java
ecm
j2re-image
j2sdk-image
Some things you can try. In each case be prepared to wait, it hasn't
crashed, it is running under a simulator.
./jsdk-image/bin/javac Queens.java
./j2re-image/bin/java Queens
cd ecm
../j2re-image/bin/java CaffeineMarkEmbeddedApp
If you want to download more Java programs to you image follow the
instructions at the end of the next section for mounting the sd.img on
your host.
Please be careful to shut down the simulator properly before mounting
the file system on your host machine. Otherwise you *will* corrupt the
filesystem!
To shutdown the simulator do
shutdown -h now
Then, when the simulator says "system halted" use CTRL-C to stop it.
Building the OpenJDK8/zero image
----------------------------------------------
For convenience I have provided a complete build tree and a populated
sysroot below. Details of how to fetch and patch the OpenJDK8 source,
and how to build your own sysroot are given later, but to get started
you may find it more convenient just to download the images below.
The OpenJDK8 source tree:-
http://people.linaro.org/~edward.nevill/aa64_openjdk_130606.tar.gz
The sysroot
http://people.linaro.org/~edward.nevill/sysroot.tar.gz
Untar the 1st achive aa64_openjdk_130606.tar.gz. This will create a
directory aa64_openjdk.
cd to that directory and untar the 2nd archive, sysroot.tar.gz.
tar xfz ~/Downloads/aa64_openjdk_130606.tar.gz
cd aa64_openjdk
tar xfz ~/Downloads/sysroot.tar.gz
Then just execute the 'do_configure' and 'do_compile' scripts contained
in the aa64_openjdk directory and all being well, some time later, you
should have a j2sdk and a j2re image.
./do_configure
./do_compile 2>&1 | tee log
To transfer the compiled j2sdk and 2re images to the SD card image do
the following.
Be very careful to shut down the simulator before attempting the
following. If you attempt to mount the sd.img file as described below,
while you are running a simulator which also has it mounted you *will*
corrupt the filesystem.
sudo mount -o loop,offset=54525952 sd.img /mnt
sudo cp -r
<...>/aa64_openjdk/jdk8/build/linux-aarch64-normal-zero-release/j2sdk-image
/mnt/home/root
sudo cp -r
<...>/aa64_openjdk/jdk8/build/linux-aarch64-normal-zero-release/j2re-image
/mnt/home/root
sudo umount /mnt
You may then reboot the simulator with the upated image as described above.
Rebuilding from scratch
--------------------------------
To rebuild from scratch you will first of all need to build and populate
a sysroot.
The easiest way to do this is to use Open Embedded.
mkdir fromscratch
cd fromscratch
git clone git://git.linaro.org/openembedded/jenkins-setup.git
cd jenkins-setup
bash init-and-build.sh
cd openembedded-core
source oe-init-build-env ../build
bitbake -k openjdk-7-jre
Note: The reason for doing openjdk-7-jre is that we want to ensure that
all the packages required to build openjdk are included in the sysroot.
We are not actually going to use openjdk-7-jre in the build.
The above command will take several hours.
Now cd to the 'fromscratch' directory created above.
cd ~/fromscratch
Create a symbolic link to the sysroots created in the Open Embedded
build above
ln -s jenkins-setup/build/tmp-eglibc/sysroots sysroots
Download the OpenJDK source from openjdk.java.net
hg clone http://hg.openjdk.java.net/jdk8/jdk8
cd jdk8
sh ./get_source.sh
Update everything to jdk8-b92
sh ./common/bin/hgforest.sh up -r jdk8-b92
Download and untar the patches
http://people.linaro.org/~edward.nevill/patches.tar
cd ~/fromscratch
tar xf patches.tar
cd jdk8
patch -p 1 < ../patches/jdk8_patches
cd jdk
patch -p 1 < ../../patches/jdk_patches
cd ../hotspot
patch -p 1 < ../../patches/hotspot_patches
Download the 'do_configure' and 'do_compile' scripts. First make sure
you cd to the ~/fromscratch directory above.
cd ~/fromscratch
http://people.linaro.org/~edward.nevill/do_configure
http://people.linaro.org/~edward.nevill/do_compile
Then execute do_configure and do_compile
bash do_configure
bash do_compile 2>&1 | tee log
All being well, within a few minutes you should have a j2sdk and j2re image!
If you run into difficulties with any of this please drop me an email.
All the best,
Edward Nevill
End of aarch64-port-dev Digest, Vol 4, Issue 1
**********************************************
More information about the aarch64-port-dev
mailing list