Boot and cross platform applications and using delphi or Pascal

Is it possible to create a boot application (applications for MBR) using Delphi or Pascal (I know that we cannot use vcl, RTL and other components, because they are OS dependent), but I can use at least Readln and writeln.

If it's true !!! Can we run the program under another OS. but I know that the PE (windows) and ELF (Linux) formats are different. but at least with a little modification I can do it.

+6
delphi pascal
source share
3 answers

It is worth saying that PE is a very diverse format than ELF. Not only a few bytes to change ... the entire layout and access to the library are diverse, and the binding is completely different.

To download the Delphi application in console mode, you can put a small DOS system (for example, look at FreeDOS), and then start the Delphi application using, for example, DWPL . DWPL allows you to run your own DOS programs with 32-bit protected mode with Delphi 5-7 using the WDOSX DOS extender as the kernel. I used this in some old hardware with a network adapter, and it worked like a charm. If you are interested, I can post updated DWPL code.

For such purposes, you should take a look at Free Pascal . By nature, you can tune it to any desired goal. There are even various operating system designs written using FPC. See For example Toro or ClassiOS - the latter uses Delphi executables as a source.

Here you can see the Toro boot code and the β€œ main program ” created with it.

But for direct download applications, downloading is not that difficult. The real problem is the hardware level. The BIOS provides very little access to it. For the network layer, you need to take a look at the EtherBoot sites and gain access to low-level network access. but it can take a long time to manually rewrite all of these drivers!

In short: all of these "pure Pascal" OSs are only theoretical, control the console and some low-performance network (simulating a bad network adapter such as NE2000 or such). Thus, these pascal OSs are just proof of concept. REMOVED FROM THE WORKING DECISION! But a very good technological challenge, in all cases, very inspiring.

Why reinvent the wheel? If you need a light and fast system, use your own Linux kernel.

Then use CrossKylix to compile a Delphi application (no user interface) on Linux or even better Free Pascal.

+9
source share

In fact, you do not host "applications" in the MBR.

The entire MBR size is 512 bytes, of which you can only use code 446.

Good luck creating something useful in this, if you don’t even have an OS for delegating functions. Basically, all you can do in the MBR is the location code to start the bootloader.

Here is the MBR disassembly page:

http://www.dewassoc.com/kbase/hard_drives/master_boot_record.htm

+3
source share

Why do you need to write a bootloader?

You can use a ready-made bootloader such as GRUB and load its PE executable.

Of course, this is a very ancient and hairy material, but in the good old days people did it in the form of executable files of the PE format and a DOS expander.

Something else in this century, why not make your own REACTOS boot disk and add your own PE executable written in Delphi to handle the "custom shell"?

You can also (but this will require licensing) use Windows PXE. I think projects like BartPE are likely to fall into the gray face of the legal entity, or at least unlicensed. Thus, a fully MS-free (reactos) solution for a fully autonomous computer for kiosks with ReactOS may be more than what you are looking for.

Can you write your own operating system? your own user interface layer? your own video device drivers? I didn’t think so. So use DOS and TurboPascal, or ReactOS, and the PE executable. Or you can use FreePascal and just build your application on a very lightweight portable Linux kernel and root file system.

+2
source share

All Articles