Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hello #1

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions asm/Start.S
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

adr x0, dtb
adr x1, kernel
adrp x2, end
b main

.global load_kernel
Expand Down
3 changes: 3 additions & 0 deletions asm/linker.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ SECTIONS
kernel = .;
KERNEL_PATH
}
end = .;

kernel_size = SIZEOF(.kernel);
}
13 changes: 13 additions & 0 deletions board/generic/board-generic.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2022, Markuss Broks <[email protected]>
*/

/* This is a generic board file. This should work on every device
* as long as it's loaded in physical memory with enough space to
* put the kernel image ahead of it on closest 2MiB-aligned address.
*/

void board_init(void) {

}
10 changes: 10 additions & 0 deletions board/samsung/board-starlte.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2022, Markuss Broks <[email protected]>
*/

#include <board/board-starlte.h>

void board_init(void) {

}
1 change: 0 additions & 1 deletion include/board/board-dreamlte.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
#define BOARD_DREAMLTE_H_

#define PAYLOAD_ENTRY 0x90000000
#define PAYLOAD_SIZE 0x2000000

#endif // BOARD_DREAMLTE_H_
11 changes: 11 additions & 0 deletions include/board/board-generic.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2022, Markuss Broks <[email protected]>
*/

#ifndef BOARD_GENERIC_H /* Include guard */
#define BOARD_GENERIC_H

/* Nothing really is here :) */

#endif // BOARD_GENERIC_H
1 change: 0 additions & 1 deletion include/board/board-n61ap.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@

/* TODO: Adjust PAYLOAD_ENTRY */
#define PAYLOAD_ENTRY 0x830000000
#define PAYLOAD_SIZE 0x2000000

#endif // BOARD_N61AP_H_
11 changes: 11 additions & 0 deletions include/board/board-starlte.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2022, Markuss Broks <[email protected]>
*/

#ifndef BOARD_STARLTE_H /* Include guard */
#define BOARD_STARLTE_H

#define PAYLOAD_ENTRY 0x90000000

#endif // BOARD_STARLTE_H
2 changes: 2 additions & 0 deletions include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef MAIN_H_ /* Include guard */
#define MAIN_H_

#define SZ_2M 0x00200000

extern void load_kernel(void* dtb, void* x1, void* x2, void* x3, void* kernel);
extern void soc_init(void);
extern void board_init(void);
Expand Down
12 changes: 12 additions & 0 deletions include/soc/exynos9810.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2022, Markuss Broks <[email protected]>
*/

#ifndef EXYNOS9810_H_ /* Include guard */
#define EXYNOS9810_H_

#define DECON_F_BASE 0x16030000
#define HW_SW_TRIG_CONTROL 0x70

#endif // EXYNOS9810_H_
16 changes: 13 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@
/* Device specific board config, copied in runtime */
#include <board-config.h>

void main(void* dt, void* kernel) {
extern unsigned long kernel_size;

void main(void* dt, void* kernel, void* end) {
void* kernel_load;
/* Initialize SoC and Board specific peripherals/quirks */
soc_init();
board_init();

#ifndef PAYLOAD_ENTRY
/* Find closest 2MB-aligned address to our load location */
kernel_load = (void *) ((((unsigned long long)end - 1) | (SZ_2M - 1)) + 1);
#else
kernel_load = (void *) PAYLOAD_ENTRY;
#endif

/* Copy kernel to memory and boot */
memcpy((void*)PAYLOAD_ENTRY, kernel, PAYLOAD_SIZE);
load_kernel(dt, 0, 0, 0, (void*)PAYLOAD_ENTRY);
memcpy((void*)kernel_load, kernel, (unsigned long) &kernel_size);
load_kernel(dt, 0, 0, 0, (void*)kernel_load);
}
7 changes: 7 additions & 0 deletions soc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,20 @@ board_codename := $(word 2,$(split_board))
# Exynos
ifeq ($(SOC),exynos8895)
brand_name=exynos
else ifeq ($(SOC),exynos9810)
brand_name=exynos
endif

# Apple
ifeq ($(SOC),t7000)
brand_name=apple
endif

# Generic
ifeq ($(SOC),generic)
brand_name=generic
endif

all: $(brand_name)/$(SOC).o copy-soc

copy-soc:
Expand Down
11 changes: 11 additions & 0 deletions soc/exynos/exynos9810.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2022, Markuss Broks <[email protected]>
*/

#include <soc/exynos9810.h>

void soc_init(void) {
/* Allow framebuffer to be written to */
*(int*) (DECON_F_BASE + HW_SW_TRIG_CONTROL) = 0x1281;
}
8 changes: 8 additions & 0 deletions soc/generic/generic.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2022, Markuss Broks <[email protected]>
*/

void soc_init(void) {
/* We don't know anything about the SoC so we can't do anything... */
}