Work In Progress

This is work in progress. This page is subject to change. This is based on my experience. The status of Debian on the Yeeloong is rapidly changing so this page might be out of date.

Wheezy

Wheezy adds full support for Yeeloong systems in its installer. Download all the files from a daily build directory:

NOTE: The 'daily' directory in http://d-i.debian.org/daily-images/mipsel/daily/loongson-2f/netboot/ is symlinked to the latest build directory which have the form 'YYYYMMDD-HH:MM'. If you want to keep a record of which version of the installer you used you might want to 'wget' the version in the form http://d-i.debian.org/daily-images/mipsel/YYYYMMDD-HH:MM/loongson-2f/netboot/ which you can find by browsing http://d-i.debian.org/daily-images/mipsel/ .

Prepare the USB stick and put these files on it as described in the Squeeze section below.

  1. Format the USB disk with ext2 and add the required d-i files
  2. Start with Yeeloong powered off and no USB sticks installed.
  3. Put USB stick in left USB port next to VGA port.
  4. Power on Yeeloong.
  5. Press 'Del' lots.

  6. Should get into PMON> prompt.

  7. Delete any extra characters.
  8. Type:
    • bl -d ide (usb0,0)/boot.cfg
    • Depending on your PMON version, this may take several minutes. Be patient. Eventually, the installer will load.

Answer questions as normal.

Partition but make sure /boot is ext2/3. The partitioner will warn you if it is not. If you are installing Debian to the entire disk and erasing any previous contents, then guided partitioning will produce something reasonable.

In tasksel, select 'Debian desktop environment'. This will install the packages for GNOME, it will take a long time. We need to do further work on reboot to get X working.

The installer will set up GRUB as the boot loader. We don't use grub-pc, but rather grub-yeeloong; however, it is essentially the same boot loader familiar to x86 users. You should not need to do anything special to configure the boot loader.

You will eventually get to the place where the installer reboots the system. You will get the PMON boot menu which should automatically boot the kernel. This will black out the screen for a short while, but the HD light will be on. Eventually it will boot up. You'll notice X isn't running! See Wheezy X below (TODO not verified).

Wheezy X

It has been reported that src:xorg-server no longer needs to be patched in Wheezy, see [debian-yeeloong-project] New Siliconmotion display driver. And now only xserver-xorg-video-siliconmotion needs patching and /etc/X11/xorg.conf from Squeeze X. Please fill in the details in this Wheezy X section.

Wheezy iceweasel

iceewasel 10:

iceweasel10 mips js asm patch might make things faster:

More recent versions and Anheng's builds carry more patches for mips and may run faster?

Squeeze

This describes how to install Debian Squeeze on the Lemote Yeeloong using Debian components as much as possible. The current issues are with the installer, the kernel and X. We will use the gNewSense/Linux-Libre kernel for installing and as the installed kernel. We will patch the Debian xorg-server package and use a custom xorg.conf to get X working.

References:

/!\ Firstly, backup your data. /!\

Obtain a USB stick that is recognised by the Yeeloong BIOS. (My 256MB FSF stick is!). To test whether it is or not:

  1. Start with Yeeloong powered off and no USB sticks installed.
  2. Put USB stick in left USB port next to VGA port.
  3. Power on Yeeloong.
  4. Press 'Del' lots.
  5. Should get into PMON> prompt.

  6. Delete any extra characters.
  7. Type
    • devls

    • If usb0 is listed then USB stick is recognised by the Yeeloong BIOS. If not then try another USB stick.

Make sure the USB stick that is well partitioned such that fdisk -l /dev/<usb-stick> has no errors. Example of well partitioned:

# fdisk -l /dev/sdb
[snip]
Disk /dev/sdb: 254 MB, 254983680 bytes
255 heads, 63 sectors/track, 31 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System 
/dev/sdb1               1          31      248976   83  Linux

If it produces errors then repartition with fdisk (man fdisk).

Format the filesystem as ext2 (man mkfs.ext2).

Get the initrd from http://ftp.debian.org/debian/dists/squeeze/main/installer-mipsel/current/images/malta/netboot/initrd.gz (Note this is for 'malta' but works for install on the Yeeloong.)

Get the kernel from http://archive.gnewsense.org/gnewsense-metad/installer/current/mipsel/loongson/netboot/vmlinuz-2.6.35.8-libre2-lemote or just get http://archive.gnewsense.org/gnewsense-metad/installer/current/mipsel/loongson/netboot/vmlinuz (as they are currently the same).

Put these files on the USB stick. For ease of typing rename, if necessary, vmlinuz-2.6.35.8-libre2-lemote to vmlinuz and initrd.gz-<something> to initrd.gz otherwise you might make a typo when trying to use them at PMON> prompt.

  1. Start with Yeeloong powered off and no USB sticks installed.
  2. Put USB stick in left USB port next to VGA port.
  3. Power on Yeeloong.
  4. Press 'Del' lots.

  5. Should get into PMON> prompt.

  6. Delete any extra characters.
  7. Type:
    • load (usb0,0)/vmlinuz
    • This takes a few seconds to complete.
  8. Now type:
    • initrd (usb0,0)/initrd.gz
    • This takes several minutes, be patient.
  9. Type:
    • g
    • The installer will load.

Answer questions as normal. When it complains about kernel modules just say 'Yes' to continue.

Continue to answer questions as normal.

Partitioning warning, say 'Yes' to continue. (Need to 'Email debian-boot@lists.debian.org with information.')

Software RAID not available, just say 'Continue'.

Logical Volume Manager not available, just say 'Continue'.

Partition but make sure /boot is ext2/3. (For the cautious you might want / to be ext2/3)

At the 'No installable kernel' warning press Alt-F2 to get to console, we are going to install a kernel manually. At command prompt type:

mount --bind /dev/ /target/dev/
mount --bind /proc/ /target/proc/
mount --bind /sys/ /target/sys/
chroot /target

If you don't get a bash shell and want it then

bash

Then we need to install a kernel. For the 'Debian Way' we would install the Debian linux-image but there is not a linux-image in squeeze for the Yeeloong. There is one is in 'sid' but YMMV.

Edit /etc/apt/sources.list (echo, nano and vi available) and add:

deb http://linux-libre.fsfla.org/pub/linux-libre/lemote/gnewsense metad main

Get Linux Libre key

cd
wget http://www.fsfla.org/svnwiki/selibre/linux-libre/download/SIGNING-KEY
  1. Verify this is the key from Linux Libre.
  2. Understand the implications of adding the key to apt.

apt-key add SIGNING-KEY

Now update the package database from the new source:

apt-get update

Search for the required linux-image:

apt-cache search linux-image lemote # For Debian it would be: apt-cache search linux-image loongson (or just apt-get install linux-image-2.6-loongson-2f

Then install the kernel, for example:

apt-get install linux-image-2.6.38-libre-lemote

Squeeze boot loader

Now we need to add some config so a boot loader can boot the kernel, see http://wiki.gnewsense.org/Projects/GNewSenseToMIPS for options. The two options are PMON booting the kernel directly or PMON 'booting' into GRUB which then boots the kernel. The PMON direct method is easier to set up but PMON ('unfixed') takes minutes to load the kernel and isn't the usual GRUB you know and love. The PMON to GRUB method is more complicated to set up but is faster to boot and gives you the usual GRUB you know and love. That's not to dismiss PMON, it is very good but you are probably not use to it.

Squeeze boot loader PMON direct to kernel

This describes configuring PMON to boot the kernel directly, it works but it does take several minutes to boot up (presumably its loading the initrd in the same method as the installer and so taking ages). See http://wiki.gnewsense.org/Projects/GNewSenseToMIPS#PMON2000Bootfile.28boot.cfg.29

Create /boot/boot.cfg for PMON. Note:

default 0
timeout 3
showmenu 1
title Debian GNU with 2.6.38-libre-lemote
        kernel (wd0,0)/vmlinuz-2.6.38-libre-lemote
        initrd (wd0,0)/initrd.img-2.6.38-libre-lemote
        args root=/dev/sda2 rootdelay=8

title Debian GNU with 2.6.38-libre-lemote single
        kernel (wd0,0)/vmlinuz-2.6.38-libre-lemote
        initrd (wd0,0)/initrd.img-2.6.38-libre-lemote
        args single root=/dev/sda2 rootdelay=8

Squeeze boot loader GRUB

We still use PMON but only to boot GRUB, we then use GRUB to boot the kernel. GRUB is a lot faster at loading the kernel (plus initrd) than PMON. We don't use grub-pc, we use grub-yeeloong. See http://wiki.gnewsense.org/Projects/GNewSenseToMIPS#GRUB

In /boot/boot.cfg add a title entry for GRUB as the first title but keep the other titles as backup. So to /boot/boot.cfg add

title Boot with GRUB (grub.elf)
        kernel (wd0,0)/grub.elf
        args some-dummy-string

to give a /boot/boot.cfg of (adjust as necessary)

default 0
timeout 3
showmenu 1
title Boot with GRUB (grub.elf)
        kernel (wd0,0)/grub.elf
        args some-dummy-string

title Debian GNU with 2.6.38-libre-lemote
        kernel (wd0,0)/vmlinuz-2.6.38-libre-lemote
        initrd (wd0,0)/initrd.img-2.6.38-libre-lemote
        args root=/dev/sda2 rootdelay=8

title Debian GNU with 2.6.38-libre-lemote single
        kernel (wd0,0)/vmlinuz-2.6.38-libre-lemote
        initrd (wd0,0)/initrd.img-2.6.38-libre-lemote
        args single root=/dev/sda2 rootdelay=8

Now we just need to create that grub.elf. First install grub for the Yeeloong

apt-get install grub-yeeloong

giving the following answers.

This then goes on to generate /boot/grub/grub.cfg. This creates entries of

set root=(hd0,msdos1)

but grub sees the disk as ata not hd so I had to change all the

set root=(hd0,msdos1)

to

set root=(ata0,msdos1)

This will be overwritten when /boot/grub/grub.cfg is regenerated. (What is the solution to get the generated version of /boot/grub/grub.cfg to use the correct root?).

Create /boot/grub.elf.conf with root and prefix that will be compiled into grub.elf so it knows where to find /boot/grub/grub.cfg, example of /boot/grub.elf.conf (adjust as necessary)

set root=ata0,msdos1
set prefix=($root)/grub

Create /boot/grub.elf using the grub-mkimage and /boot/grub.elf.conf. The grub modules chosen are those taken from http://2010.rmll.info/IMG/pdf/LSM2010-OS-Grub2Yeelong.pdf

grub-mkimage --directory=/usr/lib/grub/mips-yeeloong/ --config=/boot/grub.elf.conf --output=/boot/grub.elf --format=mipsel-yeeloong-elf --verbose ata part_msdos ext2 reboot halt lspci ohci usbtest usbms linux fat xfs part_gpt multiboot2 minicmd configfile gcry_md5 hashsum echo search

You only need the --directory=/usr/lib/grub/mips-yeeloong/ because of a bug (620420) in grub-yeeloong, which has been fixed by revision 2347 but not in Squeeze.

Squeeze Installer Finish

When finished, return to the installer by pressing Alt-F1.

Say 'Yes' to continue without kernel.

In tasksel, select 'Graphical Desktop Environment'. This will install the packages for GNOME, it will take a long time. We need to do further work on reboot to get X working.

You will get an error about not having a boot loader. Continue on.

You will eventually get to the place where the installer reboots the system. You will get the PMON boot menu which should automatically boot the kernel. This will black out the screen for several minutes (similar time to the installer) but the HD light will be on. Eventually it will boot up. When the boot up has finished the login: prompt might not be displayed, press enter to clear. You'll notice X isn't running!

Squeeze X

To get X working on the attached screen you need to apply a patch to src:xorg-server, rebuild and install it. See 594684 especially comment #25 and comment #35.

NOTE for Wheezy it has been suggested to use this patch http://ageinghacker.net/lemote/01_mips-sarea.diff instead but this has not been confirmed. [It was me who wrote/ported that version of the patch, but now I can't seem to get it working any longer either. Sorry for the noise --?LucaSaiu]

apt-get build-dep xorg-server
mkdir xorg-server
cd xorg-server
apt-get source xorg-server
# Unpacking should happen automatically # dpkg-source -x xorg-server*.dsc
cd xorg-server*/debian/patches/
wget http://jasonwoof.com/downloads/01_mips-sarea.diff
echo "01_mips-sarea.diff" >> series
cd ../..
dpkg-buildpackage -b -uc
cd ..
dpkg -i xserver-{common,xephyr,xorg-{core,dev}}_*.deb

/!\ apt will try want to 'upgrade' these packages to the repository versions and so replacing the patched versions. The solution is to install devscripts so that you can use dch -i which creates a bumped version of the packages. /!\

Create an xorg config file of /etc/X11/xorg.conf with:

# xorg.conf (X.Org X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#   sudo dpkg-reconfigure -phigh xserver-xorg

Section "Device"
        Identifier      "Card0"
        Driver          "siliconmotion"
        Option          "pci_burst" "true"
        Option          "HWCursor" "true"
        Option          "VideoKey" "45000"
        Option          "UseBIOS" "false"
        Option          "PanelSize" "1024x600"
        Option          "CSCVideo" "false"
EndSection

Section "Screen"
        Identifier      "Screen0"
        Device          "Card0"
        Monitor         "Monitor0"
        DefaultDepth    16
EndSection

To get working VGA output you need to apply a patch to xserver-xorg-video-siliconmotion, rebuild and install it. See 624695.

apt-get build-dep xserver-xorg-video-siliconmotion
mkdir xserver-xorg-video-siliconmotion
cd xserver-xorg-video-siliconmotion
apt-get source xserver-xorg-video-siliconmotion
# Unpacking should happen automatically # dpkg-source -x xserver-xorg-video-siliconmotion*.dsc
mkdir xserver-xorg-video-siliconmotion*/debian/patches # Make the patches/ subdirectory if it doesn't exist yet
cd xserver-xorg-video-siliconmotion*/debian/patches/
wget http://www.bjlx.org.cn/loongson2f/squeeze/xserver-xorg-video-siliconmotion/98_sm712_CRT_enable.diff
echo "98_sm712_CRT_enable.diff" >> series
wget http://www.bjlx.org.cn/loongson2f/squeeze/xserver-xorg-video-siliconmotion/97_inb_outb.diff >>series
cd ../..
dpkg-buildpackage -b -uc
cd ..
dpkg -i xserver-xorg-video-siliconmotion_*.deb

/!\ apt will try want to 'upgrade' this package to the repository version and so replacing the patched version. The solution is to install devscripts so that you can use dch -i which creates a bumped version of the package. /!\

One other X patch detailed in [debian-yeeloong-project] Loongson console display text is 99_xf86-video-siliconmotion-1.7.3-fix-loongson.diff but it is not essential and might be a little hacky so avoid unless you know what you are doing.

Now shutdown and then power on. You'll have to wait, as before, for several minutes of a blank screen. Then linux will load and then GDM and you can login to your graphical desktop!

Squeeze-backports kernel

Consider using the Debian loongson kernel that has been backported to Squeeze, linux-image-loongson-2f from squeeze-backports. (Debian Backports Instructions.)

The squeeze-backports kernel doesn't generate an initrd/initramfs image (see /var/lib/dpkg/info/<specific kernel package>.postinst, for example, /var/lib/dpkg/info/linux-image-3.2.0-0.bpo.4-loongson-2f.postinst) so you will need to manually create it after installing or updating.

Check that initrd isn't present for loongson-2f kernel(s):

$ ls /boot/initrd.img-*-loongson-2f

As root use the update-initramfs tool:

# update-initramfs -c -t -v -k <TAB complete to kernel version>

For example:

# update-initramfs -c -t -v -k 3.2.0-0.bpo.4-loongson-2f

Squeeze-backports iotop

If you are using a kernel later than the one in squeeze (2.6.32) and want to use iotop then you might need to get that from backports, iotop from squeeze-backports. (Debian Backports Instructions.)

Lenny

Lenny is now oldstable and you are advised to install Squeeze or Wheezy.

You can find instructions for how to install Debian lenny on a Yeeloong at http://vm-kernel.org/blog/2010/03/27/install-debian-lenny-on-yeeloong-80898101/.