-
Notifications
You must be signed in to change notification settings - Fork 5
/
riscv_em_nommu_linux.sh
executable file
·48 lines (36 loc) · 1.52 KB
/
riscv_em_nommu_linux.sh
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
#!/bin/sh
set -e
LINUX_VERSION="5.10.6"
BUILDROOT_VERSION="2021.02.6"
ROOT_DIR=${PWD}
WORK_DIR=${PWD}/output
mkdir -p ${WORK_DIR}
## Buildroot
cd ${WORK_DIR}
wget https://buildroot.org/downloads/buildroot-${BUILDROOT_VERSION}.tar.gz
tar xvf buildroot-${BUILDROOT_VERSION}.tar.gz
ln -s buildroot-${BUILDROOT_VERSION} buildroot
cp ${ROOT_DIR}/riscv_em_nommu_buildroot_config ${WORK_DIR}/buildroot-${BUILDROOT_VERSION}/.config
cp ${ROOT_DIR}/patches/buildroot/* ${WORK_DIR}/buildroot-${BUILDROOT_VERSION}/
cd ${WORK_DIR}/buildroot-${BUILDROOT_VERSION}
patch -p1 < 0001-Make-MMU-for-riscv-optional.patch
patch -p1 < 0002-Toolchain-fix.patch
patch -p1 < 0003-NPTL-fix.patch
patch -p1 < 0004-elf2flt-add-riscv-support.patch
patch -p1 < 0005-uclibc-riscv-nommu-support.patch
patch -p1 < 0006-riscv64-nommu-defconfig.patch
patch -p1 < 0007-add-busybox-small.config.patch
make -j16
## Linux
cd ${WORK_DIR}
wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-${LINUX_VERSION}.tar.xz
tar xvf linux-${LINUX_VERSION}.tar.xz
ln -s linux-${LINUX_VERSION} linux
cp ${ROOT_DIR}/riscv_em_nommu_linux_config ${WORK_DIR}/linux-${LINUX_VERSION}/.config
cp ${ROOT_DIR}/patches/linux/* ${WORK_DIR}/linux-${LINUX_VERSION}/
cd ${WORK_DIR}/linux-${LINUX_VERSION}/
patch -p1 < 0001-add-simple-uart.patch
patch -p1 < 0002-revert-commit-2217b982624680d19a80ebb4600d05c8586c4f96.patch
patch -p1 < 0003-check-for-zifencei-compat.patch
make ARCH=riscv CROSS_COMPILE=riscv64-none-elf- -j16 loader
riscv64-none-elf-objcopy -O binary arch/riscv/boot/loader loader_64.bin