Compare commits

...

2 Commits

Author SHA1 Message Date
Ivaylo Ivanov
b37e225721 arch: arm: Implement TEXT_BASE instead of using a hardcoded address
This was an issue for other armv7 boards that have slightly different
addresses till now. This also allows to start working on relocation
in the near future for both armv7 and aarch64.

While we're at it, fix some mistakes here and there.

Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-08-06 11:12:31 +03:00
Ivaylo Ivanov
1b6ce821f7 README: Rework it according to the totally-recent build changes
Signed-off-by: Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
2024-08-06 10:33:38 +03:00
6 changed files with 82 additions and 37 deletions

View File

@ -103,6 +103,7 @@ export srctree objtree VPATH
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
KERNEL_PATH ?= $(CONFIG_KERNEL_PATH:"%"=%)
DT_PATH ?= $(CONFIG_DT_PATH:"%"=%)
TEXT_BASE ?= $(CONFIG_TEXT_BASE:"%"=%)
KCONFIG_CONFIG ?= .config
export KCONFIG_CONFIG
@ -360,7 +361,7 @@ quiet_cmd_uniLoader = LD $@.o
cmd_uniLoader = $(LD) $(main-y) $(uniLoader-libs) -o $@.o --script=arch/$(ARCH)/linker.lds
arch/$(ARCH)/linker.lds: arch/$(ARCH)/linker.lds.S $(KERNEL_PATH)
$(CPP) $< -DKERNEL_PATH=$(KERNEL_PATH) -DDTB_PATH=$(DT_PATH) -P -o $@
$(CPP) $< -DTEXT_BASE=$(TEXT_BASE) -DKERNEL_PATH=$(KERNEL_PATH) -DDTB_PATH=$(DT_PATH) -P -o $@
uniLoader: $(uniLoader-all)
$(call if_changed,uniLoader)

View File

@ -1,25 +1,61 @@
# uniLoader
A simple secondary bootloader that is capable of loading Linux for Android and iOS based devices.
A secondary bootloader that is capable of loading the upstream Linux kernel for Android and iOS-based devices.</br></br>
The purpose behind it is to provide a small shim for avoiding vendor bootloader quirks.</br>
> (ex.: some newer Exynos phones leave decon framebuffer refreshing disabled right before jumping to kernel, which makes initial debugging efforts when bringing up the platform to upstream linux hard)</br>
The currently supported architectures are ARMV7 and AARCH64.</br>
## Preparation
1. Install a toolchain that matches your target architecture (ex. AArch64 cross-toolchain):
```sh
sudo apt install aarch64-linux-gnu
```
2. Clone the repository:
```sh
git clone https://github.com/ivoszbg/uniLoader
```
3. Navigate to the project directory:
```sh
cd uniLoader
```
4. Place your kernel and device tree blobs under the `blob/` directory.
### Make Syntax
```sh
make ARCH=<arch> CROSS_COMPILE=<toolchain>
```
### Building Example
```sh
sudo apt install aarch64-linux-gnu
git clone https://github.com/ivoszbg/uniLoader
cd uniLoader
cp /home/user/linux/arch/arm64/boot/Image blob/Image
cp /home/user/linux/arch/arm64/boot/dts/exynos/exynos8895-dreamlte.dtb blob/dtb
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j4 dreamlte_defconfig
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j4
```
### Usage
```sh
For Apple devices: Load the generated uniLoader binary via PongoOS.
For Android devices: Replace the Linux kernel in your boot.img with the uniLoader binary.
```
### TODO LIST
1. [C] Allow loading instead of PongoOS for Apple devices;
2. [C] Fix/replace the libc implementation;
3. [M] Implement a serial library and make the debug lib less hacky;
4. [M] Implement more features:
> New devices</br>
> Boot menu with countdown timer and selectable items via GPIO volume keys</br>
> Threaded execution
<h6>
[C] = Critical for overall ease of use and functionality</br>
[M] = Nice to have :)
</h6>
### License
# Building
1. Install aarch64-linux-gnu
2. ```git clone https://github.com/ivoszbg/uniLoader```
3. ```cd uniLoader```
4. Place your kernel and device tree blobs under blob/
5. ```make BOARD=(oem)-(board-codename) SOC=(device-soc)```<br />
# Building example
```sudo apt install aarch64-linux-gnu```<br />
```git clone https://github.com/ivoszbg/uniLoader```<br />
```cd uniLoader```<br />
```cp /home/user/linux/arch/arm64/boot/Image blob/Image```<br />
```cp /home/user/linux/arch/arm64/boot/dts/exynos/exynos8895-dreamlte.dtb blob/dtb```<br />
```make BOARD=samsung-dreamlte SOC=exynos8895```
# Usage
For Apple devices: Load the generated **uniLoader** binary via PongoOs (TODO: allow loading **instead** of PongoOs)<br /><br />
For Android devices: Replace the linux kernel in your *boot.img* with the **uniLoader** binary
# Credits
VDavid003 - for his sboot wrapper<br />
Quack723 - Contributor<br />
Ivoszbg - Making this huge mess of a bootloader
# License
This project is licensed under GPL2.

View File

@ -2,7 +2,9 @@
/*
* Copyright (c) 2022, Ivaylo Ivanov <ivo.ivanov.ivanov1@gmail.com>
*/
.global _start
_start:
ldr r0, =dtb
ldr r1, =kernel
b main

View File

@ -9,7 +9,9 @@ INPUT(DTB_PATH)
SECTIONS
{
. = 0x80008000;
/* The default TEXT_BASE address is 0x0 if not specified otherwise, so compare it to 0x1 */
__start_address = (TEXT_BASE > 0x1) ? TEXT_BASE : 0x80008000;
. = __start_address;
.boot : {
arch/arm/Start.o

View File

@ -55,23 +55,27 @@ menu "Device Support"
help
Say Y if you want to include support for Samsung Galaxy S20
config SAMSUNG_J5LTE
bool "Support for Samsung Galaxy J5 2015"
default n
depends on QC32_8916
help
Say Y if you want to include arm32 support for Samsung Galaxy J5 2015
config SAMSUNG_J4LTE
bool "Support for Samsung Galaxy J4 2018"
default n
depends on EXYNOS_7570
help
Say Y if you want to include arm64 support for Samsung Galaxy J4 2018
config SAMSUNG_J5LTE
bool "Support for Samsung Galaxy J5 2015"
default n
depends on QC32_8916
help
Say Y if you want to include arm32 support for Samsung Galaxy J5 2015
endmenu
menu "Device Specific Addresses"
config TEXT_BASE
hex "UniLoader Text Base"
default 0x0
config PAYLOAD_ENTRY
hex "Payload Entry Address"
default 0x830000000 if APPLE_N61AP
@ -82,9 +86,8 @@ menu "Device Specific Addresses"
default 0x090000000 if SAMSUNG_DREAMLTE
default 0x090000000 if SAMSUNG_STARLTE
default 0x090000000 if SAMSUNG_X1S
default 0x090000000 if SAMSUNG_J5LTE
default 0x050000000 if SAMSUNG_J4LTE
default 0x090000000 if SAMSUNG_J5LTE
config FRAMEBUFFER_BASE
hex "Framebuffer Base Address (for SimpleFB)"
@ -97,8 +100,8 @@ menu "Device Specific Addresses"
default 0x0cc000000 if SAMSUNG_DREAMLTE
default 0x0cc000000 if SAMSUNG_STARLTE
default 0x0F1000000 if SAMSUNG_X1S
default 0x08e000000 if SAMSUNG_J5LTE
default 0x067000000 if SAMSUNG_J4LTE
default 0x08e000000 if SAMSUNG_J5LTE
config FRAMEBUFFER_WIDTH
int "Framebuffer Width (for SimpleFB)"
@ -111,8 +114,8 @@ menu "Device Specific Addresses"
default 1440 if SAMSUNG_DREAMLTE
default 1440 if SAMSUNG_STARLTE
default 1440 if SAMSUNG_X1S
default 720 if SAMSUNG_J5LTE
default 720 if SAMSUNG_J4LTE
default 720 if SAMSUNG_J5LTE
config FRAMEBUFFER_HEIGHT
int "Framebuffer Height (for SimpleFB)"
@ -125,8 +128,8 @@ menu "Device Specific Addresses"
default 2960 if SAMSUNG_DREAMLTE
default 2960 if SAMSUNG_STARLTE
default 3200 if SAMSUNG_X1S
default 1280 if SAMSUNG_J5LTE
default 1280 if SAMSUNG_J4LTE
default 1280 if SAMSUNG_J5LTE
config FRAMEBUFFER_STRIDE
int "Framebuffer Stride (for SimpleFB)"
@ -139,8 +142,8 @@ menu "Device Specific Addresses"
default 4 if SAMSUNG_DREAMLTE
default 4 if SAMSUNG_STARLTE
default 4 if SAMSUNG_X1S
default 3 if SAMSUNG_J5LTE
default 4 if SAMSUNG_J4LTE
default 3 if SAMSUNG_J5LTE
config FRAMEBUFFER_BGRA
bool "Framebuffer BGRA (for SimpleFB)"

View File

@ -1,3 +1,4 @@
CONFIG_CROSS_COMPILE="arm-none-eabi-"
CONFIG_TEXT_BASE=0x80008000
CONFIG_SAMSUNG_J5LTE=y
CONFIG_QC32_8916=y