[vmips] Linux on VMIPS?

Brian R. Gaeke brg at dgate.ORG
Thu Dec 2 18:30:15 CST 2004


On Dec 2, 2004, at 12:59 AM, Cable Guy wrote:
> Brian, first I want to say how impressed I am by this piece of work.
> Wonderful job.

Hey, thanks! I appreciate it (as I'm sure everyone else who's helped me 
with vmips does!)

> I find it almost inconceivable that this list gets so
> little traffic (I've scoured the mailing list archives looking for the
> answers to a few things but there's so little there).
> I have a few questions I hope you have time to answer.

I'm always happy to answer vmips questions, though the amount of time
I have to work on vmips is quite limited.

> I'm trying to get a minimal Linux up and running on VMIPS.  I saw
> where you said you had made progress in this area.  Care to share any
> of the details?

I've been able to boot a minimal linux kernel configured for DECstation 
5000/200 on vmips using a ramdisk. It successfully loads "ash" as the 
single-user mode shell and displays a "#" prompt. So far so good... 
however, currently I seem to have trouble running other programs from 
the "ash" command line - I either get infinite loops or "jump to zero" 
warnings from the vmips cpu. You can see what it looks like for me
at the end of this message.  I'm working on fixing the tracing 
subsystem to help me debug this.

> I built a 2.4.18 kernel using the DECStation 5000/200
> flavor, selected the DZ serial terminal and TurboChannel in the
> configuration.

Sounds about right so far. I'll send you my 
linux/.config file. BTW - I use the linux_2_4 kernel source branch 
checked out from anonymous cvs on linux-mips.org; take a look at
  http://www.linux-mips.org/wiki/index.php/Net_Resources#CVS
for details.

Furthermore, since you're configured for 5000/200, you'll want to use
this patch:
  http://www.linux-mips.org/archives/linux-mips/2004-12/msg00038.html
which is the only patch I've needed against the linux-mips.org kernel.

> Is it necessary to load everything including my vmlinux kernel above
> the 0xBFC00000 line and then move/copy it to lower memory where I can
> use it?

I currently do something very much like this. Mind, I'm not claiming it's
a great idea, but at least it works... anyway, the ROM memory map looks 
like this:

L                                      R
|<-----vmlinux.ecoff kernel image----->|<------ boot rom code----->|

L = loadaddr = 0xbfc00000 - size of vmlinux.ecoff
R = reset vector = 0xbfc00000

I have a script that concatenates vmlinux.ecoff and the boot rom code,
and outputs the proper load address. This script is called 'catrom'.
(For example, using my current linux kernel I get a loadaddr of 0xbfa66000.)

Then I have a script that takes the result of 'catrom' and launches
vmips with the proper options. This latter script is called 'vmipsdec'.
They are both in the vmips/sample_code/xmboot directory.

Someday, I hope to have a disk device in vmips, so that all this will
be unnecessary. Maybe someone will contribute one, or else I'll have time
to write it someday.

> Note that I am using an uncompressed kernel at the moment.
> I'll worry about compressed kernel images later.  Right now my tiny
> vmlinux kernel is less than 1 MB and using an uncompressed kernel is
> one less thing to worry about until I make some progress.

Yes, I haven't tried compressed kernels either.

> Can you post your ld.whatever script for Linux?

vmips/sample_code/xmboot/boot.script is the linker script I use for the boot
ROM; after that, I use 'catrom' to moosh the kernel together with the ROM file.
I don't have any modifications to the standard MIPS Linux linker script(s).

> How about a sample
> setup.S assembler sample to kick everything off re. zeroing out the
> .bss section, copying read/write data sections to RAM, etc.? 

I use vmips/sample_code/xmboot/boot_setup.S to do the copying for the
writable data that belongs to the booter; the booter has its own ECOFF loader
built in (see coff.c:coff_analyze() and boot.c:boot() in that same directory).
If you type 'make' in that directory, it'll build the full bootloader minus
kernel into 'boot.rom'.

> (P.S. My ultimate objective here is to get my own Linux kernel and
> userspace programs running on a SOHO router I have that's using an
> ADM5120 MIPS 4kc SOC.  I've found good stuff on the net re. similar
> devices using Broadcom chipsets, but they're big-endian and the
> ADM5120 is little-endian.  At least all the firmware upgrades released
> for it so far are little-endian.  I re-build VMIPS for
> mipsel-tradlittlemips and the sample programs run fine so I don't
> think that will be a huge problem.

Nowadays, vmips tends to be pretty good about supporting both big
and little-endian systems. I'm afraid the R3000 that VMIPS simulates
isn't quite as nice as the 4kc-based cores, but hopefully it won't
matter from your software's point of view.

> I want to simulate the Linux
> running on this router and a subset of the router's hardware using
> VMIPS.  I don't need the IP networking to be actually functional in
> VMIPS.  I just need it to simulate the booting of Linux cold from
> Flash ROM and then play around until I understand how firmware
> upgrades are done.)

This sounds like an awesome project. Let me know how it turns out!

-Brian

------------------------------------------------------------------------------

11 sartre% ls -l vmlinux.ecoff
-rwxr-xr-x  1 brg users 1675584 Nov 29 02:56 vmlinux.ecoff*
12 sartre% ./vmipsdec
Little-Endian host processor detected.
Mapping ROM image (bootvmlinux.ecoff.rom, 425984 words) to physical address 0x1fa66000
Mapping RAM module (host=0x403dd008, 32768KB) to physical address 0x0
Mapping DECstation 5000/200 RTC to physical address 0x1fe80000
Connected IRQ3 to the DECstation 5000/200 RTC
Mapping DECstation 5000/200 CSR to physical address 0x1ff00000
Connected IRQ2 to the DECstation 5000/200 CSR
Mapping DECstation 5000/200 CHKSYN & ERRADR to physical address 0x1fd00000
DZ11 Master clear!
Mapping DECstation 5000/200 DZ11 Serial to physical address 0x1fe00000
Connected fd 4 to DECstation 5000/200 DZ11 Serial line 3.

*************RESET*************

DZ11 write CSR as 10
DZ11 Master clear!
DZ11 Keyboard IE is now off, Display IE now off, selected tx line now 0
DZ11 write CSR as 20
DZ11 Keyboard IE is now off, Display IE now off, selected tx line now 0
DZ11 write CSR as 320
DZ11 Keyboard IE is now off, Display IE now off, selected tx line now 3


Vmips boot monitor
Autobooting preloaded ROM file at bfa66000
Moving 1671168 bytes of text from bfa66140-bfbfe140 to 80040000-801d8000...ok.
Moving 0 bytes of data from bfbfe140-bfbfe140 to 801d8000-801d8000...ok.
Zeroing out bss (140992 bytes at 801d8000)...ok.
When you walk through the storm
hold your head up high
And don't ... be afraid ... of the dark!
load byte from physical address 0x2000000 caused bus error
This is a DECstation 5000/200
CPU revision is: 00000230
Primary instruction cache 0kB, linesize 0 bytes.
Primary data cache 0kB, linesize 0 bytes.
Linux version 2.4.27 (brg at sartre) (gcc version 3.3.2) #16 Mon Nov 29 02:56:06 CST 2004
Determined physical RAM map:
 memory: 02000000 @ 00000000 (usable)
Initial ramdisk at: 0x801b9000 (126976 bytes)
On node 0 totalpages: 8192
zone(0): 8192 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: 
ERRADR reg cleared
RTC RTC_REGA (10) written with 0x29
RTC rate_selector set to 0x9 (7812500)
RTC RTC_REGB (11) written with 0x40
RTC interrupt_enable set to 1
RTC turning interrupts on
DZ11 write CSR as 10
DZ11 Master clear!
DZ11 Keyboard IE is now off, Display IE now off, selected tx line now 0
DZ11 write CSR as 20
DZ11 Keyboard IE is now off, Display IE now off, selected tx line now 0
DZ11 write LPR as e58
This is a DECstation 5000/200
CPU revision is: 00000230
Primary instruction cache 0kB, linesize 0 bytes.
Primary data cache 0kB, linesize 0 bytes.
Linux version 2.4.27 (brg at sartre) (gcc version 3.3.2) #16 Mon Nov 29 02:56:06 CST 2004
Determined physical RAM map:
 memory: 02000000 @ 00000000 (usable)
Initial ramdisk at: 0x801b9000 (126976 bytes)
On node 0 totalpages: 8192
zone(0): 8192 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: 
Calibrating delay loop... 1.05 BogoMIPS
Memory: 30252k/32768k available (1324k kernel code, 2516k reserved, 208k data, 84k init, 0k highmem)
Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)
Inode cache hash table entries: 2048 (order: 2, 16384 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 8192 (order: 3, 32768 bytes)
Checking for 'wait' instruction...  unavailable.
POSIX conformance testing by UNIFIX
TURBOchannel rev. 0 at 25.0 MHz (without parity)
load byte from physical address 0x1e3c03f0 caused bus error
ERRADR reg read as 0xc78f0101
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1e3c03f4 caused bus error
ERRADR reg read as 0xc78f0102
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1e3c03f8 caused bus error
ERRADR reg read as 0xc78f0103
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1e3c03fc caused bus error
ERRADR reg read as 0xc78f0104
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1e7c03f0 caused bus error
ERRADR reg read as 0xc79f0101
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1e7c03f4 caused bus error
ERRADR reg read as 0xc79f0102
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1e7c03f8 caused bus error
ERRADR reg read as 0xc79f0103
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1e7c03fc caused bus error
ERRADR reg read as 0xc79f0104
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1ebc03f0 caused bus error
ERRADR reg read as 0xc7af0101
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1ebc03f4 caused bus error
ERRADR reg read as 0xc7af0102
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1ebc03f8 caused bus error
ERRADR reg read as 0xc7af0103
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1ebc03fc caused bus error
ERRADR reg read as 0xc7af0104
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1efc03f0 caused bus error
ERRADR reg read as 0xc7bf0101
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1efc03f4 caused bus error
ERRADR reg read as 0xc7bf0102
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1efc03f8 caused bus error
ERRADR reg read as 0xc7bf0103
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1efc03fc caused bus error
ERRADR reg read as 0xc7bf0104
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1f3c03f0 caused bus error
ERRADR reg read as 0xc7cf0101
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1f3c03f4 caused bus error
ERRADR reg read as 0xc7cf0102
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1f3c03f8 caused bus error
ERRADR reg read as 0xc7cf0103
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1f3c03fc caused bus error
ERRADR reg read as 0xc7cf0104
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1f7c03f0 caused bus error
ERRADR reg read as 0xc7df0101
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1f7c03f4 caused bus error
ERRADR reg read as 0xc7df0102
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1f7c03f8 caused bus error
ERRADR reg read as 0xc7df0103
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1f7c03fc caused bus error
ERRADR reg read as 0xc7df0104
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1f8003f0 caused bus error
ERRADR reg read as 0xc7e00101
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1f8003f4 caused bus error
ERRADR reg read as 0xc7e00102
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1f8003f8 caused bus error
ERRADR reg read as 0xc7e00103
CHKSYN reg read as 0x0
ERRADR reg cleared
load byte from physical address 0x1f8003fc caused bus error
ERRADR reg read as 0xc7e00104
CHKSYN reg read as 0x0
ERRADR reg cleared
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
pty: 256 Unix98 ptys configured
DECstation DZ serial driver version 1.02
ttyS00 at 0xbfe00000 (irq = 15)
ttyS01 at 0xbfe00000 (irq = 15)
ttyS02 at 0xbfe00000 (irq = 15)
ttyS03 at 0xbfe00000 (irq = 15)
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
SCSI subsystem driver Revision: 1.00
kmod: failed to exec /sbin/modprobe -s -k scsi_hostadapter, errno = 2
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 2048 bind 4096)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
RAMDISK: Compressed image found at block 0
Freeing initrd memory: 124k freed
VFS: Mounted root (ext2 filesystem) readonly.
Freeing unused PROM memory: 252k freed
Freeing unused kernel memory: 84k freed
DZ11 write CSR as c360
DZ11 Keyboard IE is now on, Display IE now on, selected tx line now 3
DZ11 write LPR as 1e1b
sh: can't access tty; job control turned off
# echo
[hangs here]

*************HALT*************

97045458 instructions in 158.66577 seconds (611634.475 instructions per second)
Goodbye.
------------------------------------------------------------------------------

-- 
Brian R. Gaeke, brg at dgate.org -- GnuPG encrypted mail gleefully accepted


More information about the Vmips mailing list