241 Commits

Author SHA1 Message Date
oboev
bf92aced28 board: add support for OnePlus 13r (giulia) 2026-08-09 21:17:30 +02:00
Oleksii Onchul
97750e5eaf board: starlte: Fix framebuffer configuration 2026-08-09 20:56:16 +03:00
tildeguy
93a3b8050d board: agassi2: disable watchdog 2026-07-27 12:30:41 +02:00
tildeguy
e4632a85ab configs: agassi2: fix kernel address 2026-07-27 12:30:41 +02:00
Thomas Turner
347589d10d board: Add support for Samsung Galaxy A21s
Signed-off-by: Thomas Turner <tturner@lineageos.org>
2026-07-26 20:08:34 +02:00
v1-727
27f27163a5 board: Add support for ZTE nubia Neo 2 5G (pine)
pine: fix scale
2026-07-25 10:33:41 +02:00
Ryo evilMyQueen Yamada
5bb3813027 board: Add support for Xiaomi Moon devices
Signed-off-by: Ryo "evilMyQueen" Yamada <evilMyQueen@mainlining.org>
2026-07-25 11:25:11 +03:00
Umer Uddin
8345d226c8 board: xiaomi: board-begonia: Override font scale in simplefb
Precalculated one is too big and ascii art gets smushed.

Signed-off-by: Umer Uddin <umer.uddin@mentallysanemainliners.org>
2026-07-25 11:16:32 +03:00
Umer Uddin
6bf258f6ae configs: Add begonia defconfig
Not sure why this was never pushed and how the pr adding support for begonia was accepted without this.

Signed-off-by: Umer Uddin <umer.uddin@mentallysanemainliners.org>
2026-07-25 11:16:32 +03:00
Ryo evilMyQueen Yamada
43770a0432 README.md: Remove the supported devices section
Signed-off-by: Ryo "evilMyQueen Yamada" <evilMyQueen@mainlining.org>
2026-07-08 17:51:46 +02:00
Ryo evilMyQueen Yamada
a530f0aadb board-blossom.c: Add missing license and copyright headers
Signed-off-by: Ryo "evilMyQueen" Yamada <evilMyQueen@mainlining.org>
2026-07-08 17:51:46 +02:00
Ryo evilMyQueen Yamada
676c000d11 board/Kconfig: Rearrange in alphabetical order
Signed-off-by: Ryo "evilMyQueen" Yamada <evilMyQueen@mainlining.org>
2026-07-08 17:51:46 +02:00
Ryo evilMyQueen Yamada
831c31bac9 board: Add support for Tecno Pova 6 (li7)
Signed-off-by: Ryo "evilMyQueen" Yamada <evilMyQueen@mainlining.org>
2026-07-06 11:06:23 +03:00
Akari Tsuyukusa
9930786561 board: add Amazon Echo Show 5 (1st gen)
Signed-off-by: Akari Tsuyukusa <akkun11.open@gmail.com>
2026-07-06 11:04:37 +03:00
Alexandru Chimac
4575423c4f essential: Enable MCUSYS and CPUXGPT
Signed-off-by: Alexandru Chimac <alex@chimac.ro>
2026-07-06 11:03:28 +03:00
Alexandru Chimac
e3bfa5e08d drivers: Add driver for MediaTek CPUXGPT timers
On some MediaTek platforms, the cores' System Timers aren't initialized
corectly by TEE, so we need to enable them manually, otherwise CNTVCT_EL0
will return 0, and any delay function will generate an infinite loop.

Based on [1].

[1]: https://patchwork.kernel.org/project/linux-mediatek/patch/20220509210741.12020-3-angelogioacchino.delregno@collabora.com/

Signed-off-by: Alexandru Chimac <alex@chimac.ro>
2026-07-06 11:03:28 +03:00
Alexandru Chimac
95b9784272 drivers: Add helper functions for MediaTek MCUSYS
Signed-off-by: Alexandru Chimac <alex@chimac.ro>
2026-07-06 11:03:28 +03:00
Ryo evilMyQueen Yamada
715358847e board: Add support for Nothing Phone (1) (spacewar)
Signed-off-by: Ryo "evilMyQueen" Yamada <evilMyQueen@mainlining.org>
2026-06-28 12:07:20 +02:00
Igor Belwon
34f294cdd9 board: Add support for Xiaomi 17 Ultra (nezha)
Header version V4. Gunyah. Snapdragon 8 Elite Gen5. Xiaomeme.

```
make -j32 nezha_defconfig
make -j32
mkbootimg --kernel uniLoader.gz --header_version 4 --out uniBoot.img
fastboot boot uniBoot.img
```
2026-06-22 22:28:40 +03:00
Igor Belwon
88db4b53c0 soc: Add support for Snapdragon 8 Elite Gen 5 (SM8850/canoe/kaanapali) 2026-06-22 22:28:40 +03:00
int4_t
c67e8ad9d2 board: add support for nothing phone (2)
Co-authored-by: user0-07161 <user0thenyancat@proton.me>

board-pong: add video scale

add copyright

sort alphabetically
2026-06-17 22:59:36 +02:00
Igor Belwon
4d7f618ed3 pdx245: support for boot image header v4
NOTE 1: needs os_version and os_patch_level even if it is header-4
NOTE 2: will not boot a kernel due to gunyah. gets to psci setup,
        then hangs.
2026-05-29 23:13:04 +03:00
Ivaylo Ivanov
bcec9ef385 lib: CONFIG_UART_DEBUG -> CONFIG_EARLYCON
Better reflects its purpose now. Done with:
$ rg -l '\bCONFIG_UART_DEBUG\b' | xargs sed -i 's/\bCONFIG_UART_DEBUG\b/CONFIG_EARLYCON/g'

..and then manually edited the Kconfig entry.
2026-05-28 22:05:30 +02:00
Ivaylo Ivanov
d712a206bb arm: start: set sp to stack_bottom instead of stack_top
For conveniency, stack_bottom points to the end of the stack region in the
linker file as it grows backwards on arm:

	.stack ALIGN(0x1000) : {
		__stack_top = .;
		. += 0x1000;
		__stack_bottom = .;
	}

However, we have somehow missed that and STILL made sp point to __stack_top,
which makes it grow backwards into .bss... oops, lol. Tested on qemu-virt set
to use cortex-a15.
2026-05-28 22:05:30 +02:00
Ivaylo Ivanov
c509adb742 board: pw3/taimen/tetris/virt/blossom/camellia: guard uart code to optimize build size 2026-05-28 19:12:01 +02:00
Ivaylo Ivanov
34fe1d6689 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 19:12:01 +02: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
963bec5198 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 10:12:51 +03:00
Ivaylo Ivanov
ce1a97e2e9 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 10:12:51 +03:00
Ivaylo Ivanov
0887508877 lib: simplefb: drop redundant variable in scale calculation 2026-05-28 10:12:51 +03:00
Ivaylo Ivanov
3f4eb1b319 arch: discard runtime-unused metadata sections
The toolchain emits several sections that have no meaning for a flat
binary bootloader:

  .eh_frame             DWARF unwind tables (we never unwind)
  .note.gnu.property    BTI/PAC ELF markers (lost at objcopy)
  .note.gnu.build-id    debug identity (lost at objcopy)
  .comment              compiler version string
  .ARM.attributes       ABI metadata

Gcc emits roughly 7-8 KB of .eh_frame by default for a build of this
size; the others are smaller but equally pointless. Just drop all of
them in the linker scripts.

Net effect on dreamlte_defconfig w/ empty embedded blobs:
61960 -> ~54000 bytes. Stonks.
2026-05-28 10:12:51 +03:00
Ivaylo Ivanov
dab24eacef arch: aarch64: align .{rodata,data,bss} to 8 bytes
ALIGN(4) is left over from 32-bit linker script templates. On
aarch64 the natural pointer/long alignment is 8, and these sections
usually contain 64-bit constants (pointer tables, 64-bit literals). The
4-byte alignment was harmless because the linker happens to align
individual symbols anyway, but let's just align it properly for the
sake of correctness. For BSS also ensure we have extra padding before
the end of the section.
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
Ivaylo Ivanov
56f8caa1fa arch: aarch64: Fix up the Linux kernel image header
The current header implementation is incomplete: the text_offset and
image_size slots are overlaid with internal relocation metadata
(_rel_stack_base / _rel_stack_size), and the flags field is zero,
which makes some bootloaders unhappy. Fill up the the missing props and
while at it, stub out the image header into a header file to avoid duplicating.

image_size is computed in the linker script as _stack_end - _start
so the early stack page is included in the runtime memory footprint
advertised to the previous-stage bootloader.

Patch inspired by work from @Trijal08 and cleaned up to not account for
ELF PiE.
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
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
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
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
Akari Tsuyukusa
055ec0fab5 project: Add Clang/LLVM support
Makefile:
Add Clang/LLVM toolchain support

README.md:
Add Clang/LLVM build examples

start.S:
Fix compile error in Clang

```
  AS      arch/aarch64/start.o
/tmp/start-ebf313.s:22:9: error: invalid fixup for movz/movk instruction
 mov x1,_start
        ^
make[1]: *** [scripts/Makefile.build:194: arch/aarch64/start.o] Error 1
```

Signed-off-by: Akari Tsuyukusa <akkun11.open@gmail.com>
2026-05-24 10:10:37 +02:00
Aiden Isik
7a2c9a33c9 configs: lucky7: Enable UART 2026-05-22 10:05: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
Igor Belwon
dd06b21b60 soc: Add support for Snapdragon 8 Gen 3 (SM8650/pineapple/lanai) 2026-05-15 00:37:13 +03:00
Aiden Isik
6ae4e8084f main: Pass address of address of DTB to patch_dtb
Pass the address of the address of the DTB to patch_dtb in boot.c, rather than just the address to the DTB.
This allows the modified DTB address to overwrite the address of the original DTB, fixing a bug where
the ramdisk address was not being passed to the kernel via the DTB successfully.
2026-05-14 21:03:32 +02:00
Ivaylo Ivanov
3e61800372 lib: nanoprintf: let the compiler use division instructions for divmod
Due to divmod performing division by subtracting in a linear loop,
it's *really* slow. When performing division with larger numbers (like
32-bit addresses), it goes thru massive amounts of iterations and causes
a stall-like appearance.

Instead, let the compiler handle it by using cpu instructions like
UDIV/MSUB for armv8.

Fixes #86.
2026-05-12 15:33:16 +03:00