Created
September 10, 2025 17:24
-
-
Save Fiwi1265/af3cace80d80bfe8dc3bd90d6ef8ff5a to your computer and use it in GitHub Desktop.
u-boot-rpi4-scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -euo pipefail | |
| if [ "$(id -u)" -ne 0 ]; then | |
| echo "Error: This script must be run as root." >&2 | |
| exit 1 | |
| fi | |
| generate_fit() { | |
| local version="$1" | |
| local its="/tmp/boot-${version}.its" | |
| local itb="/boot/boot-${version}.itb" | |
| cat > "$its" <<EOF | |
| /dts-v1/; | |
| / { | |
| description = "Debian ${version}"; | |
| #address-cells = <1>; | |
| images { | |
| kernel { | |
| data = /incbin/("/boot/vmlinuz-${version}"); | |
| type = "kernel"; | |
| arch = "arm64"; | |
| os = "linux"; | |
| compression = "none"; | |
| load = <0x80000>; | |
| entry = <0x80000>; | |
| }; | |
| ramdisk { | |
| data = /incbin/("/boot/initrd.img-${version}"); | |
| type = "ramdisk"; | |
| arch = "arm64"; | |
| os = "linux"; | |
| }; | |
| fdt { | |
| data = /incbin/("/boot/firmware/bcm2711-rpi-4-b.dtb"); | |
| type = "flat_dt"; | |
| arch = "arm64"; | |
| compression = "none"; | |
| }; | |
| }; | |
| configurations { | |
| default = "conf"; | |
| conf { | |
| kernel = "kernel"; | |
| ramdisk = "ramdisk"; | |
| fdt = "fdt"; | |
| }; | |
| }; | |
| }; | |
| EOF | |
| mkimage -f "$its" "$itb" | |
| rm "$its" | |
| } | |
| if [ $# -ge 1 ]; then | |
| generate_fit "$1" | |
| else | |
| for kernel in /boot/vmlinuz-*; do | |
| version="$(basename "$kernel" | sed 's/^vmlinuz-//')" | |
| generate_fit "$version" | |
| done | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -euo pipefail | |
| if [ "$(id -u)" -ne 0 ]; then | |
| echo "Error: This script must be run as root." >&2 | |
| exit 1 | |
| fi | |
| /usr/local/bin/u-boot-fit | |
| /usr/local/bin/u-boot-menu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment