Skip to content

Commit 9c480da

Browse files
authored
adapt for a1000b (#48)
* [feat] adapt for a1000b
1 parent ba5f0fd commit 9c480da

File tree

5 files changed

+205
-4
lines changed

5 files changed

+205
-4
lines changed

arceos-vmm/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ else ifeq ($(ARCH), riscv64)
110110
else ifeq ($(ARCH), aarch64)
111111
ACCEL ?= n
112112
PLATFORM_NAME ?= aarch64-qemu-virt-hv
113-
PLATFORM := platforms/aarch64-qemu-virt-hv.toml
113+
PLATFORM := platforms/$(PLATFORM_NAME).toml
114114
else
115115
$(error "ARCH" must be one of "x86_64", "riscv64", or "aarch64")
116116
endif
@@ -179,7 +179,7 @@ include scripts/make/qemu.mk
179179
include scripts/make/test.mk
180180
ifeq ($(PLATFORM_NAME), aarch64-raspi4)
181181
include scripts/make/raspi4.mk
182-
else ifeq ($(PLATFORM_NAME), aarch64-bsta1000b)
182+
else ifeq ($(PLATFORM_NAME), aarch64-bsta1000b-virt-hv)
183183
include scripts/make/bsta1000b-fada.mk
184184
else ifeq ($(PLATFORM_NAME), aarch64-rk3588j)
185185
include scripts/make/rk3588.mk
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
id = 1
2+
name = "linux-a1000"
3+
vm_type = 1
4+
cpu_num = 8
5+
phys_cpu_ids = [0x00, 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700]
6+
phys_cpu_sets = [1, 2, 4, 8, 16, 32, 64, 128]
7+
entry_point = 0x8100_0000
8+
kernel_load_addr = 0x8100_0000
9+
dtb_load_addr = 0x82e0_0000
10+
11+
image_location = "memory"
12+
kernel_path = "path/to/kernel"
13+
dtb_path = "path/to/dtb"
14+
# ramdisk_path = ""
15+
# ramdisk_load_addr = 0
16+
# disk_path = "disk.img"
17+
# Memory regions with format (`base_paddr`, `size`, `flags`).
18+
memory_regions = [
19+
[0x8000_0000, 0x7000_0000, 0x7, 1],#ram 1792MB
20+
]
21+
22+
23+
# Emu_devices
24+
# Name Base-Ipa Ipa_len Alloc-Irq Emu-Type EmuConfig
25+
emu_devices = [
26+
]
27+
28+
# Pass-through devices
29+
passthrough_devices = [
30+
["most-devices", 0x0, 0x0, 0x8000_0000, 0x1],
31+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Architecture identifier.
2+
arch = "aarch64"
3+
# Platform identifier.
4+
platform = "aarch64-bsta1000b-hv"
5+
# Platform family.
6+
family = "aarch64-bsta1000b"
7+
8+
# Base address of the whole physical memory.
9+
phys-memory-base = "0x1_9800_0000"
10+
# Size of the whole physical memory.
11+
phys-memory-size = "0x5800_0000" #1408M
12+
# Offset of bus address and phys address. some boards, the bus address is
13+
# different from the physical address.
14+
phys-bus-offset = "0"
15+
# Base physical address of the kernel image.
16+
kernel-base-paddr = "0x1_a000_0000"
17+
# Base virtual address of the kernel image.
18+
kernel-base-vaddr = "0x0000_0001_a000_0000"
19+
# Linear mapping offset, for quick conversions between physical and virtual
20+
# addresses.
21+
phys-virt-offset = "0x0000_0000_0000_0000"
22+
# Kernel address space base.
23+
kernel-aspace-base = "0x0000_0000_0000_0000"
24+
# Kernel address space size.
25+
kernel-aspace-size = "0x0000_ffff_ffff_f000"
26+
# MMIO regions with format (`base_paddr`, `size`).
27+
mmio-regions = [
28+
["0x20008000", "0x1000"], # uart8250 UART0
29+
["0x32000000", "0x8000"], # arm,gic-400
30+
["0x32011000", "0x1000"], # CPU CSR
31+
["0x33002000", "0x1000"], # Top CRM
32+
["0x70035000", "0x1000"], # CRM reg
33+
["0x70038000", "0x1000"], # aon pinmux
34+
]
35+
36+
virtio-mmio-regions = []
37+
38+
# Base physical address of the PCIe ECAM space.
39+
pci-ecam-base = "0x30E0_2000"
40+
# End PCI bus number (`bus-range` property in device tree).
41+
# pci-bus-end = "0xff"
42+
# PCI device memory ranges (`ranges` property in device tree).
43+
# pci-ranges = []
44+
45+
# UART Address
46+
uart-paddr = "0x20008000"
47+
# UART irq from device tree
48+
uart-irq = "0xd5"
49+
# GICD Address
50+
gicd-paddr = "0x32001000"
51+
# GICC Address
52+
gicc-paddr = "0x32002000"
53+
54+
# BST A1000B board registers
55+
CPU_CSR_BASE = "0x32011000"
56+
A1000BASE_TOPCRM = "0x33002000"
57+
A1000BASE_SAFETYCRM = "0x70035000"
58+
A1000BASE_AONCFG = "0x70038000"
59+
60+
# PSCI
61+
psci-method = "smc"
62+
63+
# RTC (PL031) Address (Need to read from DTB).
64+
rtc-paddr = "0x0"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
OUTPUT_ARCH(aarch64)
2+
3+
BASE_ADDRESS = 0x1a0000000;
4+
5+
ENTRY(_start)
6+
SECTIONS
7+
{
8+
. = BASE_ADDRESS;
9+
_skernel = .;
10+
11+
.text : ALIGN(4K) {
12+
_stext = .;
13+
*(.text.boot)
14+
*(.text .text.*)
15+
. = ALIGN(4K);
16+
_etext = .;
17+
}
18+
19+
.rodata : ALIGN(4K) {
20+
_srodata = .;
21+
*(.rodata .rodata.*)
22+
*(.srodata .srodata.*)
23+
*(.sdata2 .sdata2.*)
24+
. = ALIGN(4K);
25+
_erodata = .;
26+
}
27+
28+
.data : ALIGN(4K) {
29+
_sdata = .;
30+
*(.data.boot_page_table)
31+
. = ALIGN(4K);
32+
*(.guestdata.kernel)
33+
. = ALIGN(4K);
34+
*(.guestdata.dtb)
35+
. = ALIGN(4K);
36+
*(.data .data.*)
37+
*(.sdata .sdata.*)
38+
*(.got .got.*)
39+
}
40+
41+
.tdata : ALIGN(0x10) {
42+
_stdata = .;
43+
*(.tdata .tdata.*)
44+
_etdata = .;
45+
}
46+
47+
.tbss : ALIGN(0x10) {
48+
_stbss = .;
49+
*(.tbss .tbss.*)
50+
*(.tcommon)
51+
_etbss = .;
52+
}
53+
54+
. = ALIGN(4K);
55+
_percpu_start = .;
56+
_percpu_end = _percpu_start + SIZEOF(.percpu);
57+
.percpu 0x0 : AT(_percpu_start) {
58+
_percpu_load_start = .;
59+
*(.percpu .percpu.*)
60+
_percpu_load_end = .;
61+
. = _percpu_load_start + ALIGN(64) * 1;
62+
}
63+
. = _percpu_end;
64+
65+
. = ALIGN(4K);
66+
_edata = .;
67+
68+
.bss : ALIGN(4K) {
69+
boot_stack = .;
70+
*(.bss.stack)
71+
. = ALIGN(4K);
72+
boot_stack_top = .;
73+
74+
_sbss = .;
75+
*(.bss .bss.*)
76+
*(.sbss .sbss.*)
77+
*(COMMON)
78+
. = ALIGN(4K);
79+
_ebss = .;
80+
}
81+
82+
_ekernel = .;
83+
84+
/DISCARD/ : {
85+
*(.comment) *(.gnu*) *(.note*) *(.eh_frame*)
86+
}
87+
}
88+
89+
SECTIONS {
90+
linkme_IRQ : { *(linkme_IRQ) }
91+
linkm2_IRQ : { *(linkm2_IRQ) }
92+
linkme_PAGE_FAULT : { *(linkme_PAGE_FAULT) }
93+
linkm2_PAGE_FAULT : { *(linkm2_PAGE_FAULT) }
94+
}
95+
INSERT AFTER .tbss;
+13-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
fada: build
1+
A1000B_GITHUB_URL = https://github.com/arceos-hypervisor/platform_tools/releases/download/latest/a1000b.zip
2+
A1000B_MKIMG_FILE = ./tools/a1000b/mkimage
3+
check-download:
4+
ifeq ("$(wildcard $(A1000b_MKIMG_FILE))","")
5+
@echo "file not found, downloading from $(A1000B_GITHUB_URL)...";
6+
wget $(A1000B_GITHUB_URL);
7+
unzip -o a1000b.zip -d tools;
8+
rm a1000b.zip;
9+
endif
10+
11+
12+
fada: check-download build
213
gzip -9 -cvf $(OUT_BIN) > arceos-fada.bin.gz
3-
mkimage -f tools/bsta1000b/bsta1000b-fada-arceos.its arceos-fada.itb
14+
$(A1000B_MKIMG_FILE) -f ./tools/a1000b/bsta1000b-fada-arceos.its arceos-fada.itb
415
@echo 'Built the FIT-uImage arceos-fada.itb'

0 commit comments

Comments
 (0)