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.
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.
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).
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>
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>
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>
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.
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)
* 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>
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>
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.
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>
In preparation for removing these addresses from Kbuild configurators,
hardcode these properties.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
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>
In preparation for removing unnecessary variables from Kbuild
configuration options.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>
This does not accomplish anything, and with the new initcall logic,
can be harmlessly removed.
Signed-off-by: Igor Belwon <igor.belwon@mentallysanemainliners.org>