Commit Graph

115 Commits

Author SHA1 Message Date
Ivaylo Ivanov
fe3d42d892 board: pw3/taimen/tetris/virt/blossom/camellia: guard uart code to optimize build size 2026-05-28 16:44:43 +03:00
Ivaylo Ivanov
f64363519d lib: de-hardcode output sinks and register them as console interfaces
For a while now, both simple-framebuffer and uart were hard-wired to
the debug library. You could alternate between each or have both running,
but the implementation was really ugly - ifdefs based on whether uart/simplefb
are compiled in or not.

As uniLoader has advanced enough to feature a sane-ish probing system for
drivers, we can start experimenting with things like:
- multiple framebuffers / UART devices
- support for more complex peripherals (USB, storage)
- multiple boot paths

Hence registering output sinks as console devices, just like how u-boot and
linux do, is a feature we should've had a long while ago. So let's begin working
on that by decoupling framebuffer and uart from the "debug" interface in uni and
rather allowing the registering of such sinks as "console" devices.

With that, make the simple-framebuffer driver handle the debug level colors as
well as the message assembling and writing to the framebuffer. That fully detaches
it from the debug interface, as all that is required now is to invoke console_register()
with the appropriate struct passed as an argument.

As the drivers for output sinks are now responsible for the formatting of the messages,
their set-up and writing, UART can be implemented as a sole driver as well. However,
drivers register late in the boot process (after assembly, board early_initand other
drivers with higher priority). With that in mind and all the leftover UART puts/c code in
board files for several of the currently supported devices, introduce an early console
path dedicated for debugging via UART.

Looking at the currently supported devices, the only one requiring set-up before
being able to output to UART is lucky7. For ease of use, make early_console_init
weak, allowing it to be overrided by board files such as board-lucky7.

Lastly, debug -> console, as that more correctly addresses the purpose of the library
now.
2026-05-28 15:57:55 +03:00
Ivaylo Ivanov
31f118c73a 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 10:12:51 +03:00
Ivaylo Ivanov
94e4b696a6 board: include string.h directly for boards that use its functions
Several boards call readl()/writel() or use uint32_t but do not include
<string.h> (which is where unic declares these). They build today only
because <drivers/framework.h> pulls <string.h> in.

The framework header has no business pulling string.h; Include it properly
in case we remove framework.h later on (spoiler lol).
2026-05-28 10:12:51 +03:00
Ivaylo Ivanov
6e0c18ae24 board: Add support for Sony Xperia XZ1 Compact
Framebuffer worked first try, unlike taimen.
2026-05-27 17:26:32 +02:00
Umer Uddin
673a070d36 board: samsung: j4lte: Migrate FB format to ARGB8888
This is the correct format considering commit 61bb212.

Signed-off-by: Umer Uddin <umer.uddin@mentallysanemainliners.org>
2026-05-27 13:09:52 +03:00
Umer Uddin
fe084d4afe boards: sony: board-vita: Migrate FB format to ABGR8888
This is the correct format considering the BGRA write format was wrong before, leading it to actually use ABGR.

Signed-off-by: Umer Uddin <umer.uddin@mentallysanemainliners.org>
2026-05-27 13:09:52 +03:00
Umer Uddin
baaf7d1204 boards: itel: board-p682lpn: Migrate FB format to ABGR8888
This is the correct format considering the BGRA write format was wrong before, leading it to actually use ABGR.

Signed-off-by: Umer Uddin <umer.uddin@mentallysanemainliners.org>
2026-05-27 13:09:52 +03:00
Akari Tsuyukusa
6ded1cbd44 board: Add support for Blackview Tab 15 Pro
Signed-off-by: Akari Tsuyukusa <akkun11.open@gmail.com>
2026-05-24 10:10:37 +02:00
Aiden Isik
6a249a0952 board: lucky7: Add support for UART over USB 2026-05-22 10:05:37 +02:00
Igor Belwon
72226d6b20 board: Add support for Sony Xperia 1 VI (pdx245)
Xperia 1 VI is a flagship phone manufactured by Sony, based on the
Qualcomm Snapdragon 8 Gen 3 Mobile Platform.

Add support for this board.

NOTE: This board is new, and as such, it requires some ugly hax and
a fallback boot method to boot any sort of [u-boot/uniLoader/mainline]
In short:
- build:
  - ARCH=aarch64 CROSS_COMPILE=aarch64-linux-gnu- make -j32
  - cat uniLoader.gz dummy.dtb > uni.dtb
  - mkbootimg --kernel uni.dtb --ramdisk <some ramdisk (required)> \
    --pagesize 4096 --base 0x0 --kernel_offset 0x8000 \
    --ramdisk_offset 0x1000000 --tags_offset 0x100 \
    --dtb_offset 0x1f00000 --header_version 0 --os_version 16.0.0 \
    --os_patch_level 2026-04 -o boot.img
    (yes, all properties are required.)
- prepare device:
 - boot to fastboot mode (volume up and plug in USB)
 - fastboot erase dtbo erase vendor_boot
- flash:
 - fastboot flash boot boot.img continue

Where:
 - dummy.dtb is a skeleton.dtsi with a reserved memory node called
   splash_region as a child of the chosen node.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2026-05-15 00:37:13 +03:00
Igor Belwon
9a497231bb board: Fix a3xelte formatting
We all hate spaces as indentation :/
2026-05-15 00:37:13 +03:00
Ivaylo Ivanov
732d6f30b9 board: add support for Motorola Edge 30 Fusion
Add basic support for Motorola tundra, usable to boot mainline Linux.
UniLoader has to be packaged with mkbootimg (header_version 3), as it
acts as a wrapper for the kernel image and tree.
2026-05-11 22:04:15 +02:00
Igor Belwon
84bc0d3d74 board: Add support for the Sony PlayStation Vita
This commit adds support for the PSVita 1xxx/2xxx variants, which have:
 - 4x Cortex A9
 - OLED/LCD display (both types get init. by libbaremetal before)
 - 512MB RAM (ew)
 - Some PowerVR custom GPU (ew)
2026-05-05 00:14:25 +03:00
Igor Belwon
93d43c3a82 board: Add support for Lenovo Idea Tab Pro
* Needs to be unlocked via an exploit
* mkbootimg --kernel uniLoader.lz4 --header_version 4 --out boot.img
* Has very slow fastboot (usb 1.1 speeds slow), so flashing via the
  SoC flash mode or fastbootd is recommended
* fastboot flash boot boot.img reboot

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2026-05-01 14:30:38 +03:00
faveoled
63319a14bd board: Add support for Realme C35 2026-04-27 14:49:39 +02:00
Spyware_Hunter
c9439e7bba board: Correct codenames for some Samsung devices and minor text changes 2026-04-27 13:00:24 +02:00
Aiden Isik
9ae8d18028 board: Add support for Samsung Galaxy Watch FE
Adds the initial support for Samsung Galaxy Watch FE (lucky7).
2026-04-21 16:33:50 +02:00
Igor Belwon
314f2addeb board: fix main.h header 2026-02-23 23:02:53 +02:00
tildeguy
e69eba1d89 board: add support for Huawei Mediapad T5
Adds the initial support for Huawei Mediapad T5 (agassi2) and Hi6250-based devices.
2026-02-21 11:16:21 +01:00
faveoled
c4d3f6490e board: add support for Samsung Galaxy S10 2026-02-07 09:34:05 +02:00
evilMyQueen
f60112e4b6 board: Order every board properly
This commit orders every board firstly in ascending numerical order
and then in alphabetical order of letters.
Also adds missing CONFIG_SAMSUNG_A336B to board/Makefile

Signed-off-by: evilMyQueen <evilMyQueen@mainlining.org>
2026-01-13 14:03:51 +02:00
evilMyQueen
65de257b2c board: add support for Infinix Note 30 VIP
Signed-off-by: evilMyQueen <evilMyQueen@mainlining.org>
2026-01-04 10:51:14 +02:00
faveoled
cf4c76be24 board: add support for Samsung Galaxy A30 2026-01-02 11:11:03 +02:00
Ivaylo Ivanov
6cd8dfd0d0 board: samsung-j5lte: cast mmio addresses in writel's
Fix build errors for j5lte by casting mmio addresses in writel's. While
at it, do some quality of life changes, like moving entry addresses out
of board/Kconfig into the j5lte defconfig and setting LINUX_KRNL_HEADER_IMG.
2025-12-28 17:33:25 +01:00
vipoll
6d1c7a9dc9 board: samsung-herolte: fix incorrect framebuffer height 2025-12-28 14:39:35 +02:00
RadGoodNow
81f7b06b81 board: Add support for itel Vision 3 Plus
Signed-off-by: RadGoodNow <81907382+RadGoodNow@users.noreply.github.com>
2025-12-28 13:22:41 +01:00
evilMyQueen
424b351dfc board: introduce support for Xiaomi Poco M3 Pro 5G
Signed-off-by: evilMyQueen <vernamjap@gmail.com>
2025-10-20 17:25:56 +03:00
evilMyQueen
b6635ab77d board: introduce support for xiaomi blossom devices
Signed-off-by: evilMyQueen <vernamjap@gmail.com>
2025-10-17 22:50:51 +02:00
predefine
b80aaacaff board: introduce support for Xiaomi Redmi Note 8 Pro
Signed-off-by: predefine <predefine@yandex.ru>
2025-10-04 13:56:49 +03:00
Eric Gonçalves
6557f34c66 board: Add support for the Samsung Galaxy S22 2025-10-03 17:36:36 +03:00
Igor Belwon
22ee49a6cf board: Remove framebuffer properties
These properties are board specific, and were already moved to board
files. As such, remove these leftovers.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 22:17:28 +03:00
Igor Belwon
209066181c board: apple-n61ap: Hardcode framebuffer addresses
In preparation for removing these addresses from Kbuild configurators,
hardcode these properties.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 22:17:28 +03:00
Igor Belwon
6169f70a77 board: google-taimen: Remove framebuffer property
This does not work anyway, and may cause memory writes to protected
locations (as FRAMEBUFFER_BASE=0x0)

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 22:17:28 +03:00
Igor Belwon
305245a298 board: samsung: Hardcode framebuffer variables
In preparation for removing unnecessary variables from Kbuild
configuration options.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 22:17:28 +03:00
Igor Belwon
24c29ee8bf board: Fix samsung-r8s formatting
Replace spaces with tabs.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 22:17:28 +03:00
Igor Belwon
4cca1ce703 board: volla-algiz: Remove stub init functions
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Igor Belwon
e91301ee42 board: nothing-tetris: Remove stub init functions
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Igor Belwon
1a54ea51c9 board: nokia-essential: Remove stub init function
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Igor Belwon
9cd53a91eb board: google-taimen: Remove stub init functions
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Igor Belwon
66baf5f889 board: apple-n61ap: Remove stub init functions
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Igor Belwon
66f28ccbfb board: amazon-pw3: Remove stub init functions
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Igor Belwon
dd4009796f board: samsung-zeroflte: Remove stub init function
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Igor Belwon
db32feefde board: samsung-x1s: Remove stub init function
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Igor Belwon
86a2d04a8d board: samsung-starlte: Remove stub init function
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Igor Belwon
45a7056e08 board: samsung-r8s: Remove stub init function
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Igor Belwon
ea8ec1bece board: samsung-jackpotlte: Remove stub init function
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Igor Belwon
5cf2f4b238 board: samsung-j5lte: Remove stub init function
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Igor Belwon
5f049665e0 board: samsung-j4lte: Remove stub init function
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00
Igor Belwon
9da1dd8de1 board: samsung-herolte: Remove stub init function
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.

Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
2025-10-01 20:02:15 +02:00