x
This website is using cookies. We use cookies to ensure that we give you the best experience on our website. More info. That's Fine
HPC:Factor Logo 
 
Latest Forum Activity

RAM OS image: boot off CF card, dual boot on 900c!

1 2 3 4
cmonex Page Icon Posted 2008-02-17 10:03 PM
#
Avatar image of cmonex
H/PC Oracle

Posts:
16,175
Location:
Budapest, Hungary
Status:
yes folks that's right

as an experiment i converted the stock OS 2.02 image into a RAM OS image that can be booted off CF card without flashing it to rom,

here's the result

see pic, less RAM obviously, but still not too bad. for fun, this 900c has a beta hpc2000 rom image flashed to rom currently but is running cenet at the moment!! of course do a hard reset and you've lost the image, needs reloading.


download rom (well, ram) image from here http://hpcmonex.net/nec900/files/releases/XIP_RAMOS_cenet420_OS202....

usage:
- you have to have bootloader 4.10
- put XIP.BIN on cf card formatted fat16
- hard reset 900c and press and hold R and F keys while reinserting power to it (NOT C key!)
- it should say loading CE image or something like that
- wait a bit until it copies from cf card (there is a progress bar)
- then it boots and you're done



some terminal output just for fun - note, of course you don't need the serial cable, you can just load this using R+F keys.


1 - Update the boot loader
2 - Update the OS
3 - Launch OS
-------------------------------------.


>93
Booting from CF card
Card found in socket 0.
ResetCard: Resetting socket 0
ResetCard: Card is ready. status = 0x000019B9
PCMFindPcCards: Initializing PCMCIA hardware
PCMGetStatus: PCMGetStatus(0x0, 0xB0004DB0) entered.
PCMGetStatus: Calling LocateCard()
IsCardPowered: Card Powered in socket 0.
PCMGetStatus: Card in Present is socket 0!!
PCMGetStatus: PCMGetStatus returning 1.
PCMGetFirstTuple: Socket = 0, PcCard->Attrib.Base = 0xAA400000
PCMGetStatus: PCMGetStatus(0x1, 0xB0004DB0) entered.
PCMGetStatus: Calling LocateCard()
PCMGetStatus: PCMGetStatus returning 0.
BootFromCard: Found 1 PC cards in system
PCMGetFirstCard
PCMGetFirstTuple: Socket = 0, PcCard->Attrib.Base = 0xAA400000
PCMRequestIO: socket 0, base 0.
PCMFindAtaDevices-Contiguous I/O config
Volume is FAT16 format with 62388 clusters
BootFromCard: Found 1 ATA PC cards in system
Searching for BIN on ATA PC card
BIN file size 27657491 bytes
Read the BIN file header
Image Address = 0x90200000 Image Size = 0x1A60000
..........
Process the termination record which contains the jump address

Copied BIN file from ATA to RAM
BootFromCard: Found BIN on ATA PC card.
Image address start = 0x90200000
JumpAddress 0x90201000.
ulFileSize 0x01A60000.
Finished loading image!
Launching CE from 0x90201000!


Jump to Kernel


Edited by cmonex 2008-02-17 10:44 PM




(ScrSnap001.jpg)



Attachments
----------------
Attachments ScrSnap001.jpg (31KB - 5 downloads)
 Top of the page
TFGBD Page Icon Posted 2008-02-17 10:13 PM
#
Avatar image of TFGBD
H/PC Philosopher

Posts:
310
Location:
Eastern USA
Status:
Wow, cool. Dang, cmonex. When you say you will do something, you do it... ;P
 Top of the page
cmonex Page Icon Posted 2008-02-17 10:20 PM
#
Avatar image of cmonex
H/PC Oracle

Posts:
16,175
Location:
Budapest, Hungary
Status:
sorry it seems my site is down for the moment or just being very slow, but hopefully it is back soon.

anyway here's how you make a RAM OS

- grab xipport
- grab a rom image that's ready for xipport (see romtutorial for what's needed)
- this rom image should be ce.net for now. hpc2000 nk.exe has to be relocated to run from ram, i can do it but that's not the most trivial without a relocation table so will work on it for a few mins.
- put the kernel image away for now, first to deal with is the OS image

- dump the rom, go to OUT folder, open romhdr.txt and edit it

mine with the OS 2.02 was like this (i'm copying only the relevant parts) :

original:
physfirst: P=84080000
physlast: 859C8ED0
ulRAMStart: R=90261000
ulRAMFree: 9029D000
ulRAMEnd: 94000000
and pExtensions: P+0C1832D4

new:
physfirst: P=90300000
physlast: 91C60000
ulRAMStart: R=90261000
ulRAMFree: 91C6D000
ulRAMEnd: 94000000
pExtensions: P+01960000

physfirst is start of the OS xip image
phylast is end of it
within physfirst and physlast nothing else should be present!
ulRAMStart is start of the ram space that the kernel will use. do not change that one unless you relocate kernel data section
ulRAMFree is end of that and it also defines the start of the ram that will be used for the rest of the OS: program ram, storage ram (object store)! this is basically the ram start visible to OS
ulRAMEnd is the ram end visible to OS

the pExtensions is just to specify image size for xipport (due to a bit buggy implementation i'd say), for a ram os image this is crucial not to let it grow too large ... or if you are unsure how large your image will be after rebuilding then you could just specify 01D80000 there then later cut the xip_out.bin to size

now for the 900c,
usable rom is anything between 0x84080000-0x85E00000 (rest is bootloader etc)
usable ram is anything between 0x90200000-0x94000000 (rest is bootloader etc)

use this data to be able to decide how to change the romhdr.txt. my example is quite sane except physlast may be different if your OS image is larger or smaller. you can choose a different physfirst too, such as 902A0000 if you want even more ram free. i was just being lazy.


...after this, hit realloc P then rebuild OS image into xip_out.bin,

now kernel (in its separate image, not in the OS), romheader must be changed too, but only this: ulRAMFree: 91C6D000. because this entry in OS image will be ignored by kernel, it reads its own for that. without this my OS didn't boot, so i needed one more try to get it right

and finally, xipchain has to be changed too, at the end of the "kernel binary", where you see the string "XIP2"... just before it, find 00 00 08 84, change it to new physfirst, say, 90300000, so then 00 00 30 90.
that should be it, i also changed 00 00 D8 01 to 00 00 96 01, but that's not really necessary...

finally, to make a XIP.BIN to be flashed, i just enlarged the kernel part so it ended in 0x90300000 (originally 394536 bytes, that became 1,048,576 bytes large), so then i could just attach it to the OS image start, then made the bin with xipbin.exe and patched last bytes to 00 10 20 90 (details in romtut...). this isn't needed for images that are to be flashed into rom, but this patch is essential for booting a RAM OS.

p.s.. in the image i uploaded i put my rom v2.0 patched kernel into it because that's what i found first on my hdd, but the OS image is stock.

Edited by cmonex 2008-02-17 10:31 PM
 Top of the page
mr-mac Page Icon Posted 2008-02-18 3:38 AM
#
Avatar image of mr-mac
H/PC Elder

Posts:
1,973
Status:
Nice work...

hmmmm any chance we could get this method to work on Sig3? It would be really handy to try out a ce .net 4.2 OS

Edited by mr-mac 2008-02-18 3:39 AM
 Top of the page
Rich Hawley Page Icon Posted 2008-02-18 10:07 AM
#
Avatar image of Rich Hawley
Global Moderator
H/PC Guru

Posts:
7,188
Location:
USA
Status:
Interesting...now if you could rewrite the code so that it just ran everything from the CF card as if it were the RAM rather than just copying it from there and running it, then by using a larger CF card, you would have unlimited memory. Theoretically you could change operating systems just by selecting which CF card you inserted.

Nice thing would be beta testing new operating systems without the need for flashing the internal ROM.

Rich
 Top of the page
DonL0001 Page Icon Posted 2008-02-18 10:35 AM
#
Avatar image of DonL0001
H/PC Philosopher

Posts:
490
Location:
United States
Status:
Quote
Rich Hawley - 2008-02-18 11:07 AM

Interesting...now if you could rewrite the code so that it just ran everything from the CF card as if it were the RAM rather than just copying it from there and running it, then by using a larger CF card, you would have unlimited memory. Theoretically you could change operating systems just by selecting which CF card you inserted.

Nice thing would be beta testing new operating systems without the need for flashing the internal ROM.

Rich


Rich,

I was induced into similar thoughts. I suspect that even if executing from the CF card were possible, it would be significantly slower.

Also, you probably could put 10 OS's on a single CF card if you could remember which one you wanted to run, even without compression.

Regards, Don
 Top of the page
mr-mac Page Icon Posted 2008-02-18 11:18 AM
#
Avatar image of mr-mac
H/PC Elder

Posts:
1,973
Status:
Quote
DonL0001 - 2008-02-18 3:35 PM

Quote
Rich Hawley - 2008-02-18 11:07 AM

Interesting...now if you could rewrite the code so that it just ran everything from the CF card as if it were the RAM rather than just copying it from there and running it, then by using a larger CF card, you would have unlimited memory. Theoretically you could change operating systems just by selecting which CF card you inserted.

Nice thing would be beta testing new operating systems without the need for flashing the internal ROM.

Rich


Rich,

I was induced into similar thoughts. I suspect that even if executing from the CF card were possible, it would be significantly slower.

Also, you probably could put 10 OS's on a single CF card if you could remember which one you wanted to run, even without compression.

Regards, Don


edit... being thick....

Edited by mr-mac 2008-02-18 11:24 AM
 Top of the page
Rich Hawley Page Icon Posted 2008-02-18 12:13 PM
#
Avatar image of Rich Hawley
Global Moderator
H/PC Guru

Posts:
7,188
Location:
USA
Status:
I think it would be slow as well Don, but for testing rom flashes, think of what a time savings it would be not to have actually install a beta version onto the machine, but just run it to work out the bugs first...then when you were satisfied...flash it permanently.
 Top of the page
cmonex Page Icon Posted 2008-02-18 1:01 PM
#
Avatar image of cmonex
H/PC Oracle

Posts:
16,175
Location:
Budapest, Hungary
Status:
Quote
Rich Hawley - 2008-02-18 4:07 PM

Interesting...now if you could rewrite the code so that it just ran everything from the CF card as if it were the RAM rather than just copying it from there and running it, then by using a larger CF card, you would have unlimited memory. Theoretically you could change operating systems just by selecting which CF card you inserted.

Nice thing would be beta testing new operating systems without the need for flashing the internal ROM.

Rich



code must be run from ram, so that will not work. this is how cpu design works.

now, NOR flashrom is like ram, that's why you can run code from there. but a CF card isn't like that.

you can change OS'es by just loading and booting the OS image from CF though (which has just been achieved).
 Top of the page
cmonex Page Icon Posted 2008-02-18 1:02 PM
#
Avatar image of cmonex
H/PC Oracle

Posts:
16,175
Location:
Budapest, Hungary
Status:
Quote
mr-mac - 2008-02-18 9:38 AM

Nice work...

hmmmm any chance we could get this method to work on Sig3? It would be really handy to try out a ce .net 4.2 OS



sig3 bootloader has to support this - no idea if it does, i can check, but of course doubtful

failing that we might be able to use some haret like utility.
 Top of the page
mr-mac Page Icon Posted 2008-02-18 1:16 PM
#
Avatar image of mr-mac
H/PC Elder

Posts:
1,973
Status:
Quote
cmonex - 2008-02-18 6:02 PM

Quote
mr-mac - 2008-02-18 9:38 AM

Nice work...

hmmmm any chance we could get this method to work on Sig3? It would be really handy to try out a ce .net 4.2 OS



sig3 bootloader has to support this - no idea if it does, i can check, but of course doubtful

failing that we might be able to use some haret like utility.


That would be cool....

It would be very handy to be able to be able to test and de-bug a CE 4.2 OS for when I get my rom sorted.

John
 Top of the page
Geared2003 Page Icon Posted 2008-02-18 1:19 PM
#
Avatar image of Geared2003
H/PC Elite

Posts:
518
Location:
France
Status:
Interesting "proof of Concept", Cmonex... Good start for a PhD, but what is the practical use of all this ?
I assume that a simple soft-reset will clear the memory and the RAM OS, right? So this solution is not suitable for a true "dual boot" like desktop PCs, where all files and settings of all OSes remain...

 Top of the page
cmonex Page Icon Posted 2008-02-18 1:48 PM
#
Avatar image of cmonex
H/PC Oracle

Posts:
16,175
Location:
Budapest, Hungary
Status:
p.s.: i was lazy and forgot something so .net cf 1.0 runtime is corrupted in this RAMOS (can easily be fixed) but i'm sure everything else works just fine
 Top of the page
cmonex Page Icon Posted 2008-02-18 1:48 PM
#
Avatar image of cmonex
H/PC Oracle

Posts:
16,175
Location:
Budapest, Hungary
Status:
Quote
Geared2003 - 2008-02-18 7:19 PM
I assume that a simple soft-reset will clear the memory and the RAM OS, right? So this solution is not suitable for a true "dual boot" like desktop PCs, where all files and settings of all OSes remain...



wrong assumption

only hard reset clears it



why is this useful? well for me personally... i won't have to flash testroms 1) flashing is slow and a pain in the ass 2) if i flash too many testroms the NOR flash might not like that after a while (my own personal problem, notyours, lots of testing sometimes) 3) just fun being able to dualboot like this

i will soon release a hpc2000 RAM OS, hopefully!

Edited by cmonex 2008-02-18 1:49 PM
 Top of the page
cmonex Page Icon Posted 2008-02-18 8:48 PM
#
Avatar image of cmonex
H/PC Oracle

Posts:
16,175
Location:
Budapest, Hungary
Status:
ok here is the hpc2000 RAM OS after applying various tricks to build it, first version booted up right away!

see attached pics

this is based on the last official hpc2000 image i've been able to find so far (v6.0).

the kernel has been rebased to run from RAM, data sections of course rebased separately, had to redefine ram ranges from scratch as hpc2000 was fully xip from rom previously. and all that- made it a bit more complex

it seemed i've not found all the addresses to be relocated in the nk.exe, at least old stripped reloc table info seemed too large to fully account for (wish i had the reloc table itself)... but it still boots fine, however i've not tested this image extensively.

now here is your chance to try out hpc2000 without having to flash it! (of course you will still have to hard reset)

download:
http://hpcmonex.net/nec900/files/releases/XIP_RAMOS_HPC2000v60.ZIP

usage: as in first post.



p.s. 1.: working on linux ram image together with kristoffer. and i plan to write a dualboot utility.
p.s. 2.: and this terminal output is so funny after always having hpc2000 boot from rom previously...

BIN file size 20121991 bytes
Read the BIN file header
Image Address = 0x90200000 Image Size = 0x13305D0
.......
Process the termination record which contains the jump address

Copied BIN file from ATA to RAM
BootFromCard: Found BIN on ATA PC card.
Image address start = 0x90200000
JumpAddress 0x90201000.
ulFileSize 0x013305D0.
Finished loading image!
Launching CE from 0x90201000!


Edited by cmonex 2008-02-18 8:54 PM




(ScrSnap0010.jpg)



(ScrSnap0020.jpg)



Attachments
----------------
Attachments ScrSnap0010.jpg (24KB - 6 downloads)
Attachments ScrSnap0020.jpg (32KB - 4 downloads)
 Top of the page
1 2 3 4
Jump to forum:
Seconds to generate: 0.265 - Cached queries : 53 - Executed queries : 31