harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Hindess <mark.hind...@googlemail.com>
Subject Re: [porting] FreeBSD (rambling)
Date Fri, 26 Jan 2007 20:13:09 GMT

On 24 January 2007 at 19:45, "Geir Magnusson Jr." <geir@pobox.com> wrote:
> On Jan 24, 2007, at 5:07 PM, Mark Hindess wrote:
> >
> > I've checked in the changes (and some horrible hacks) that I needed
> > to get Classlib to compile on FreeBSD/x86.  The next things on this
> > particular todo list are:
> >
> > 1) Document what I had to install on top of the default 6.1- 
> > RELEASE.  (I
> > used this version because it ran under qemu but I'll probably try the
> > new 6.2-RELEASE when I write up my notes.)  I need to check my  
> > notes but
> > I think everything came from the ports collection and I didn't have to
> > build anything manually.
> >
> > 2) Document and/or fix the various hacks.  For instance, I tweaked the
> > Linux reserved memory functions in hyvmem.c to compile on FreeBSD but
> > they certainly wont work.
> >
> > 3) Try FreeBSD/x86_64.
> >
> > The current status is that it compiles and the current portlib tests
> > run.
> Excellent.
> >
> > There is one slightly odd failure.  The hyerror last error message is
> > not null at startup.  I suspect it is the nls catalog that is not  
> > found
> > because there is no way to find the executable name.  (The portlib
> > executable name function only works if either:
> >
> > a) we are on linux (and /proc is mounted)
> >
> > b) we pass in argv[0]
> >
> > but clearly a) isn't true and at the point of the call argv[0] isn't
> > available.  I'm not sure how to fix this.  (If we insist that /proc
> > is mounted on FreeBSD we might resolve it here but /proc is a little
> > different on FreeBSD *and* it is not mounted by default.  Besides this
> > isn't really a generic solution.)
> >
> > Anyway, I'm wondering if anyone is interested in trying to look at
> > porting drlvm?  Currently, drlvm seems to assume anything not windows
> > is linux (which is not too different to how classlib used to be).   
> > With
> > classlib I knew enough to get started but I'm not really sure how  
> > it is
> > intended to extend this to other platforms with drlvm.
> >
> > Sorry for the rambling but I didn't really get enough sleep last  
> > night.
> I'm interested, but will have to do this in a VM, as I'm out of  
> machines to install FreeBSD on.  Can you give me some hints?

Ok.  I've appended some instructions for installing FreeBSD 6.2-RELEASE
to a qemu image for use in harmony development.  They should be fairly
easy to adapt for someone looking to work under Parallels or some other
virtualization system.

Does anyone know somewhere that I might be able to host the 306M
compressed qemu image file?  It would save people trying to reproduce
this quite a lot of time since with it you could skip most of the


# I use the -redir qemu option which allows ssh to port 1222 on the host
# to reach the guest.  I firewall this port so only localhost can reach it
# if you don't do this, then you should probably remove this option.
# When using -redir and ssh, I add a clause like:
#   Host freebsd
#     HostName localhost
#     User harmony
#     Port 1222
# to ~/.ssh/config so that I can ssh to the qemu image with "ssh freebsd".

# If you use the pre-built qemu image then you might want to start by
# making it sparse so that the largely-empty disk image takes up fewer
# real blocks on your disk:

  bunzip2 freebsd-6.2.img.bz2
  du --si freebsd-6.2.img
  cp -p --sparse=always freebsd-6.2.img freebsd-6.2.img.tmp
  mv freebsd-6.2.img.tmp freebsd-6.2.img
  du --si freebsd-6.2.img

# On my machine, the disk usage drops from 6.5G to just 1.6G.
# Aside: is there a command that would do the above with:
# bunzip2 <freebsd-6.2.img.bz2 | command-here freebsd-6.2.img
# ??

# start the qemu image with:

  qemu -hda freebsd-6.2.img -net nic -net user \
       -redir tcp:1222: -m 1536m

# and jump straight to where it says:

# These are the instructions for starting from scratch

# create an empty (sparse) disk image
perl -le '$file = shift||"freebsd-6.2.img"; $size=shift||6144; open(F,">$file")|| die "open
of $file failed: $!\n";seek(F,$size*1024*1024,0); print F chr(0); close(F);'

# make sure tmpfs has access to enough memory
sudo mount -o remount,size=1552m /dev/shm

# fetch the install cd
wget ftp://ftp2.uk.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/6.2/6.2-RELEASE-i386-bootonly.iso

# make sure kqemu is loaded (optional but highly recommended)
sudo modprobe kqemu

# start qemu for the install
qemu -hda freebsd-6.2.img -net nic -net user \
  -boot d -cdrom 6.2-RELEASE-i386-bootonly.iso

# Install instructions:
# Let it boot
# Choose your country
# Choose your keymap
# Begin a standard installation
#   Disk layout
#   A
#   Q
# Install the FreeBSD Boot Manager
#   Disklabel Editor
#   C 256M FS /
#   C 512M SWAP
#   C 128M FS /var
#   C 128M FS /tmp
#   C 1536M FS /usr
#   C <return-to-accept-what-is-left> FS /home
#   Q
# Choose "4 Developer" install 
# Say yes to ports collection
# Install from an FTP server through a firewall (or whatever is appropriate)
# Pick one that is "close" to you
# Choose device ed0 - the qemu emulated device
# No to IPv6
# Yes to DHCP
# fill in hostname and domain
# Obtain coffee and relax for a while...
# ... chunk 19 of 33 ... yawn ...
# ... 22413312 bytes read from ports dist ...
# ...
# Choose yes to configure ethernet device
# Choose device ed0 and confirm the previous configuration
# Say No to gateway
# Say No to inetd
# Say Yes to ssh login
# Say No to anonymous FTP
# Say No to NFS server
# Say No to NFS client
# Say No to system console customization
# Say Yes to time zone configuration and set it up
# Say Yes to linux binary compatibility
# Say No to browsing ports collection
# Say Yes to initial account creation
#   Add a new group to the system
#   Group name harmony, gid 1001, no group members
#   Add a new user to the system
#     Login ID: harmony, UID: 1001, GID: 1001, Password: h4rm0ny
#     Full Name: Apache Harmony, Member groups: wheel
#     Home directory and shell left as defaults
#  Exit user and group management menu
#  Set root password - I set it to H4rm0ny
# Say No to visit the configuration menu
# Exit install
# Yes we are sure

# What for the reboot then CTRL-C the qemu process
# Restart qemu with different options ...
qemu -hda freebsd-6.2.img -net nic -net user \
     -redir tcp:1222: -m 1536m

# Login (or ssh) as harmony/h4rmony
su -
# password H4rm0ny
cd /tmp
# install some required tools
pkg_add -r apache-ant subversion gmake javavmwrapper
# install some required libraries
pkg_add -r libiconv freetype2 jpeg lcms png libXft
# install some optional handy tools
pkg_add -r bash ccache diffstat w3m rsync wget

# change harmony user shell to bash
chsh -s /usr/local/bin/bash harmony

# exit from su root session

# start bash
exec bash

# enable ccache for future sessions and set ANT_OPTS
cat <<EOF >>.bash_profile
export PATH

export ANT_OPTS
# and enable it now
. .bash_profile

svn co https://svn.apache.org/repos/asf/harmony/enhanced/trunk harmony
# accept certificate

# This is the point at which I shutdown FreeBSD, stopped qemu and created
# a "cp -p --sparse=always" copy of the images to freebsd-6.2.harmony.img

# Login (or ssh) as harmony/h4rmony
su -
# password H4rm0ny

# Acquire diablo-jre-freebsd6.i386. or
#         diablo-jdk-freebsd6.i386. from
#   http://www.freebsdfoundation.org/downloads/java.shtml
# Either scp from another machine or try:
#   w3m http://www.freebsdfoundation.org/downloads/java.shtml
# I used the jre as it is sufficient for classlib and it is much smaller
pkg_add diablo-jre-freebsd6.i386.

# I got a warning about versions of javavmwrapper but it seemed to work
# anyway

# exit from su root session

cd harmony
ant populate_source
# time for another coffee
cd working_classlib
ant fetch-depends
su -
# then as root
install -o root -g wheel -m 0644 \
  /home/harmony/harmony/working_classlib/depends/jars/ecj_3.2/ecj_3.2.jar \

# exit root shell

# you might want to have a cup of tea this time, just for a change
ant -Dbuild.module=portlib test
# expect a failure in the hyerror test

View raw message