OS Image Relocation


No, give me a moment to reconsider on that and please correct me if I’m wrong. IF I remember correctly, the IPL loads the image and then jumps to startup_vaddr, which is the entry point to the image, as its last action. Doing it the way you outlined in your latest proposition, I would already have the image in RAM, therefore I cannot perform destructive writes. Well, more or less.

Apart from that, are there any other pitfalls to watch out for, except the usual ones? Or why do you prefer the IPL approach over this one?

Regards,
C++
[/quote]

I think in the IPL you are limited in size. It’s easier to test because all you have do to is rewrite the IPL (boot loader) on the HD. While if it’s in the startup program you must recreate a image each time you want to try it, but you don’t have size limitation.

Hi Mario,

trying to do it the IPL way, I’ve come to another obstacle. As I’ve already outlined, I have a x86 machine with BIOS, the image is located on disk (floppy, later the hard drive).

Reading through the “How to write an IPL” stuff, it reads in buildings.pdf p.62, that an existing BIOS loads the image into RAM, and then hands over control to the user written IPL, which is located at the very beginning of the boot image. In that example, all the IPL does is to do a jump to the image’s startup address.

So, aren’t the last 2 propositions we discussed then equal in nature? Because if I only get control after the BIOS, I’ll never have the chance to do any work prior to image being transferred into RAM.

Thanks and regards,
C++

The BIOS doesn’t load the image, it loads the IPL then the IPL loads the image. Yes in cases of flash or ROM images for example the IPL is in the image but that is not the case for PC.

You know when your PC displays “press escape for alternate os” and then the rotating arrow, well that is the IPL doing that…

Hi Mario!

So the order of execution is: BIOS → IPL → Kernel → Applications

But reading through the net, it said that upon PC startup, the CPU looks at the reset vector, a predefined address at 0xFFFF FFF0. What exactly is there now? The BIOS or the IPL?

And a last “stupid” question. How on earth can I transfer the IPL to the floppy/harddisk? Is this part of building the image, involving mkifs? Don’t think so.
In the PDFs it reads so simple, like “get an example from our directories, modify it as you wish, etc”. It also has a very extensive description about the library functions. But so far, for what reason soever, I haven’t found a description on how to integrate the IPL in the project.

Thanks as always ;)

With dinit

After following this thread for a few days, I think this might be a case of jargon getting in the way of understanding. Let me pose a few questions that involved some fundamental functions that must occur to get a system running.

  1. What does the processor do when it is first powered on?
    (jumps to some address, eg. 0xFFFF FFF0)
  2. What is at this address?
    (some persistent code)
  3. Where does this code live, and where does it come from?
    (It might be in a ROM, in which case the motherboard
    manufactorer probably put it there. In this case we
    usually might call it a BIOS or BootROM interchangably.
    A ROM usually has two parts,
    the IPL code, and the BIOS: Basic Input Output System).
    (Alternatively, it might a Flash memory device. In this
    case it might be something you have to write, or you
    might find in a BSP: Board support package).
  4. What does the code at this address do?
    (It’s first job is to set up the system hardware to a
    minimum stable level so that the OS can be loaded.
    For example, sometimes, RAM is not functional yet.
    Setting up PCI devices often happens here too.
    Once this is complete, this code might set up the
    vector table to point at the BIOS (Basic Input Output System) code.
    This BIOS code will simplify the next steps which include
    reading and writing I/O devices.
    Finally, this code has the job starting the OS load.
    That doesn’t mean it actually loads the OS.
    It might first search the hardware for a readable (hard/floppy/flash drive)
    device, and then load either some OS loader code, or the OS itself from the
    readable device. Finally, once either the OS loader code or the OS itself
    is loaded into memory, this code jumps to an address in the code.
    Its even possible that the OS is already in the persistant memory and
    doesn’t need loading because it runs in place. In this case it just needs to be jumped to.
    Note: Once the OS loader or OS itself is loaded, there are other steps that
    must be taken, but this should be fairly automatic given you have an OS loader
    and/or a loadable QNX image.

So now the question is, how does this jargon fit it. I think some may differ with me on this,
be here is my take on it. The definition of the IPL is the code that 0xFFFF FFF0 points at.
What confuses this issue is whether you have to write it or not. Many motherboards will
come with this code on a ROM, along with a BIOS. This simplifies things enourmously.
You might also find this code, or a version close to what you need, in a BSP. The
worst case is you have to write this code yourself, along with your own BIOS to
support loading.

I hope this helps.

To add to mitch’s comment. It’s even possible to NOT have an IPL. If the code is sitting in ROM and not copied in RAM (that’s called XIP; execute in place) then there is no need to load the code from a storage device. In QNX’s jargon the IPL does not mean it sits at 0xffff ffff0. The IPL is a piece of code that loads/decompress the OS image from a storage device to memory and kicks start it. So you might say the BIOS is an IPL but I don’t think in the QNX context that is what it mean

Hi Mario, Hi Maschoen!

I see. So I use dinit to download the image, and dinit to download the IPL.

So either handing over control to a boot loader like lilo or grub, or if none is present, boot the next available and valid drive.

OK, two slightly contradictory positions. So not every IPL sits at the reset vector 0xFFFF FFF0? And on a x86 machine usually the BIOS is at 0xFFFF FFF0, which then hands over control to the IPL.

Regards,
C++

Depends on the type of device and platform. On a PC you use dinit to write the IPL but the image is the .boot file which you can just copy.

It’s not contradictory, it’s different possibility.

On a PC, it’s the BIOS that’s setup the reset vector. On custom made hardware using x86. It would be the IPL or if there is no need to LOAD the image because it’s in a ROM for example, they may not be any IPL at all.