Skip to content

Commit e1b6967

Browse files
authored
Merge pull request #23 from elektrofon/custom-kernel
Custom kernel
2 parents 358ddb3 + fcfcde0 commit e1b6967

12 files changed

Lines changed: 7951 additions & 9 deletions

BUILD.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The reason for halting and upping is to load any new kernel updates that was ins
1717
### 3. Build patchOS
1818

1919
```sh
20-
$ vagrant ssh -c "sudo /vagrant/vagrant-build"
20+
$ vagrant ssh -c "/vagrant/vagrant-build"
2121
```
2222

2323
This will take about 40 minutes on a half decent laptop.

Vagrantfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,20 @@ Vagrant.configure("2") do |config|
1313
config.vm.provision "shell", inline: <<-SHELL
1414
sudo echo "Server = http://mirror.archlinux.no/\\$repo/os/\\$arch" > /etc/pacman.d/mirrorlist
1515
sudo pacman -Syu --noconfirm
16-
sudo pacman -S base-devel parted dosfstools gcc-libs wget rsync git python2 --noconfirm
17-
rm -Rf yay-git
16+
sudo pacman -S base-devel xmlto kmod inetutils libelf bc bison flex ncurses parted dosfstools gcc-libs wget rsync git python2 --noconfirm
17+
sudo echo 'MAKEFLAGS="-j$(($(nproc) + 1))"' >> /etc/makepkg.conf
1818
su vagrant -c "git clone https://aur.archlinux.org/yay-git.git"
1919
cd yay-git
2020
su vagrant -c "makepkg -si --skipchecksums --noconfirm"
2121
su vagrant -c "yay -Syu --noconfirm"
22-
su vagrant -c "gpg --recv-key 9766E084FB0F43D8"
22+
su vagrant -c "gpg --keyserver keys.gnupg.net --recv-key 45F68D54BBE23FB3039B46E59766E084FB0F43D8"
23+
su vagrant -c "gpg --keyserver keys.gnupg.net --recv-key CEACC9E15534EBABB82D3FA03353C9CEF108B584"
24+
su vagrant -c "yay -S binfmt-qemu-static-all-arch qemu-user-static --noconfirm"
2325
su vagrant -c "yay -S binfmt-qemu-static-all-arch qemu-user-static --noconfirm"
2426
sudo systemctl restart systemd-binfmt.service
2527
wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
2628
chmod +x pishrink.sh
2729
sudo mv pishrink.sh /usr/local/bin
30+
su vagrant -c "git clone --depth=1 https://github.com/raspberrypi/tools ~/tools"
2831
SHELL
2932
end

build

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ pacman -S --noconfirm \
3535
python-flask-socketio \
3636
python-eventlet
3737

38-
# Enable all cores for building
39-
echo 'MAKEFLAGS="-j$(nproc)"' >> /etc/makepkg.conf
40-
4138
# Rename default user
4239
sed -i "s/alarm/patch/g" /etc/passwd /etc/group /etc/shadow
4340
mv /home/alarm "/home/patch"

kernel-build

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash -xe
2+
3+
git clone --depth=1 https://github.com/raspberrypi/linux.git -b rpi-5.4.y /home/vagrant/linux
4+
cp /vagrant/linux/* /home/vagrant/linux
5+
cd /home/vagrant/linux
6+
mv config .config
7+
8+
# Fix "multiple definition of `yylloc'" lexer error
9+
sed -i 's/^YYLTYPE yylloc;$/extern YYLTYPE yylloc;/' scripts/dtc/dtc-lexer.l
10+
11+
# Apply Preepmt-RT patch
12+
curl http://cdn.kernel.org/pub/linux/kernel/projects/rt/5.4/patch-5.4.40-rt24.patch.gz | gunzip > patch-5.4.40-rt24.patch
13+
git apply patch-5.4.40-rt24.patch
14+
15+
PATH=$PATH:/home/vagrant/tools/arm-bcm2708/arm-linux-gnueabihf/bin
16+
KERNEL=kernel7l
17+
make -j $(($(nproc) + 1)) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- prepare
18+
make -j $(($(nproc) + 1)) ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs
19+
sudo env PATH=$PATH make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/mnt modules_install

linux/60-linux.hook

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Trigger]
2+
Type = File
3+
Operation = Install
4+
Operation = Upgrade
5+
Operation = Remove
6+
Target = usr/lib/modules/%KERNVER%/*
7+
Target = usr/lib/modules/%EXTRAMODULES%/*
8+
9+
[Action]
10+
Description = Updating %PKGBASE% module dependencies...
11+
When = PostTransaction
12+
Exec = /usr/bin/depmod %KERNVER%

linux/90-linux.hook

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Trigger]
2+
Type = File
3+
Operation = Install
4+
Operation = Upgrade
5+
Target = boot/kernel.img
6+
Target = boot/kernel7.img
7+
Target = usr/lib/initcpio/*
8+
9+
[Action]
10+
Description = Updating %PKGBASE% initcpios...
11+
When = PostTransaction
12+
Exec = /usr/bin/mkinitcpio -p %PKGBASE%

linux/cmdline.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
root=/dev/mmcblk0p2 rw rootwait console=ttyAMA0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 elevator=noop

0 commit comments

Comments
 (0)