cs-education / sysbuild

A system programming learning environment in the browser
https://cs-education.github.io/sys/
Other
36 stars 35 forks source link

Cross Compile ltrace and include it in the disk image. #2

Open angrave opened 10 years ago

angrave commented 10 years ago

Some possible ways compile ltrace in jor1k:

  1. Use jor1k

  2. Use the old premade virtual box image (need to bunzip2 after downloading). Also these translated notes might be relevant - http://www.programmershare.com/3163928/ (search for or32-linux-gcc)

  3. http://opencores.org/or1k/Ubuntu_VirtualBox-image_updates_and_information (download; bunzip2; fire up in virtualbox. For happiness also install vbox extensions)

  4. Try to follow these inaccurate instructions - http://openrisc.net/toolchain-build.html

5 & 6. Try these two ways suggested by Sebastian - (below is some email notes from concat'd together)

Got an uptodate linux machine? Try - https://github.com/s-macke/jor1k/wiki/How-to-develop-for-jor1k

It provides you with a chroot environment and a virtual machine (qemu-user). This is by far the easiest way to develop for jor1k. No nasty cross compiling problems.

I haven't tested it yet because of lack of time today. Give it a try. You should use Debian in a virtual machine or any other distribution.

The binfmt description however works only for Debian. But there similar solutions for each distribution.


https://github.com/bluecmd/or1k-debian

I will also write the binfmt support in a way that it works in every distribution.

My binfmt kernel file looks like

> cat /proc/sys/fs/binfmt_misc/qemu-or1k

enabled interpreter /usr/bin/qemu-or1k-static flags: OC offset 0 magic 7f454c460102010000000000000000000002005c mask fffffffffffffffffffffffffffffffffffeffff

With the new manual it works for me.


The manual is now written, that it should run in every distribution with and x86-64 architecture and a rather new kernel. This qemu executable runs on my virtual machine with CentOS and kernel 2.6.32.

Unfortunately, cross compiling is a mess. This has been a problem since the last 20 years and will probably never be solved. To compile everything for the provided jor1k images took me more than 2 months.

qemu-user and bin-fmt is a nice tool to circumvent a lot of problems. Unfortunately, you need a specialized version of it because not all patches necessary are in the official qemu distribution.


cd sysroot mkdir root cd root mkdir ltrace cd ltrace git clone git://git.debian.org/git/collab-maint/ltrace.git ./autogen.sh cd .. cd .. cd .. chroot qemu .... # the command from the online manual cd /root/ltrace ./configure --build=or32-unknown-linux --prefix=/usr make

unfortunately it expects the libelf libraries which I haven's installed yet. "

neelabhg commented 10 years ago

There is also a wiki page in the upstream jor1k project: https://github.com/s-macke/jor1k/wiki/How-to-develop-for-jor1k

ProofOfKeags commented 9 years ago

Do not work on this issue until #51 is closed