Linux Development

Building kernels for Lemote Yeeloong

Well… it’ll be a while before I get around to porting Gentoo to the Yeeloong in earnest, however this is the first step.  The following are some notes for those who may wish to go ahead and set up Gentoo.

Toolchain

For both the Yeeloong, and the Loongson 2F-based Fulong, you’ll need the latest gcc (4.4.0) and binutils.  I normally don’t recommend H. J. Lu’s binutils distribution, but in this instance, you need something pretty bleeding edge, this gets you bleeding edge without needing live ebuilds.

I keep patched ebuilds of binutils and kgcc64 in my overlay.  To obtain these, install git, then run git clone git://git.longlandclan.yi.org/overlay.git and add it to your overlays.  The overlay is also browsable here.

Once added, simply merge sys-devel/binutils-2.19.51.0.5 and sys-devel/kgcc64-4.4.0_alpha20090407. These work for me anyway.

Patched Kernel

Zhang Le has done an excellent job in merging the Lemote patches into the Linux/MIPS tree… clone a copy by typing git clone git://www.gentoo-cn.org/var/git/linux-loongson.git. Use make yeeloong_defconfig to make a suitable config, then compile as per the Gentoo/MIPS handbook, using the vmlinux.32 target.

Power Management

There’s one final piece missing… and that’s the ec_module power management drivers. You get those from here. If you’re compiling against a kernel later than 2.6.29, double check that the version you fetch has the patch to correct for the new struct proc_dir_entry, sans owner field. You can get this patch from here if need be… or alternatively,

git clone git://dev.lemote.com/ec_module.git
git pull git://git.longlandclan.yi.org/ec_module.git

This will pull in the aforementioned patch if it isn’t already there.

To build the module, simply change to your kernel source directory, then run make modules modules_install CROSS_COMPILE=mips64el-unknown-linux-gnu- M=/path/to/ec_module.

Once I’m through exams, I’ll probably start looking into merging this into a patchset to place in mips-sources… but for now, there’s a starting point for those who are wondering where to begin.

Gentoo/MIPS Stages

Hi All,

Well, I’ve just dusted off the second Lemote Fulong here, and I’m booting it up for another round of stagebuilds. (Yes… I haven’t gotten around to locating and implementing the auto stagebuild scripts that everyone else seems to be using.)

I’m also getting a newer piece of MIPS kit… a Lemote Yeeloong is currently sitting at Brisbane Airport in a box with my name on it… hopefully it’ll be in my hands by Wednesday evening. This will enable support of Gentoo/MIPS on this platform, and will also allow me to do some MIPS testing of packages while on my many hours of travelling between Brisbane and Laidley and hours spent at university. It’s based on the Loongson 2F CPU, which implements the MIPS64 ISA (the Loongson 2Es in the Fulongs implements MIPS3), and is little-endian.

Hopefully this will mean the bug count will start to decline once more for the MIPS team. 🙂

Gentoo/MIPS uClibc Stages

Hi all…

Well, after a long hiatus, I’m working on new stages for the Gentoo/MIPS port.  These new ones will be based on uClibc, and are a compliment to the existing glibc-based stages.  At the moment, the initial seed environment is still being cross-compiled from my i686 host, and for now I’m focussing on mipsel but will soon turn my attention to MIPS.

These stages initially will not operate with a page size of 16KB or more, so unfortunately aren’t much good for Lemote users (I’m working with the uClibc people on this) but Cobalt and SGI users will soon once again be able to use uClibc as their system libc.  The new stages will be based on uClibc 0.9.30… which is yet to be keyworded.

Gentoo/MIPS Update

Hi all… figured I better update everyone on what’s happening on the MIPS front.

Kumba has been working on newer kernel ebuilds to support various platforms, specifically IP30, which has been troublesome of late. At present, the best kernel revision to use is still 2.6.23 on Cobalt, Loongson 2E and O2.

Another alternative, is to download your own kernels from the Linux/MIPS website (not kernel.org), and research the patches needed to get things running yourself… in fact… Lemote Loongson 2E, Cobalt Qube2 and SGI Indy/O2 users should find minimal to no patching is necessary as the vast majority of changes have already been accepted into the mainline kernel.

Stages… there have been no further stages built at the moment from the 2008.0 ones. Partly because some of us have been just too busy. I’ve started to make inroads into a uClibc-based set of stages however, having got a uClibc-0.9.30 toolchain built the other day targetted at mipsel-unknown-linux-uclibc. It is hoped a workable environment can be constructed in the coming months that may turn into a new set of stages available for this platform.

Desktop Applications… have been lagging quite a bit. I have some patches for Thunderbird 2.0 that gets things rolling again… and may just work for big-endian MIPS (which was broken at last check) but due to lack of time, I haven’t been able to investigate further. A similar set of patches got Firefox 3.0 partially working… more work needs to be done.

My own status… I’m not planning on leaving anytime soon… just been extremely busy. As it is now, I’m passed my 8:00PM bed time (need to be up at 4:00AM tomorrow, currently it is 8:35PM AEST), so I’ll leave it at that.

Both Lemote Fulong systems upgraded to 1GB

Hi All,

My P4 laptop died recently, which is a pain as I now have to look at replacing it in the near future… however, this has meant I now have 2GB of DDR400 SODIMMS that can be used in the Lemote systems.

There was a catch however.  The PROM had to be flashed on one of the units so it would initialise the RAM properly, otherwise the kernel would b0rk.  With this done, both units now recognise the 1GB sticks of RAM installed.

At present, both systems are available for developer use.

How to upgrade the PROM on the Fulong.

For the reference of others who may wish to perform this upgrade on their Lemote equipment.  This is the procedure.

  1. Download pmon_v1.1.zip from this page and unpack it.
  2. Copy the pmon.bin file located inside, to your /boot partition (or somewhere else accessible to the PROM)
  3. Reboot, and hit ESC/DEL repeatedly to break into the PMON prompt.
  4. Type set, and write down any critical settings such as al and karg
  5. At the PMON prompt, enter the following command (adjust:path as appropriate)
    load -r -f bfc00000 /dev/fs/ext2@wd0/pmon.bin
  6. Restore the settings you wrote down using set arg value.
  7. Type reboot to reset the system.

If at step 5, the load fails, DO NOT REBOOT OR POWER OFF! Hit the up-arrow on your keyboard, double check the command, then press ENTER to execute it again.

I’d like to thank the members of the Lemote Forum community who provided the necessary infromation.

Firefox 3.0.1 on MIPS

Hi all…

Firefox 3.0.1 showing the Acid2 test on MIPS (click to enlarge)

Firefox 3.0.1 showing the Acid2 test on MIPS (click to enlarge)

I’ve been rather busy and thus haven’t had much time for Gentoo work, but today I managed to get some patches together that allow Firefox 3.0.1 to build and run on MIPS.

The ebuild is as yet, unkeyworded, as I wish to do some further testing.  I have successfully compiled it on little-endian MIPS, and it mostly seems to work okay.  It mostly passes the Acid2 test with some slight errors, but unfortunately, crashes part way through the Acid3 test — this I’ll investigate when I have the time.  It also crashes on my blog so your mileage may vary.

No testing has been done on big-endian MIPS at this stage, as my O2 is down for the short term (need to build a new kernel and get X running) so I’d appreciate feedback from users on this matter.

Gentoo 2008.0 final stages uploaded

I’m pleased to annouce the final 2008.0 stages have been published.  I haven’t yet gotten around to giving them a run, I’ll set up a couple of chroots and do some test builds shortly, but in the meantime, I have put them up on my devspace for public review.

As previously announced, this release sees the addition of generic MIPS-1 stages for both big and little endian, as well as new stages for little-endian MIPS-3.  We still only support the hardware listed in the handbook however — the generic stages are provided merely as a convenience to those who may wish to experiment with other hardware, and know what they’re doing.

Approximately 1.2GB got uploaded over the 30 or so hours… this is apparent from my NTP server’s performance this weekend:

… Yeah… I think I’ll wait until I’m back at uni before I upload any more big files. 😉

Anyway… as I say, the new stages are up, and I’d be greatful if some brave users could take them for a spin and report back.  In the meantime, I’ve got some chroots to set up and testing to do.

mod_auth_mysql

Hi all…

This is more a note to myself… but may also be useful with others who may be wondering WTF is wrong with their mod_auth_mysql setup.

To configure it, do it as per the instructions mentioned in the CONFIGURE file, or even following the /etc/apache2/modules.d/12_mod_auth_mysql.conf that the ebuild installs… HOWEVER… you will need to change the length of the password field in the MySQL code snippets to suit your encryption method.

I decided to use SHA1 hashes, which are 40 characters long (encoded as hex).  Thus, you use a column type of CHAR(40), and set your authentication configuration to use AuthMySQLPwEncryption sha1. To use the “scrambled” encryption scheme (uses MySQL’s PASSWORD() function), this column needs to be 41 characters long, not the 20 advertised in the examples.

Once you do this, everything should be fine… and things will work as expected.

Installing Gentoo/MIPS without a netboot image

Hi all…

In the absence of recent netboot images, you might find these notes useful.  These describe how to install Gentoo without the use of a netboot image, but rather, making your own, and using root-over-NFS.  This same guide can also be used to port Gentoo to other presently unsupported MIPS hardware.

What you need…

You’ll need about 200MB or so (the more the better) on the netboot server to house a root filesystem.  In addition to the tools mentioned in the handbook, you’ll also want nfs-utils installed to export the client’s root FS.

You’ll also want a cross-compiler.  You only need to be able to build a kernel — libc is not necessary.  To generate such a compiler, install the sys-devel/crossdev package, and run crossdev -t mips64-unknown-linux-gnu -S1 (or  mips64el for Cobalt/little endian targets).  If the build fails, try various versions of binutils and gcc, it may be a little tinkering to get a combo that works.

IP28 users will want to enable the ip28 USE-flag on in /etc/portage/package.keywords for the cross-mips64-unknown-linux-gnu/gcc package.

Unpacking and setting up the root fs…

Download the stage 3 tarball, and unpack that into a directory on your server.  Then, export it by editing /etc/exports, and adding a line like the following:

/unpacked/stage3/path    *(ro,sync)

Remember to reload your NFS server config by typing /etc/init.d/nfs reload.

Building the kernel…

Start by unpacking the kernel with appropriate USE flags set (USE=ip28 for IP28 users, USE=ip30 for Octane users, USE=cobalt for Cobalt users).  This is done with the following command (adjust if your PORTDIR is in a different place):

# USE=ip28 \
  ebuild /usr/portage/sys-kernel/mips-sources/mips-sources-VERSION.ebuild \
    unpack

If all goes well, you’ll have a copy of the patched kernel tree in /var/tmp/sys-kernel/mips-sources-VERSION/work/linux-VERSION.  Change to that directory, and configure the kernel as per the guide in the Gentoo/MIPS handbook, passing ARCH=mips CROSS_COMPILE=mips64-unknown-linux-gnu- (or mips64el…) to all make calls.  If you want to use the .config that comes with one of the old netboot images, you can use scripts/extract-ikconfig to extract it.

Remember to say Y to your network card driver, and these options:

  • Root-over-NFS support
  • NFS Client support
  • IP Level Autoconfiguration (DHCP)

Once you’ve compiled your kernel and have your vmlinux (or vmlinux.32) file, copy this file to your server’s /nfsroot (Cobalt hardware) or /tftproot (almost anything else) directory in place of the usual Gentoo netboot image.  For kernel modules, install them by typing make CROSS_COMPILE=”…” INSTALL_MOD_PATH=/unpacked/stage3/path modules_install.

You may also find it helpful to place a copy of the stage 3 tarball and kernel inside the NFS root area for convenient access on the final host.

Booting the system…

SGI Boxes:

Break into the command monitor prompt as per the handbook, and at the prompt, type the following (all on one line):

>> bootp(): root=/dev/nfs ip=dhcp 
            init=/bin/bash
            nfsroot=ip.of.root.server:/unpacked/stage3/path

Cobalt boxes:

This assumes you have one of my netboot images already unpacked in /nfsroot and that you’ve placed your freshly compiled kernel in /nfsroot as well.

Compress the kernel image using gzip -9, and rename it to kernel.gz (overwriting the existing file).  Then edit the default.colo file … the execute line should read (place this on one line):

execute root=/dev/nfs ip=dhcp init=/bin/bash
        nfsroot=ip.of.root.server:/unpacked/stage3/path

Netboot the Cobalt system in the usual way.

Lemote hardware:

Hit ESC a few times to break into the PMON2000 prompt… then type the following (each on one line):

PMON> ifaddr rtl0 lemote_box_ip_addr # (e.g. 10.0.0.8)
PMON> load tftp://tftp_server_ip_addr/kernel_name
PMON> g console=tty0 root=/dev/nfs ip=dhcp
      nfsroot=ip.of.root.server:/unpacked/stage3/path

In all cases, you should be at a prompt.  Proceed with the Gentoo/MIPS handbook instructions as per normal at this point. 🙂

Gentoo/MIPS 2008.0: Stages Uploaded

Hi all…

I’ve now uploaded the stages for Gentoo/MIPS 2008.0.  I’m hoping to get these pushed out to mirrors shortly, but in the meantime, you can find them on my devspace.  These stages need a fairly modern kernel, 2.6.19 or later, ideally  2.6.2x-series, otherwise you’ll strike issues with rm doing strange things (as people have reported already).  I have some kernel images for IP30, IP32, Loongson and Cobalt that should work with these stages.

These are only freshly compiled, and haven’t undergone much testing, so I’d appreciate it if some brave souls could give them a try and report back.  Stages are available for:

Enjoy. 🙂