Commit Graph

37 Commits

Author SHA1 Message Date
Ivaylo Ivanov
04a3e00bd3 drivers: introduce probe-based driver framework
The current drivers/framework.c is useless, as REGISTER_DRIVER() is a macro
that just directly calls the driver probe function. Every board file has to
reference each driver's probe function by name. This was just done to make room
for proper driver probing in the future, where we are now, so implement that.

Make drivers self-register at link time by emitting a struct driver into a
.uniloader_drivers section via DRIVER_REGISTER(). The linker brackets
the section with __drivers_start / __drivers_end symbols.

Boards describe their hardware as a static struct with the format
{ driver_name, plat_data, label }. Remove the drivers_init hook from
struct board_ops as it's no longer necessary.

The drivers probe will now be placed between early_init and splash.
The framework looks up each device's driver_name up in the
linker section and calls probe(plat_data). A failed probe is logged.

Do --whole-archive as well to convince the linker to not drop the drivers
in archived .o files that aren't called outside the archive.

Adopt all boards to use the framework.

All of the changes in this commit are co-dependent on each other, as we're
doing a large change to the ABI.
2026-05-28 00:02:41 +03:00
Ivaylo Ivanov
e71ad3b705 lib: simplefb: make get_font_scale_factor run only if simplefb probed
get_font_scale_factor() unconditionally dereferences fb_info and debug.c's
fb_output() calls get_font_scale_factor() on each printk call, even before
we have simplefb registered. As __simplefb_raw_print has a check if we're
past simplefb probe (fb_info is filled), do the same for get_font_scale_factor()
and return 1 (not scaled) if the struct is not filled.
2026-05-28 00:01:44 +03:00
Ivaylo Ivanov
3c90e2b35f lib: simplefb: name the text top-padding constant
The value 5 appeared bare in two places: simplefb.c (when text wraps
past the bottom of the screen) and debug.c (initial y position for
the printk overlay). Replace both with FB_TEXT_TOP_PADDING defined
once in simplefb.h.
2026-05-28 00:01:44 +03:00
Ivaylo Ivanov
4b386dc15c lib: simplefb: drop redundant variable in scale calculation 2026-05-28 00:01:44 +03:00
Umer Uddin
6f3a9597f5 simplefb: Introduce ABGR8888
ABGR8888 is a commonly used framebuffer format, and used by p682lpn and vita boards.

Signed-off-by: Umer Uddin <umer.uddin@mentallysanemainliners.org>
2026-05-27 13:09:52 +03:00
Umer Uddin
29cc5c639b simplefb: Fix write order of pixels for FB_FORMAT_BGRA8888
Fixes an issue where pixel data is stored as ABGR, not BGRA

Signed-off-by: Umer Uddin <umer.uddin@mentallysanemainliners.org>
2026-05-27 13:09:52 +03:00
Akari Tsuyukusa
f41400cbdc lib: simplefb: Add RGB565 format support
Signed-off-by: Akari Tsuyukusa <akkun11.open@gmail.com>
2026-05-24 10:10:37 +02:00
tildeguy
4c41a44b62 lib: simplefb: allow boards to override font scale
Make it possible to set font scale via video_info struct,
as a dynamic font scale may be slightly too big on some screens.
2026-02-21 11:16:21 +01:00
Ivaylo Ivanov
a8428f37d6 lib: provide aeabi stubs to satisfy compiler on armv7
The framebuffer scaling code was not tested on armv7 due to no
current platforms making use of simplefb. Turns out the compiler
wants a set of aeabi helpers for divisions, not present due to
the bare metal nature of the bootloader. Satisfy this with empty
stubs.
2025-12-28 17:33:25 +01:00
vipoll
918e08f85d libfdt: use C memmove/memcpy instead of ASM to avoid rebooting
asm memmove() and memcpy() are not reliable yet,
so just use the C analogues for now
2025-11-03 21:30:37 +02:00
vipoll
266fb485dd drivers: introduce ramdisk-handler (adds linux,initrd-start/end at boot time) 2025-11-03 21:30:37 +02:00
vipoll
f4a3e966b5 import libfdt from Linux v6.18-rc2-3080-g6474677ce915 2025-11-03 21:30:37 +02:00
Igor Belwon
b7e9edeae9 lib: debug: remove cyan color
This is never used. And produces a build warning. It may be added later
if necessary.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Ivaylo Ivanov
1b07caaea4 lib: simplefb: calculate font scaling factor dynamically
Instead of hardcoding it to 2 for all devices, scale it dynamically
per device width and height.
2025-08-07 13:13:05 +03:00
Ivaylo Ivanov
5f0cca1951 lib: simplefb: return on a null fb_info
This should avoid cases where fb_info struct is not populated.
2025-08-07 11:36:45 +03:00
Ivaylo Ivanov
aa0163f2a5 lib: simplefb: drop passing fb base via func args
As we can make use of the video_info struct for base address,
this argument is not required anymore and only breaks havoc on
boards that don't set the CONFIG option.
2025-08-07 11:09:29 +03:00
Ivaylo Ivanov
579bbfa393 lib: break ABI by reworking simplefb and then fix it
Jokes aside, commit adds support for colored indexes based on the
loglevel, introduces a better simplefb probing that does not depend
on hardcoded config options. Implementing support for fdt should be
easier now.
2025-07-11 13:45:58 +03:00
Ivaylo Ivanov
280972aec2 lib: debug: add printf functionality with nanoprintf
Add the respectively required definitions in unic.
2025-07-08 19:02:39 +03:00
Ivaylo Ivanov
8dc27cc402 board: introduce Amazon Kindle PW3 support
With support for this board also come the following changes:
- rework blobs handling to get past the 0 size bug
- basic cpu "set up" in start.S
- assembly memcpy
- uart debugging
2025-07-08 15:54:02 +03:00
Ivaylo Ivanov
eba7aec49d drivers: samsung: Introduce exynos-speedy
Speedy is a serial communication bus that is typically used in
Exynos SoC devices for communicating with a PMIC. Implement
basic support for it, as well as add its first user - s2mps17 in
board-dreamlte.

Also, while at it, implement a simple readl function.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-10-28 15:09:59 +02:00
Ivaylo Ivanov
9c60b66f71 AARCH64: Allow for embedding an initramfs
This actually breaks the armv7 port. It has to be revisited in the
future, since it not only is not compilable right now, but also
cannot boot linux properly. TODO

Also introduce a new C-based __memcpy_optimized that does not
cause an exception on some devices when copying the initramfs.
This issue has to be debugged further.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-10-12 19:43:05 +03:00
Ivaylo Ivanov
2de1d3c549 lib: video: Drop font.c temporarely
Since we're practically PIC, keep the massive array in the header.
Otherwise we exception.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-10-10 16:49:09 +03:00
Ivaylo Ivanov
a244bad67f lib: Completely drop neatlibc
It's of no use anymore, we have our own libc.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-10-10 16:38:42 +03:00
Ivaylo Ivanov
3b517ba95a lib: debug: Introduce loglevels + many minor changes
Implement 8 loglevels to use with printk:

While at it, separate the font in a new "video" directory, which
also makes space for a proper video probing implementation. Fill
in the font from 32 to 256. Scale the font to render twice as big.
Implement dynamic line length detection. Change a few things here
and there to follow the linux kernel code style. Add a nice logo.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-10-10 16:24:20 +03:00
Ivaylo Ivanov
be0ad76a97 lib: unic: Implement strcat
Also fix-up the strncpy func.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-10-10 16:21:48 +03:00
Ivaylo Ivanov
784bfd609a lib: unic: Optimize memcpy and memset for aarch64
Move onto using asmdefs macros in assembly files. Implement an
assembly-based memcpy for aarch64 and a C-optimized memset, while
also making place for replacing functions with more optimized ones
in the future.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-10-09 18:49:23 +03:00
Ivaylo Ivanov
81d26edaa3 uniLoader: Mass rework
arch: aarch64: Load addresses via page + offset
arch: aarch64: Align the TEXT region
drivers: Introduce an empty framework
board: Rework to be PIC

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-10-08 21:22:21 +03:00
Ivaylo Ivanov
69c7156eb3 lib: simplefb: simplify cleaning framebuffer
Pretty self-explanatory, it's faster as well.

Suggested-by: Umer Uddin <umer.uddin@mentallysanemainliners.org>
Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-09-24 22:18:52 +03:00
Ivaylo Ivanov
3ab64bed39 lib: Introduce unic
unic is a small library of C functions that is currently written
in plain C. It's purpose isn't to be fast, but "universal" - as
in include as little architecture-specific code as possible.

The old neatlibc still resides, but isn't being built. There is
still more to do, including implementation of memory management,
so keep it there for now.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-09-23 20:17:44 +03:00
Ivaylo Ivanov
4a0977b0f6 lib: Replace the broken newlib implementation with neatlibc
Make 2 different folders for armv7 and aarch64 assembly neatlibc
functions. Add the neatlibc submodule, make it work against the
Makefile system. Pray.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-08-06 13:25:07 +03:00
predefine
61bb21275c add BGRA support 2023-11-10 23:06:34 +07:00
Ivaylo Ivanov
ed246836e9 lib: simplefb: Add support for RGB888 24bpp (dependant on the stride)
Also comes with small changes here and there.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2023-07-24 09:54:16 +03:00
Ivaylo Ivanov
a1be36ae02 EXPERIMENTAL: Partially implement NewLib
Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2023-07-19 19:37:17 +03:00
Ivaylo Ivanov
ed98b5d900 .: Multiple changes
arch: Implement ARM32 support
soc: Implement ARM32 support for MSM8916
board: Implement ARM32 support for Samsung Galaxy J5 2015
include: main: Revert built-in memcpy, rearrange and add support for writel
lib: simplefb: Make the clear screen function usable

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
Cc: Efim Girjeu <efimgirjeu@gmail.com>
2023-07-18 14:41:37 +03:00
ivoszbg
c038c7839c lib: Move debug print function into a separate file
Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2022-06-14 19:51:51 +03:00
ivoszbg
fd8ed2d1b8 uniLoader: Migrate to kconfig based configurations
Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2022-06-14 18:02:47 +03:00
ivoszbg
e364dfbc1b lib: Implement simplefb driver for framebuffer management
Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2022-06-13 21:43:45 +03:00