forked from weirdindiankid/cacheflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dtb.sh
56 lines (45 loc) · 1.37 KB
/
dtb.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
49
50
51
52
53
54
55
56
#! /bin/bash
#
# manipulate device trees so we can allocate memory
# for the cacheflow buffers
#
set -eux
#
# Kernel 5.4.0:
# These three dtb files should be equivalent
# /boot/dtbs/5.4.0-1045-raspi/bcm2711-rpi-4-b.dtb
# /boot/firmware/bcm2711-rpi-4-b.dtb
# /lib/firmware/5.4.0-1045-raspi/device-tree/broadcom/bcm2711-rpi-4-b.dtb
#
# Kernel 5.13.0-1008-raspi ubuntu 21.10
# These two dtb files should be equivalent
#
# /boot/firmware/bcm2711-rpi-4-b.dtb
# /usr/lib/firmware/5.13.0-1008-raspi/device-tree/broadcom/bcm2711-rpi-4-b.dtb
# OS=5.4.0-1045
# FILE0=/boot/dtbs/${OS}-raspi/bcm2711-rpi-4-b.dtb
# FILE1=/usr/lib/firmware/${OS}-raspi/device-tree/broadcom/bcm2711-rpi-4-b.dtb
OS=5.13.0-1008
FILE0=/boot/firmware/bcm2711-rpi-4-b.dtb
FILE1=/usr/lib/firmware/${OS}-raspi/device-tree/broadcom/bcm2711-rpi-4-b.dtb
ls -l $FILE0 $FILE1
sum $FILE0 $FILE1
dtc -I dtb -O dts -o original.dts $FILE1
if [ ! -e new.dts ] ; then
cp original.dts new.dts
fi
#
# Human edits new.dts
# No changes expected,
# so nothing written back to the
#
exit
dtc -I dts -O dtb -o new.dtb new.dts
sudo cp -p new.dtb ${FILE0} || true # there will be permission errors
#
# Check if compile/decompile yields a fixpoint (it should, modulo spacing and comments in the original text)
#
dtc -I dtb -O dts -o new.decompile.out /boot/firmware/bcm2711-rpi-4-b.dtb
diff new.dts new.decompile.out
echo "no diffs"
exit 0