Skip to content

Commit

Permalink
PLTOS-271 - Allow boot partition files to be overridden in PLT-OS (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Rauer authored Oct 26, 2023
1 parent 41516ca commit a3e6048
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 30 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.24.7
0.24.8
7 changes: 7 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

export SCRIPT_NAME=`realpath "$0"`
export SCRIPT_DIR=`dirname "$SCRIPT_NAME"`

make -C "$SCRIPT_DIR" sync-packages

42 changes: 13 additions & 29 deletions fwup.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ define(OLD_NERVES_FW_PARTITION_SCHEME, "141MB root")
define(NERVES_PROVISIONING, "${NERVES_SYSTEM}/images/fwup_include/provisioning.conf")

# Allow override of cmdline.txt and config.txt
define(CONFIG_TXT_NAME,${CONFIG_TXT:-config.txt})
define(CMDLINE_TXT_NAME,${CMDLINE_TXT:-cmdline.txt})
define(CONFIG_TXT, "${NERVES_SYSTEM}/images/config.txt" )
define(CMDLINE_TXT, "${NERVES_SYSTEM}/images/cmdline.txt")
define(BOOT_EXTRAS_DEFINE,"${NERVES_SYSTEM}/images/fwup_include/boot_extras_define.conf")
define(BOOT_EXTRAS_A,"${NERVES_SYSTEM}/images/fwup_include/boot_extras_a.conf")
define(BOOT_EXTRAS_B,"${NERVES_SYSTEM}/images/fwup_include/boot_extras_b.conf")

# Default paths if not specified via the commandline
define(ROOTFS, "${NERVES_SYSTEM}/images/rootfs.squashfs")

include("${BOOT_EXTRAS_DEFINE}")

# This configuration file will create an image that has an MBR and the
# following 3 partitions:
Expand Down Expand Up @@ -107,27 +111,17 @@ meta-misc = ${NERVES_FW_MISC}
# File resources are listed in the order that they are included in the .fw file
# This is important, since this is the order that they're written on a firmware
# update due to the event driven nature of the update system.
file-resource recovery.bin {
host-path = "${NERVES_APP}/bootfs_overlay/recovery.bin"
}
file-resource pieeprom.upd {
host-path = "${NERVES_APP}/bootfs_overlay/pieeprom.upd"
}
file-resource pieeprom.sig {
host-path = "${NERVES_APP}/bootfs_overlay/pieeprom.sig"
}

file-resource fixup.dat {
host-path = "${NERVES_SYSTEM}/images/rpi-firmware/fixup4x.dat"
}
file-resource start.elf {
host-path = "${NERVES_SYSTEM}/images/rpi-firmware/start4x.elf"
}
file-resource config.txt {
host-path = "${NERVES_APP}/config/${CONFIG_TXT_NAME}"
host-path = "${CONFIG_TXT}"
}
file-resource cmdline.txt {
host-path = "${NERVES_APP}/config/${CMDLINE_TXT_NAME}"
host-path = "${CMDLINE_TXT}"
}
file-resource kernel8.img {
host-path = "${NERVES_SYSTEM}/images/Image"
Expand Down Expand Up @@ -268,9 +262,7 @@ task complete {
uboot_setenv(uboot-env, "a.nerves_fw_partition_scheme", ${NERVES_FW_PARTITION_SCHEME})
}

on-resource recovery.bin { fat_write(${BOOT_A_PART_OFFSET}, "recovery.bin") }
on-resource pieeprom.upd { fat_write(${BOOT_A_PART_OFFSET}, "pieeprom.upd") }
on-resource pieeprom.sig { fat_write(${BOOT_A_PART_OFFSET}, "pieeprom.sig") }
include("${BOOT_EXTRAS_A}")
on-resource config.txt { fat_write(${BOOT_A_PART_OFFSET}, "config.txt") }
on-resource cmdline.txt { fat_write(${BOOT_A_PART_OFFSET}, "cmdline.txt") }
on-resource start.elf { fat_write(${BOOT_A_PART_OFFSET}, "start.elf") }
Expand Down Expand Up @@ -342,9 +334,7 @@ task upgrade.a {
# Write the new boot partition files and rootfs. The MBR still points
# to the B partition, so an error or power failure during this part
# won't hurt anything.
on-resource recovery.bin { fat_write(${BOOT_A_PART_OFFSET}, "recovery.bin") }
on-resource pieeprom.upd { fat_write(${BOOT_A_PART_OFFSET}, "pieeprom.upd") }
on-resource pieeprom.sig { fat_write(${BOOT_A_PART_OFFSET}, "pieeprom.sig") }
include("${BOOT_EXTRAS_A}")
on-resource config.txt { fat_write(${BOOT_A_PART_OFFSET}, "config.txt") }
on-resource cmdline.txt { fat_write(${BOOT_A_PART_OFFSET}, "cmdline.txt") }
on-resource start.elf { fat_write(${BOOT_A_PART_OFFSET}, "start.elf") }
Expand Down Expand Up @@ -430,9 +420,7 @@ task upgrade.a-old {
# Write the new boot partition files and rootfs. The MBR still points
# to the B partition, so an error or power failure during this part
# won't hurt anything.
on-resource recovery.bin { fat_write(${BOOT_A_PART_OFFSET}, "recovery.bin") }
on-resource pieeprom.upd { fat_write(${BOOT_A_PART_OFFSET}, "pieeprom.upd") }
on-resource pieeprom.sig { fat_write(${BOOT_A_PART_OFFSET}, "pieeprom.sig") }
include("${BOOT_EXTRAS_A}")
on-resource config.txt { fat_write(${BOOT_A_PART_OFFSET}, "config.txt") }
on-resource cmdline.txt { fat_write(${BOOT_A_PART_OFFSET}, "cmdline.txt") }
on-resource start.elf { fat_write(${BOOT_A_PART_OFFSET}, "start.elf") }
Expand Down Expand Up @@ -516,9 +504,7 @@ task upgrade.b {
# Write the new boot partition files and rootfs. The MBR still points
# to the A partition, so an error or power failure during this part
# won't hurt anything.
on-resource recovery.bin { fat_write(${BOOT_B_PART_OFFSET}, "recovery.bin") }
on-resource pieeprom.upd { fat_write(${BOOT_B_PART_OFFSET}, "pieeprom.upd") }
on-resource pieeprom.sig { fat_write(${BOOT_B_PART_OFFSET}, "pieeprom.sig") }
include("${BOOT_EXTRAS_B}")
on-resource config.txt { fat_write(${BOOT_B_PART_OFFSET}, "config.txt") }
on-resource cmdline.txt { fat_write(${BOOT_B_PART_OFFSET}, "cmdline.txt") }
on-resource start.elf { fat_write(${BOOT_B_PART_OFFSET}, "start.elf") }
Expand Down Expand Up @@ -602,9 +588,7 @@ task upgrade.b-old {
# Write the new boot partition files and rootfs. The MBR still points
# to the A partition, so an error or power failure during this part
# won't hurt anything.
on-resource recovery.bin { fat_write(${BOOT_B_PART_OFFSET}, "recovery.bin") }
on-resource pieeprom.upd { fat_write(${BOOT_B_PART_OFFSET}, "pieeprom.upd") }
on-resource pieeprom.sig { fat_write(${BOOT_B_PART_OFFSET}, "pieeprom.sig") }
include("${BOOT_EXTRAS_B}")
on-resource config.txt { fat_write(${BOOT_B_PART_OFFSET}, "config.txt") }
on-resource cmdline.txt { fat_write(${BOOT_B_PART_OFFSET}, "cmdline.txt") }
on-resource start.elf { fat_write(${BOOT_B_PART_OFFSET}, "start.elf") }
Expand Down
6 changes: 6 additions & 0 deletions fwup_include/boot_extras_a.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Support for defing extra files for inclusion in Nerves firmware image
#
# For example:
# on-resource recovery.bin { fat_write(${BOOT_A_PART_OFFSET}, "recovery.bin") }
# on-resource pieeprom.upd { fat_write(${BOOT_A_PART_OFFSET}, "pieeprom.upd") }
# on-resource pieeprom.sig { fat_write(${BOOT_A_PART_OFFSET}, "pieeprom.sig") }
6 changes: 6 additions & 0 deletions fwup_include/boot_extras_b.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Support for defing extra files for inclusion in Nerves firmware image
#
# For example:
# on-resource recovery.bin { fat_write(${BOOT_B_PART_OFFSET}, "recovery.bin") }
# on-resource pieeprom.upd { fat_write(${BOOT_B_PART_OFFSET}, "pieeprom.upd") }
# on-resource pieeprom.sig { fat_write(${BOOT_B_PART_OFFSET}, "pieeprom.sig") }
13 changes: 13 additions & 0 deletions fwup_include/boot_extras_define.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Support for defing extra files for inclusion in Nerves firmware image
#
# For example:
#
#file-resource recovery.bin {
# host-path = "${NERVES_APP}/bootfs_overlay/recovery.bin"
#}
#file-resource pieeprom.upd {
# host-path = "${NERVES_APP}/bootfs_overlay/pieeprom.upd"
#}
#file-resource pieeprom.sig {
# host-path = "${NERVES_APP}/bootfs_overlay/pieeprom.sig"
#}

0 comments on commit a3e6048

Please sign in to comment.