blob: fccd090f43a06280a81630f07bfc290c9c956067 (
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
49
50
51
52
53
54
55
56
57
58
59
60
|
#!/bin/bash
# vim:sw=8:noet
MEDIATABLE=msdos
ROOTPART_NUM=1
START_SECTOR=16 # MiB
[ -n "$SYSCON" ] || SYSCON=ttyS2,1500000n8
soc_write_bootloader() {
[ -n "$TMPROOT" ] || mount_partition
# Write U-Boot
set_path_to_uboot
local IDBSPL IDBLOADER FIT FIT_SEEK_FILE FIT_SEEK
UBOOT="$UBOOT/u-boot-rockchip.bin"
UBOOT_ZST="$UBOOT.zst"
IDBSPL="$UBOOT/idbspl.img"
IDBLOADER="$UBOOT/idbloader.img"
FIT="$UBOOT/u-boot.itb"
FIT_SEEK_FILE="$UBOOT/u-boot.itb.seek"
FIT_SEEK=16384
if [ -f "$UBOOT_ZST" ]; then
UBOOT="$UBOOT_ZST"
CAT="unzstd -c"
else
CAT=cat
fi
if [ -f "$UBOOT" ]; then
print_message "Writing u-boot-rockchip.bin..."
$CAT "$UBOOT" | dd of="$MEDIA" seek=64 || fatal_error "Error: Failed to write u-boot-rockchip.bin!!!"
sync
print_done
else
print_message "Warning: $UBOOT is missing. Try find idbspl.img..."
if [ -f "$IDBSPL" ]; then
print_message "Writing idbspl.img..."
dd if="$IDBSPL" of="$MEDIA" seek=64 || fatal_error "Error: Failed to write idbspl.img"
sync
print_done
else
print_message "Warning: idbspl.img is missing. Try find idbloader.img..."
if [ -f "$IDBLOADER" ]; then
print_message "Writing idbloader.img..."
dd if="$IDBLOADER" of="$MEDIA" seek=64 || fatal_error "Error: Failed to write idbloader.img"
sync
print_done
else
print_message "Warning: idbloader.img is missing. Try find and write u-boot.itb without first loader..."
fi
fi
[ -f "$FIT" ] || fatal_error "Error: u-boot.itb not found!!!"
print_message "Writing U-Boot FIT image..."
if [ -f "$FIT_SEEK_FILE" ]; then
FIT_SEEK="$(cat FIT_SEEK_FILE | head -n1)"
fi
dd if="$FIT" of="$MEDIA" seek="$FIT_SEEK" || fatal_error "Error: failed to write u-boot.itb!!!"
sync
print_done
fi
}
|