blob: b119c9110baf14ba425edf0613266c65a9386c4e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
setup riscv-gnu-toolchain
--------------------------
$ git clone https://github.com/riscv-collab/riscv-gnu-toolchain
$ ./configure --prefix=/opt/riscv
$ make
setup opensbi
--------------
git clone https://github.com/riscv-software-src/opensbi.git
cd opensbi
make ARCH=riscv CROSS_COMPILE=riscv64-unknown-elf- PLATFORM=generic
setup mig
---------
TARGET_CPPFLAGS=-I"$GNU"/include ../configure --prefix="$GNU" --target=riscv64-unknown-elf TARGET_CC=riscv64-unknown-elf-gcc
setup gnumach
--------------
$ mkdir build
$ cd build
$ ../configure --prefix= --host=riscv64-unknown-elf LD=riscv64-unknown-elf-ld CC=riscv64-unknown-elf-gcc
$ make gnumach
You may need to setup libc6-dev-riscv64-cross
run it qemu
-----------
qemu-system-riscv64 -M virt -m 128M -nographic -bios YOUR_PATH/opensbi/build/platform/generic/firmware/fw_dynamic.bin -kernel gnumach
adjusted for gnumach
---------------------
linux-6.x.x/arch/riscv/kernel/head.S -> gnumach/riscv/riscv/boothdr.S
linux-6.x.x/arch/riscv/include/asm/ -> gnumach/riscv/include/asm/
linux-6.x.x/arch/riscv/include/uapi/ -> gnumach/riscv/include/uapi/
You will find in some header files "#include <generated/*>"
This generated directory will be generated after you configure/build linux kernel.
$ make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- defconfig
You may need to install "gcc-riscv64-linux-gnu", if "riscv64-unknown-elf" fails to configure/build linux kernel.
warning:
--------
This is *not* the directory where all the necessary files will be generated - "linux-6.x.x/arch/riscv/include/generated/"
Instead you need to check - "linux-6.x.x/include/generated/" (specially for files like asm-offsets.h).
linux-6.x.x/include/generated/ -> gnumach/riscv/include/generated/
links added for asm, uapi, and generated, in gnumach/riscv/configfrag.ac
AC_CONFIG_LINKS([asm:$systype/include/asm
uapi:$systype/include/uapi
generated:$systype/include/generated])
Pending implementations
-----------------------
gnumach/riscv/riscv/{const.h, setup.c}
resources in sifive.com blog
-----------------------------
https://www.sifive.com/blog/all-aboard-part-1-compiler-args
https://www.sifive.com/blog/all-aboard-part-2-relocations
https://www.sifive.com/blog/all-aboard-part-3-linker-relaxation-in-riscv-toolchain
https://www.sifive.com/blog/all-aboard-part-4-risc-v-code-models
https://www.sifive.com/blog/all-aboard-part-5-risc-v-multilib
https://www.sifive.com/blog/all-aboard-part-6-booting-a-risc-v-linux-kernel
https://www.sifive.com/blog/all-aboard-part-7-entering-and-exiting-the-linux-kernel-on-risc-v
https://www.sifive.com/blog/all-aboard-part-8-the-risc-v-linux-port-is-upstream
https://www.sifive.com/blog/all-aboard-part-9-paging-and-mmu-in-risc-v-linux-kernel
https://www.sifive.com/blog/all-aboard-part-10-how-to-contribute-to-the-risc-v-software-ecosystem
https://www.sifive.com/blog/all-aboard-part-11-risc-v-hackathon-presented-by-sifive
|