Home | History | Annotate | Download | only in internals
      1 
      2 How to install and configure a QEMU mips64-linux installation.
      3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      4 
      5 Last updated 04 May 2015
      6 
      7 This gives an apparently stable, but extremely slow, mips64-linux
      8 install.  It has the advantage that the idle loop works right and so
      9 when the guest becomes idle, qemu uses only very little host cpu, so
     10 you can leave the guest idling for long periods without bad
     11 performance effects on the host.
     12 
     13 More or less following
     14 https://gmplib.org/~tege/qemu.html section 8 (for mips64)
     15 
     16 Build qemu-2.2.1 with --target-list including mips64-softmmu
     17 
     18 mkdir Mips64-1
     19 cd Mips64-1
     20 
     21 wget ftp://ftp.sunet.se/pub/Linux/distributions/debian/dists/wheezy/main/installer-mips/current/images/malta/netboot/vmlinux-3.2.0-4-4kc-malta
     22 
     23 wget ftp://ftp.sunet.se/pub/Linux/distributions/debian/dists/wheezy/main/installer-mips/current/images/malta/netboot/initrd.gz
     24 
     25 md5sum initrd.gz vmlinux-3.2.0-4-4kc-malta
     26   71f05a4aaf24671fa72e903abd76a448  initrd.gz
     27   307fc61d36cb370ea2b697d587af45a6  vmlinux-3.2.0-4-4kc-malta
     28 
     29 # Note.  4G is easily enough to install debian and do a build of Valgrind.
     30 # If you envisage needing more space, now is the time to choose a larger
     31 # number.
     32 
     33 /path/to/Qemu221/bin/qemu-img create disk4G.img 4G
     34 
     35 /path/to/Qemu221/bin/qemu-system-mips64 \
     36   -M malta -cpu 5Kc -m 256 -hda disk4G.img \
     37   -net nic,macaddr=52:54:00:fa:ce:08 -net user,hostfwd=tcp::5555-:22 \
     38   -kernel vmlinux-3.2.0-4-4kc-malta -initrd initrd.img-3.2.0-4-4kc-malta \
     39   -append "root=/dev/sda1 console=ttyS0 --" -nographic
     40 
     41 Do an install, be as vanilla as possible, allow it to create a user
     42 "username", and do not ask it to install any extra software.  But,
     43 when you get to here
     44 
     45    [!!] Finish the installation 
     46                                                                          
     47                           Installation complete                         
     48   Installation is complete, so it is time to boot into your new system. 
     49   Make sure to remove the installation media (CD-ROM, floppies), so     
     50   that you boot into the new system rather than restarting the          
     51   installation.                                                         
     52                                                                         
     53       <Go Back>                                          <Continue>     
     54                                                                          
     55   
     56 
     57 do "Go Back"
     58 then in the next menu "Execute a shell", "Continue"
     59 
     60 This gives you a root shell in the new VM.  In that shell:
     61 
     62   mount -t proc proc /target/proc
     63   mount --rbind /sys /target/sys
     64   mount --rbind /dev /target/dev
     65   chroot /target bash
     66   /etc/init.d/ssh start
     67   ls /boot
     68     System.map-3.2.0-4-5kc-malta  initrd.img-3.2.0-4-5kc-malta
     69     config-3.2.0-4-5kc-malta      vmlinux-3.2.0-4-5kc-malta
     70 
     71 Then on the host, copy out the vmlinux and initrd:
     72 
     73 ssh -p 5555 username@localhost \
     74   "tar -c -f - --exclude=lost+found /boot" | tar xf -
     75 
     76   exit
     77   exit
     78   Select "Finish the installation"
     79   Continue
     80 
     81 When it reboots, kill qemu from another shell, else it will try to reinstall.
     82 
     83 Now start the installation:
     84 
     85 /path/to/Qemu221/bin/qemu-system-mips64 \
     86   -M malta -cpu 5Kc -m 256 -hda disk4G.img -net nic,macaddr=52:54:00:fa:ce:08 \
     87   -net user,hostfwd=tcp::5555-:22 -kernel boot/vmlinux-3.2.0-4-5kc-malta \
     88   -initrd boot/initrd.img-3.2.0-4-5kc-malta \
     89   -append "root=/dev/sda1 console=ttyS0" -nographic
     90 
     91 System seems to have 256MB memory no matter how much you request.
     92 
     93 This is basically a 32 bit system at this point.  To get something
     94 that can build 64 bit executables, it is necessary to install
     95 gcc-multilib and g++-multilib.
     96 
     97 Now you can ssh into the VM and install stuff as usual:
     98 
     99 ssh -XC -p 5555 username@localhost
    100 
    101   (on the guest)
    102   become root
    103 
    104   apt-get install make g++ gcc subversion emacs gdb automake autoconf
    105   apt-get gcc-multilib g++-multilib
    106 
    107 Configuring V on the guest:
    108 
    109   ./autogen.sh
    110   CFLAGS="-mips64 -mabi=64" CXXFLAGS="-mips64 -mabi=64" \
    111     ./configure --prefix=`pwd`/Inst
    112