-
Notifications
You must be signed in to change notification settings - Fork 0
/
HowTo_CrossCompile_RPi4_Kernel
109 lines (109 loc) · 4.5 KB
/
HowTo_CrossCompile_RPi4_Kernel
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# CROSS COMPILE A RASPBERRY PI 4 KERNEL 4.19.y WITH MPTCP v0.95:
sudo su
# <Enter user password>
apt update
apt upgrade
# INSTALL PREREQUISITES:
apt install git bc make ncurses-dev gcc gcc-arm-linux-gnueabihf wget unzip bison flex libssl-dev libc6-dev libncurses5-dev
# DOWNLOAD RASPBERRYPI KERNEL AND MERGE WITH MPTCP:
git clone --depth=1 --branch rpi-4.19.y git://github.com/raspberrypi/linux.git
cd linux
KERNEL=kernel7l
git remote add mptcp https://github.com/multipath-tcp/mptcp.git
git fetch mptcp mptcp_v0.95
git checkout -b rpi_mptcp origin/rpi-4.19.y
# SETTING UP GIT EMAIL (CAN BE A TRASH MAIL OR JUST [email protected])
git config --global user.email "[email protected]"
# -> STRG+X
git merge mptcp/mptcp_v0.95 --allow-unrelated-histories
# INSTALL TOOLCHAIN:
git clone https://github.com/raspberrypi/tools ~/tools
echo PATH=\$PATH:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin >> ~/.bashrc
source ~/.bashrc
# CROSS COMPILE:
make mrproper
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- nconfig
# Enable the following modules with <space>:
# [*] Networking support --->
# Networking options --->
# [*] TCP/IP networking
# [*] IP: advanced router
# [*] IP: policy routing
# ...
# [*] TCP: advanced congestion control --->
# <*> MPTCP Linked Increase
# <*> MPTCP Opportunistic Linked Increase
# <*> MPTCP WVEGAS CONGESTION CONTROL
# <*> MPTCP BALIA CONGESTION CONTROL
# Default TCP congestion control (Lia) --->
# <X> Lia
# ...
# <*> The IPv6 protocol --->
# [*] MPTCP protocol (NEW)
# [*] MPTCP: advanced path-manager control (NEW) ----
# <*> MPTCP Full-Mesh Path-Manager
# <*> MPTCP ndiff-ports
# <*> MPTCP Binder
# Default MPTCP Path-Manager (Full mesh) --->
# <X> Full mesh
# [*] MPTCP: advanced scheduler control (NEW) ----
# <*> MPTCP Round-Robin
# <*> MPTCP Redundant
# Default MPTCP Scheduler (Default) --->
# <X> Default
#
# 3-5x <ESC> + 2x ENTER (<save> and <ok>)
#
# the "-j 4" is the number of tasks/cores you will use:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j 4 zImage
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j 4 modules
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j 4 dtbs
# DOWNLOAD LATEST RASPBIAN LITE IMAGE:
wget https://downloads.raspberrypi.org/raspbian_lite_latest
unzip raspbian_lite_latest
mv *.img raspbian.img
fdisk -l raspbian.img
# YOU WILL GET SOMETHING LIKE THAT:
#
# Disk raspbian.img: 1.7 GiB, 1858076672 bytes, 3629056 sectors
# Units: sectors of 1 * 512 = 512 bytes
# Sector size (logical/physical): 512 bytes / 512 bytes
# I/O size (minimum/optimal): 512 bytes / 512 bytes
# Disklabel type: dos
# Disk identifier: 0x37665771
#
# Device Boot Start End Sectors Size Id Type
# raspbian.img1 8192 532479 524288 43,2M c W95 FAT32 (LBA)
# raspbian.img2 532480 3612671 3080192 1,5G 83 Linux
#
# CALCULATE THE OFFSET OF BOTH PARTITIONS:
# <PARTITION>: <UNITS IN BYTES> * <START OF PARTITION> = <OFFSET>
# PARTITION 1: 512 * 8192 = 4194304
# PARTITION 2: 512 * 532480 = 272629760
#
# THEN MOUNT BOTH PARTITIONS:
mkdir -p mnt/fat32
mkdir mnt/ext4
mount -v -o offset=272629760 -t ext4 raspbian.img mnt/ext4
# INSTALL MODULES:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 -j 4 modules_install
KERNEL=kernel7l
umount mnt/ext4
mount -v -o offset=4194304 -t vfat raspbian.img mnt/fat32
cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img
cp arch/arm/boot/zImage mnt/fat32/$KERNEL.img
cp arch/arm/boot/dts/*.dtb mnt/fat32/
cp arch/arm/boot/dts/overlays/*.dtb* mnt/fat32/overlays/
cp arch/arm/boot/dts/overlays/README mnt/fat32/overlays/
echo "kernel=kernel7l.img" >> mnt/fat32/config.txt
umount mnt/fat32
# DONE
#
# OPTIONAL: RENAME raspbian.img IF YOU WANT e.g. "Raspbian_RPi4_4.19.106-v7l+_mptcp_0.95.img"
#
# COPY raspbian.img TO SDCARD:
sudo diskutil list
# look for your SD-Card: e.g. /dev/disk5
diskutil unmountDisk /dev/disk5
sudo dd if=raspbian.img of=/dev/rdisk5 bs=1m conv=sync