mirror of
https://github.com/ivoszbg/uniLoader.git
synced 2026-08-15 05:18:32 +00:00
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
uniLoader
|
||||
*.o
|
||||
*.gz
|
||||
*.lz4
|
||||
main/*.o
|
||||
arch/*/linker.lds
|
||||
board/*/*.o*
|
||||
|
||||
13
Kconfig
13
Kconfig
@@ -19,6 +19,19 @@ menu "Building options"
|
||||
int "Verbosity of logs"
|
||||
default 7
|
||||
|
||||
config COMPRESS_GZIP
|
||||
bool "Compress the uniLoader image with gzip"
|
||||
default y
|
||||
help
|
||||
Select this if you want to use gzip to compress the final uniLoader image.
|
||||
|
||||
config COMPRESS_LZ4
|
||||
bool "Compress the uniLoader image with lz4"
|
||||
default n
|
||||
help
|
||||
Select this if you want to use lz4 to compress the final uniLoader image.
|
||||
This is required on some new MediaTek devices.
|
||||
|
||||
config EMBED_LINUX
|
||||
bool "Embed linux kernel and device tree"
|
||||
default y
|
||||
|
||||
8
Makefile
8
Makefile
@@ -399,10 +399,18 @@ quiet_cmd_uniloader_objcopy = OBJCOPY $@
|
||||
quiet_cmd_gzip_uniloader = GZIP $@.gz
|
||||
cmd_gzip_uniloader = gzip -c uniLoader > uniLoader.gz
|
||||
|
||||
quiet_cmd_lz4_uniloader = LZ4 $@.lz4
|
||||
cmd_lz4_uniloader = lz4 uniLoader -l -f -q
|
||||
|
||||
uniLoader: $(uniloader-all) arch/$(ARCH)/linker.lds FORCE
|
||||
$(call if_changed,uniloader_link)
|
||||
$(call if_changed,uniloader_objcopy)
|
||||
ifdef CONFIG_COMPRESS_GZIP
|
||||
$(call if_changed,gzip_uniloader)
|
||||
endif
|
||||
ifdef CONFIG_COMPRESS_LZ4
|
||||
$(call if_changed,lz4_uniloader)
|
||||
endif
|
||||
|
||||
# The actual objects are generated when descending,
|
||||
# make sure no implicit rule kicks in
|
||||
|
||||
@@ -21,6 +21,23 @@ menu "Device Support"
|
||||
help
|
||||
Say Y if you want to include support for Pixel 2 XL
|
||||
|
||||
config NOTHING_TETRIS
|
||||
bool "Support for CMF Phone 1"
|
||||
default n
|
||||
depends on MT6878
|
||||
help
|
||||
Say Y if you want to include support for CMF Phone 1
|
||||
|
||||
config NOTHING_TETRIS_DISABLE_WDT
|
||||
bool "Disable the watchdog timer on startup"
|
||||
default y
|
||||
depends on NOTHING_TETRIS
|
||||
help
|
||||
Say Y if you want to disable the watchdog timer on startup
|
||||
on this board. While this is obviously useful for end-users,
|
||||
developers may want to leave this on to avoid holding down
|
||||
the power button every time.
|
||||
|
||||
config QEMU_BOARD_VIRT
|
||||
bool "Support for QEMU virt platform (aarch64)"
|
||||
default n
|
||||
@@ -164,12 +181,14 @@ menu "Device Specific Addresses"
|
||||
|
||||
config PAYLOAD_ENTRY
|
||||
hex "Payload Entry Address"
|
||||
default 0x50000000 if NOTHING_TETRIS
|
||||
default 0x050000000 if SAMSUNG_J4LTE
|
||||
default 0x090000000 if SAMSUNG_J5LTE
|
||||
default 0x60000000 if VOLLA_ALGIZ
|
||||
|
||||
config RAMDISK_ENTRY
|
||||
hex "Ramdisk Entry Address"
|
||||
default 0x40000000 if NOTHING_TETRIS
|
||||
default 0x51100000 if VOLLA_ALGIZ
|
||||
|
||||
config FRAMEBUFFER_BASE
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
lib-$(CONFIG_APPLE_N61AP) += apple/board-n61ap.o
|
||||
lib-$(CONFIG_AMAZON_PW3) += amazon/board-pw3.o
|
||||
lib-$(CONFIG_GOOGLE_TAIMEN) += google/board-taimen.o
|
||||
lib-$(CONFIG_NOTHING_TETRIS) += nothing/board-tetris.o
|
||||
lib-$(CONFIG_QEMU_BOARD_VIRT) += qemu/board-virt.o
|
||||
lib-$(CONFIG_SAMSUNG_A105F) += samsung/board-a105f.o
|
||||
lib-$(CONFIG_SAMSUNG_A127F) += samsung/board-a127f.o
|
||||
|
||||
80
board/nothing/board-tetris.c
Normal file
80
board/nothing/board-tetris.c
Normal file
@@ -0,0 +1,80 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (c) 2025, Igor Belwon <igor.belwon@mentallysanemainliners.org>
|
||||
*/
|
||||
#include <board.h>
|
||||
#include <drivers/framework.h>
|
||||
#include <lib/debug.h>
|
||||
|
||||
#define UART_BASE 0x11001000
|
||||
|
||||
#define UART_LSR_BASE 0x14
|
||||
#define UART_LSR_DR 0x01 /* Data ready */
|
||||
#define UART_LSR_THRE 0x20 /* TX holding register empty */
|
||||
|
||||
#define WDT_BASE 0x1c00a000
|
||||
#define WDT_MODE_KEY 0x22000000
|
||||
#define WDT_MODE_EN (1 << 0)
|
||||
|
||||
void uart_putc(char ch)
|
||||
{
|
||||
/* wait until TX is ready */
|
||||
while (!(readl((void *)(UART_BASE + UART_LSR_BASE)) & UART_LSR_THRE))
|
||||
;
|
||||
|
||||
writel(ch, (void *)UART_BASE); // thr is at offset 0x0, which is just uart_base
|
||||
}
|
||||
|
||||
void uart_puts(const char *s)
|
||||
{
|
||||
while (*s != '\0') {
|
||||
uart_putc(*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
void tetris_disable_wdt(void)
|
||||
{
|
||||
uint32_t reg;
|
||||
|
||||
reg = readl((void*)WDT_BASE);
|
||||
if (reg & WDT_MODE_EN)
|
||||
{
|
||||
reg &= ~WDT_MODE_EN;
|
||||
reg |= WDT_MODE_KEY;
|
||||
writel(reg, (void*)WDT_BASE);
|
||||
printk(KERN_INFO, "%s: disabled watchdog timer.\n", __func__);
|
||||
}
|
||||
else
|
||||
printk(KERN_ERR, "%s: watchdog is already disabled.\n", __func__);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int tetris_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tetris_drv(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tetris_late_init(void)
|
||||
{
|
||||
#ifdef CONFIG_NOTHING_TETRIS_DISABLE_WDT
|
||||
tetris_disable_wdt();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct board_data board_ops = {
|
||||
.name = "cmf-phone-1",
|
||||
.ops = {
|
||||
.early_init = tetris_init,
|
||||
.drivers_init = tetris_drv,
|
||||
.late_init = tetris_late_init,
|
||||
},
|
||||
.quirks = 0
|
||||
};
|
||||
11
configs/tetris_defconfig
Normal file
11
configs/tetris_defconfig
Normal file
@@ -0,0 +1,11 @@
|
||||
CONFIG_POSITION_INDEPENDENT=y
|
||||
# CONFIG_COMPRESS_GZIP is not set
|
||||
CONFIG_COMPRESS_LZ4=y
|
||||
# CONFIG_SIMPLE_FB is not set
|
||||
CONFIG_UART_DEBUG=y
|
||||
CONFIG_MT6878=y
|
||||
CONFIG_NOTHING_TETRIS=y
|
||||
CONFIG_NOTHING_TETRIS_DISABLE_WDT=y
|
||||
CONFIG_TEXT_BASE=0x40000000
|
||||
CONFIG_PAYLOAD_ENTRY=0x60000000
|
||||
CONFIG_RAMDISK_ENTRY=0x51100000
|
||||
@@ -130,6 +130,13 @@ config QUALCOMM
|
||||
help
|
||||
Say Y if your device uses Mediatek MT6877 SoC
|
||||
|
||||
config MT6878
|
||||
bool "Support for Mediatek MT6878"
|
||||
default n
|
||||
select MEDIATEK
|
||||
help
|
||||
Say Y if your device uses Mediatek MT6878 SoC
|
||||
|
||||
config QC32_8916
|
||||
bool "Support for QUALCOMM MSM8916"
|
||||
default n
|
||||
|
||||
Reference in New Issue
Block a user