blob: 1c92b0a70762681550a660bcf145bb6028675cef (
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
|
#!/bin/bash
[ ! -d "/boot/bootcfg/" ] && exit
[ ! -d "/boot/dtbos/" ] && exit
fipdev=$(cat /boot/bootcfg/device)
linux=$(cat /boot/bootcfg/linux)
cmdline=$(cat /boot/bootcfg/cmdline)
initrd=$(cat /boot/bootcfg/initrd)
dtb=$(cat /boot/bootcfg/dtb)
tmp="/tmp/bpir64-atf-git"
mkdir -p $tmp
origargs=$(fdtget -ts "/boot/dtbs/${dtb}.dtb" "/chosen" "bootargs")
bootargs="root=PARTLABEL=bpir64-${fipdev}-root $origargs $cmdline"
echo BOOTARGS = "$bootargs"
cp -vf "/boot/dtbs/${dtb}.dtb" "/boot/dtbs/${dtb}-fixed.dtb"
for bp in /boot/dtbos/*.dts; do
dtc -q -I dts -O dtb -o ${bp/".dts"/".dtbo"} $bp
cat $bp | grep "//fdtput" | while read -r line ; do
echo fdtput "/boot/dtbs/${dtb}-fixed.dtb" ${line/"//fdtput"/""}
fdtput "/boot/dtbs/${dtb}-fixed.dtb" ${line/"//fdtput"/""}
done
done
fdtoverlay -vi "/boot/dtbs/${dtb}-fixed.dtb" -o "/boot/atf-direct.dtb" \
/boot/dtbos/*.dtbo
fdtput -ts "/boot/atf-direct.dtb" "/chosen" "bootargs" "$bootargs"
fdtput -ts "/boot/atf-direct.dtb" "/memory" "device_type" "memory"
if [ -f "$initrd" ];then
ins="0x48000000"
ine="0x$(printf '%x\n' $(( 0x48000000 + $(du -b $initrd | cut -f1) )))"
fdtput -tx "/boot/atf-direct.dtb" "/chosen" "linux,initrd-end" "$ine"
fdtput -tx "/boot/atf-direct.dtb" "/chosen" "linux,initrd-start" "$ins"
initrdfile="$initrd"
else
echo -n "" > "$tmp/initrd"
initrdfile="$tmp/initrd"
fi
fiptool --verbose create $tmp/fip.bin \
--tos-fw-extra2 $initrdfile \
--nt-fw $linux \
--nt-fw-config "/boot/atf-direct.dtb"
fiptool info $tmp/fip.bin
fipdev="/dev/disk/by-partlabel/bpir64-${fipdev}-fip"
[ ! -L $fipdev ] && exit 0
echo Writing FIP to: $fipdev
dd of=$fipdev if=/dev/zero 2>/dev/null
dd of=$fipdev if=$tmp/fip.bin
exit 0
|