UEFI FreeBasic programming

General FreeBASIC programming questions.
dasyar
Posts: 361
Joined: Dec 04, 2008 15:31

UEFI FreeBasic programming

Postby dasyar » Apr 06, 2019 13:32

Some of the reading that I have been doing about UEFI, I get the impression that you can write your own program, and it does not have to be an OS, and have it run. Not sure if my interpretation is what it really can do.

I thought we could have a discussion about actual programs, specifically FreeBasic programs that might fit the bill. The part that I cannot figure out is if the programs have to be binary, .bin files, or .efi files or .elf files. I actually saw a "Hello World" example that was written in FASM, but it did not show what type of file it was compiled too. Was it a .bin or a .exe file, not sure on that point.

One of the things that I would like to accomplish is to create a UEFI bootable flash disk, to start with. Maybe a FreeBasic "Hello World" program to be run, on a boot up, from a flash disk. I also recall this format of programming has a memory limit, I think it might be 4MB, not sure.
Tourist Trap
Posts: 2756
Joined: Jun 02, 2015 16:24

Re: UEFI FreeBasic programming

Postby Tourist Trap » Apr 06, 2019 17:47

Hi,

may I ask what is a U.E.F.I ? Sorry for the ignorance :)
Thanks.
jj2007
Posts: 1157
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: UEFI FreeBasic programming

Postby jj2007 » Apr 06, 2019 19:47

Unified Extensible Firmware Interface (and I doubt that FreeBasic can run on a machine that has not yet booted...)
Tourist Trap
Posts: 2756
Joined: Jun 02, 2015 16:24

Re: UEFI FreeBasic programming

Postby Tourist Trap » Apr 07, 2019 12:11

jj2007 wrote:Unified Extensible Firmware Interface (and I doubt that FreeBasic can run on a machine that has not yet booted...)

Thanks a lot. Interesting issue.
dasyar
Posts: 361
Joined: Dec 04, 2008 15:31

Re: UEFI FreeBasic programming

Postby dasyar » Apr 07, 2019 13:49

Probably running FreeBasic in the UEFI, is beyond the scope of this thread. I was thinking more in the line of, creating a program that was compiled by FBC. My initial thoughts were, if FBC creates only .exe files, can those be run by the UEFI.

EFI has been around for awhile now, I think Intel is making the push for UEFI acceptance by everybody.

I thought at first that the only thing that UEFI did was load and run an OS iso, but I think that you can load and run any file that you want. I guess it is the system minutia that I am after.
Jawade
Posts: 224
Joined: Apr 25, 2008 19:13

Re: UEFI FreeBasic programming

Postby Jawade » Apr 08, 2019 13:56

I think that only opcode (machine code is) used at that level. So even an .exe is not possible.
dasyar
Posts: 361
Joined: Dec 04, 2008 15:31

Re: UEFI FreeBasic programming

Postby dasyar » Apr 08, 2019 14:24

As I dig into the UEFI stuff, it is looking like only a binary type file will be dealt with. So, I guess that excludes FBC, since it only produces .exe type files. I do not think that there is an exe2bin program to do such conversions, specifically conversion of FBC produced .exe file.
marcov
Posts: 2750
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: UEFI FreeBasic programming

Postby marcov » Apr 08, 2019 14:43

FBC does not generated binary code. AS and LD do. And AS and LD are target (Linux,Windows,OS X etc) specific.

So you need to find (cross) binutils for the "UEFI" target, and adapt the runtime library for it.
angros47
Posts: 1444
Joined: Jun 21, 2005 19:04

Re: UEFI FreeBasic programming

Postby angros47 » Apr 11, 2019 22:52

jj2007 wrote:(and I doubt that FreeBasic can run on a machine that has not yet booted...)


It actually can: https://wiki.osdev.org/FreeBASIC https://wiki.osdev.org/FreeBasic_Bare_Bones

But it would be almost unusable, since the runtime libraries would not work.
jj2007
Posts: 1157
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: UEFI FreeBasic programming

Postby jj2007 » Apr 12, 2019 2:05

angros47 wrote:the runtime libraries would not work.
That's the point.
angros47
Posts: 1444
Joined: Jun 21, 2005 19:04

Re: UEFI FreeBasic programming

Postby angros47 » Apr 12, 2019 14:54

In theory, the runtime library could be modified to run even in those conditions: it would be necessary to add memory handling (allocations/deallocations), and a rudimentary file system management, at least (basically, the rt library would become what is called a library OS)

In that way, it would be possible to run a Freebasic software with no operating system at all, since the application itself would be a very specialized operating system (it's called unikernel)

The idea of doing something like this in basic is less absurd than it sounds: https://github.com/d99kris/nopeos
dasyar
Posts: 361
Joined: Dec 04, 2008 15:31

Re: UEFI FreeBasic programming

Postby dasyar » Apr 13, 2019 15:05

In that way, it would be possible to run a Freebasic software with no operating system at all, since the application itself would be a very specialized operating system (it's called unikernel)

Hmm, very interesting, you could boot up a computer, and get into a FreeBasic environment? I guess FreeBasic would have to be enhanced with some commands to be able to manipulate the underlying computer hardware. This almost sounds like a pseudo OS, but who wants to go that route? I guess maybe I would.
angros47
Posts: 1444
Joined: Jun 21, 2005 19:04

Re: UEFI FreeBasic programming

Postby angros47 » Apr 13, 2019 18:55

dasyar wrote:I guess FreeBasic would have to be enhanced with some commands to be able to manipulate the underlying computer hardware. This almost sounds like a pseudo OS, but who wants to go that route? I guess maybe I would.


There is no need for commands to manipulate the hardware: most of these "pseudo OS" are supposed to work only in virtual machines. So, there is no need to provide drivers for all existing hardware, but just for the default emulated one. On servers, this solution is used to be able to run each application in a completely isolated and independent space, for security reasons.

Return to “General”

Who is online

Users browsing this forum: No registered users and 5 guests