DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2007-10-09 17:59:22

dpavlin
Member
From: Zagreb, Croatia
Registered: 2007-04-02
Posts: 17
Website

PowerPC emulation

After few months of power cycling of DSM G600 with every kernel fault, I decided that it's not the perfect way to develop kernel on it. So I tried a couple of PowerPC emulators and I do have partial boot (up to first DSM G600 hardware specific thing to be honest).

My adventure so far is documented at: http://blog.rot13.org/2007/10/powerpc_emulation.html

My choice of emulator would be also affected by other people interested in development. I don't have full understanding of hardware, but with good emulator we can poke running kernel until we know enough.

Some C coding knowledge is required (I'm quite lousy muself), but it could be a good way to understand device instead of bricking it (especially without serial port), so I guess that people might be interested in this...

Right now I'm leaning towards GXemul which seems to implement best debugging, together with strack trace of kernel (so you can lookup in kernel source why it died).

Current source code of modified GXemul with some basic support is at: http://svn.rot13.org/index.cgi/gxemul/browse/trunk

You can test it using:

Code:

svn co svn://svn.rot13.org/gxemul/trunk gxemul
cd gxemul
./configure
make
# run it
./gxemul -E sandpoint -N -Q -T -t -K -V -vvv vmlinux-2.4.21-pre4.elf

kernel is elf file compiled for DSM G600 (idea is to understand hardware of machine :-)

Currently it will load kernel at correct address, start serial port output and die on mpc40x init. But, I'm working on it...

I also decided to push dynamips changes (so that you can compare effort to make it boot a bit) at http://svn.rot13.org/index.cgi/dynamips/browse/trunk

Code:

svn co svn://svn.rot13.org/dynamips/trunk dynamips
cd dynamips
make
dynamips -P 1700 --vm-debug 1 vmlinux-2.4.21-pre4.elf

Last edited by dpavlin (2007-10-12 13:20:30)

Offline

 

#2 2007-10-15 01:33:53

dpavlin
Member
From: Zagreb, Croatia
Registered: 2007-04-02
Posts: 17
Website

Re: PowerPC emulation

Lack of comments on this post seems to indicate that level of interest in this topic is small... However, I will bore you with another post which shows my progress so far...

I managed to implement enough or mpc10x and OpenPIC in GXemul to more-or-less accurately emulate first part of boot. I still don't understand fully how OpenPIC works so I will need at least several more weeks to implement them well enough to emulate kernel boot into some kind of semi-usable emulated enviroment (probably initrd at fist). In short, interrupts aren't emulated yet, so it still dies before calibrating delay loop in emulator.

I have found that inserting a log of printk messages all over the place helps a lot. When running same kernel in GXemul and on real device (using loader.o) I was able to get accurate traces of what kernel gets from real device and from my implementation.

This helped me a lot to understand what the chips do, so I hope that I will be able to do same thing for all the hardware. Same method might be used to develop u-boot (to boot kernel directly from IDE drive, for example) in comfort of emulated environment. GXemul's trace flag shows whole back trace through kernel, which is very helpful.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB