OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Nov 27, 2021 12:01 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 57 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject: Re: Writing to the screen without BIOS
PostPosted: Sun Oct 03, 2021 11:16 am 
Offline
Member
Member
User avatar

Joined: Mon Sep 21, 2020 9:51 am
Posts: 71
Location: USS Enterprise NCC-1701, Space
I meant a way to implement bitmap fonts without linking separate files.

_________________
USS Enterprise NCC-1701,
Space

Live Long And Prosper


Top
 Profile  
 
 Post subject: Re: Writing to the screen without BIOS
PostPosted: Sun Oct 03, 2021 11:27 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4269
Location: Chichester, UK
Well, you'd have to embed the data for your font in the source file. In this case you don't have to worry about file formats. The whole business of designing the font, defining the data, and writing it to the screen is up to you.

But it seems a lot of effort when so many well designed fonts already exist.


Top
 Profile  
 
 Post subject: Re: Writing to the screen without BIOS
PostPosted: Tue Oct 26, 2021 8:12 am 
Offline
Member
Member
User avatar

Joined: Mon Sep 21, 2020 9:51 am
Posts: 71
Location: USS Enterprise NCC-1701, Space
davmac314 wrote:
That's a low-effort question which requires high-effort answers. How about you start with your own thoughts on the matter, lay out any problems that you can foresee and any possible solutions (even if not complete), outline what background reading you've already done, and ask more specific questions?


My problem is that I don't understand how the tutorial linked the PSF. As soon as I can load a ramdisk, I hope to use TTFs read from it.

Thanks

_________________
USS Enterprise NCC-1701,
Space

Live Long And Prosper


Top
 Profile  
 
 Post subject: Re: Writing to the screen without BIOS
PostPosted: Tue Oct 26, 2021 2:51 pm 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 886
So imagine you have a file font.psf. You run the following:
Code:
objcopy -O elf32-i386 font.psf font.o

adapted to your cross compiler and architecture, of course. Then, link font.o with the kernel. You will have symbols named _font_psf_start and _font_psf_end in your kernel binary to use the font.


Top
 Profile  
 
 Post subject: Re: Writing to the screen without BIOS
PostPosted: Tue Oct 26, 2021 4:48 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 3481
PavelCheckov wrote:
As soon as I can load a ramdisk,

Doesn't your bootloader already load the RAMdisk?

PavelCheckov wrote:
I hope to use TTFs

Are you sure you want a whole TrueType renderer in your kernel?


Top
 Profile  
 
 Post subject: Re: Writing to the screen without BIOS
PostPosted: Tue Oct 26, 2021 6:11 pm 
Offline
Member
Member
User avatar

Joined: Mon Sep 21, 2020 9:51 am
Posts: 71
Location: USS Enterprise NCC-1701, Space
Quote:
Doesn't your bootloader already load the RAMdisk?


I meant a root filesystem, not just an initrd.

Quote:
Are you sure you want a whole TrueType renderer in your kernel?


I was using it as an example: I mean reading a font from my filesystem (probably /usr/share) instead of linking one, like ToaruOS.

_________________
USS Enterprise NCC-1701,
Space

Live Long And Prosper


Last edited by PavelCheckov on Tue Oct 26, 2021 6:23 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Writing to the screen without BIOS
PostPosted: Tue Oct 26, 2021 6:17 pm 
Offline
Member
Member
User avatar

Joined: Mon Sep 21, 2020 9:51 am
Posts: 71
Location: USS Enterprise NCC-1701, Space
Quote:
You will have symbols named _font_psf_start and _font_psf_end in your kernel binary to use the font.


Thats the part I don't understand: the symbols.

_________________
USS Enterprise NCC-1701,
Space

Live Long And Prosper


Top
 Profile  
 
 Post subject: Re: Writing to the screen without BIOS
PostPosted: Tue Oct 26, 2021 7:27 pm 
Offline
Member
Member

Joined: Sun Jun 23, 2019 5:36 pm
Posts: 456
Location: North Dakota, United States
PavelCheckov wrote:
Quote:
Doesn't your bootloader already load the RAMdisk?


I meant a root filesystem, not just an initrd.

Quote:
Are you sure you want a whole TrueType renderer in your kernel?


I was using it as an example: I mean reading a font from my filesystem (probably /usr/share) instead of linking one, like ToaruOS.

That's going to require a lot of work. UEFI will simplify it but if your not using UEFI you've made your life extremely difficult. If your loading the font from your boot loader you'll need to implement a minimal filesystem driver to be able to read files from the filesystem. If you want it loaded in your kernel, you'll have to bring up PCIe and use MMIO to set up, initialize, and read from the disks.

You can get away with something like Tarfs -- that's quite a minimal filesystem and easy to work with. And it would be good as a "bootstrap" filesystem. But either way, its going to require you to write quite a bit of code, particularly if the font isn't linked to your kernel.


Top
 Profile  
 
 Post subject: Re: Writing to the screen without BIOS
PostPosted: Tue Oct 26, 2021 9:12 pm 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 514
PavelCheckov wrote:
I was using it as an example: I mean reading a font from my filesystem (probably /usr/share) instead of linking one, like ToaruOS.

For my kernel (Misaka; just to be clear, ToaruOS had a different kernel up until May of this year, Misaka is a totally new thing), I embed a bitmap font, and I skip all of the silly tricks for "linking" a raw binary by encoding that font as a C source, so it ends up in my kernel binary like any other preinitialized object. It gets used by a framebuffer logging mechanism. The filesystem is not involved in this process.

(My bootloader does the same thing so it can draw text after modesetting)

Ethin wrote:
You can get away with something like Tarfs -- that's quite a minimal filesystem and easy to work with. And it would be good as a "bootstrap" filesystem. But either way, its going to require you to write quite a bit of code, particularly if the font isn't linked to your kernel.

Yep! My current initrds are compressed tarballs, and my current boot process has just the initrd image as a multiboot/multiboot2 "module", so it's loaded by the bootloader alongside the kernel (I used to also load device drivers as modules, kinda like Hurd, but now the essential stuff is directly in my kernel and the less essential stuff is just a file on the ramdisk, loaded by the userspace startup scripts with an "insmod" syscall). Misaka has a rudimentary gzip decompression implementation so it can unpack the compressed image, provide it as ramdisk, mount the ramdisk directly with a read-only "tarfs", and then normally it gets migrated into a more flexible in-memory read-write tmpfs which is what the live CD uses from there.

_________________
toaruos on github | toaruos.org | gitlab | twitter | bim - a text editor


Top
 Profile  
 
 Post subject: Re: Writing to the screen without BIOS
PostPosted: Thu Oct 28, 2021 1:57 pm 
Offline
Member
Member
User avatar

Joined: Mon Sep 21, 2020 9:51 am
Posts: 71
Location: USS Enterprise NCC-1701, Space
@klange I just presumed that was what these were for: https://github.com/klange/toaruos/tree/ ... ype/dejavu

_________________
USS Enterprise NCC-1701,
Space

Live Long And Prosper


Top
 Profile  
 
 Post subject: Re: Writing to the screen without BIOS
PostPosted: Thu Oct 28, 2021 2:05 pm 
Offline
Member
Member

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 886
The link you posted was for user space fonts. Nobody in there right mind would implement a TrueType renederer in kernel, trust me :) .


Top
 Profile  
 
 Post subject: Re: Writing to the screen without BIOS
PostPosted: Thu Oct 28, 2021 11:48 pm 
Offline
Member
Member

Joined: Wed Mar 30, 2011 12:31 am
Posts: 514
PavelCheckov wrote:
@klange I just presumed that was what these were for: https://github.com/klange/toaruos/tree/ ... ype/dejavu

The "base" directory, as you probably guessed, is what becomes the ramdisk. Nothing in my kernel depends on things in the ramdisk, ergo the kernel does not use the TrueType fonts found therein.

TrueType is best kept as far away from your kernel as possible. Implementations of TrueType parsers have been a security plague for decades, notably pwning both the original Xbox and the iPhone.

_________________
toaruos on github | toaruos.org | gitlab | twitter | bim - a text editor


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 57 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group