Skip to content

Commit

Permalink
merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielburnworth committed Apr 27, 2024
2 parents 12835da + 9decc39 commit d26c626
Show file tree
Hide file tree
Showing 10 changed files with 343 additions and 151 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
exec: &exec
name: build-tools/nerves-system-br
version: 1.23.2
elixir: 1.15.2-otp-26
version: 1.27.0
elixir: 1.16.2-otp-26

version: 2.1

Expand Down
88 changes: 88 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,94 @@ follows:
releases, and Linux kernel updates. They're also made to fix bugs and add
features to the build infrastructure.

## v1.27.0

This is a major Buildroot update.

Please see the [nerves_system_br v1.27.0 release notes](https://github.com/nerves-project/nerves_system_br/releases/tag/v1.26.0)
for upgrade instructions if you've forked this system.

* Changes
* The `libcamera` and `rpicam_apps` packages have been replaced with the
Raspberry Pi-forked versions for better compatibility. Please see
`nerves_system_br` release notes.

* Updated dependencies
* Linux 6.1.73 (Raspberry Pi 20240124 release)
* [nerves_system_br v1.27.0](https://github.com/nerves-project/nerves_system_br/releases/tag/v1.27.0)
* [Buildroot 2024.02](https://lore.kernel.org/buildroot/[email protected]/)
* [Erlang/OTP 26.2.3](https://erlang.org/download/OTP-26.2.3.README)

## v1.26.0

This is a major Buildroot update.

Please see the [nerves_system_br v1.26.0 release notes](https://github.com/nerves-project/nerves_system_br/releases/tag/v1.26.0)
for upgrade instructions if you've forked this system.

* Updated dependencies
* [Erlang/OTP 26.2.2](https://erlang.org/download/OTP-26.2.2.README)
* [nerves_system_br v1.26.1](https://github.com/nerves-project/nerves_system_br/releases/tag/v1.26.1)
* [Buildroot 2023.11.1](https://lore.kernel.org/buildroot/[email protected]/T/)

## v1.25.2

This is a security/bug fix update.

* Package updates
* [Erlang/OTP 26.2.1](https://erlang.org/download/OTP-26.2.1.README)
* [nerves_heart 2.3.0](https://github.com/nerves-project/nerves_heart/releases/tag/v2.3.0)

## v1.25.1

This fixes an accidental regression in 1.25.0 with the Linux 6.1 update. The
Linux configuration wasn't updated correctly and it didn't work. This release
has the fixed configuration.

## v1.25.0

This is a major Buildroot, toolchain, and Linux kernel update that also adds
support for using Scenic without customizing the system.

Please see [nerves_system_br v1.25.0 release notes](https://github.com/nerves-project/nerves_system_br/releases/tag/v1.25.0)
for upgrade instructions if you've forked this system.

* New features
* Add libcairo for [Scenic](https://github.com/ScenicFramework/scenic) support

* Updated dependencies
* Linux 6.1.63 (Raspberry Pi stable_20231123 release)
* [nerves_system_br v1.25.2](https://github.com/nerves-project/nerves_system_br/releases/tag/v1.25.2)
* [Buildroot 2023.08.4](https://lore.kernel.org/buildroot/[email protected]/T/)
* [Erlang/OTP 26.1.2](https://erlang.org/download/OTP-26.1.2.README)

## v1.24.1

This is a security/bug fix update.

* Package updates
* [nerves_system_br v1.24.1](https://github.com/nerves-project/nerves_system_br/releases/tag/v1.24.1)
* [Erlang/OTP 26.1.1](https://erlang.org/download/OTP-26.1.1.README)
* [Buildroot 2023.05.3](https://lore.kernel.org/buildroot/[email protected]/T/)

## v1.24.0

This is a Buildroot version update that appears to mostly contain bug and
security fixes. It should be a low risk upgrade from v1.23.2.

* New features
* Support factory reset, preventing firmware reverts. See [Nerves.Runtime.FwupOps](https://hexdocs.pm/nerves_runtime/Nerves.Runtime.FwupOps.html)

* Updated dependencies
* [nerves_system_br v1.24.0](https://github.com/nerves-project/nerves_system_br/releases/tag/v1.24.0)
* [Buildroot 2023.05.2](https://lore.kernel.org/buildroot/[email protected]/T/), [2023.05.1](https://lore.kernel.org/buildroot/[email protected]/T/), [2023.05](https://lore.kernel.org/buildroot/[email protected]/T/)
* [Erlang/OTP 26.1](https://erlang.org/download/OTP-26.1.README)

## v1.23.2

* Updated dependencies
* [nerves_system_br v1.23.3](https://github.com/nerves-project/nerves_system_br/releases/tag/v1.23.3)

## v1.23.1

This is a bug and security fix update. It should be a low risk upgrade.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This is the base Nerves System configuration for the Raspberry Pi 3 Model B.
| CPU | 1.2 GHz quad-core Cortex-A53 (ARMv8) |
| Memory | 1 GB DRAM |
| Storage | MicroSD |
| Linux kernel | 5.15 w/ Raspberry Pi patches |
| Linux kernel | 6.1 w/ Raspberry Pi patches |
| IEx terminal | HDMI and USB keyboard (can be changed to UART) |
| GPIO, I2C, SPI | Yes - [Elixir Circuits](https://github.com/elixir-circuits) |
| ADC | No |
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.23.1-farmbot.1
1.27.0-farmbot.1
115 changes: 95 additions & 20 deletions fwup-revert.conf → fwup-ops.conf
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
# Revert firmware for the Raspberry Pi 3
# Post-installation firmware operations for the Raspberry Pi 3
#
# Tasks include:
#
# * `factory-reset` - Clear out the writable filesystem and any other writable
# areas so that they can be re-initialized on the next boot.
# * `prevent-revert` - Prevent `revert` from working until the next firmware
# * `revert` - Revert to the previous firmware if it's still available
# * `validate` - Mark this firmware as a good update.
# * `status` - Print out which partition is active (`a` or `b`)
#
# To use:
# 1. Run `fwup -c -f fwup-revert.conf -o revert.fw` and copy revert.fw to
# the device. This is done automatically as part of the Nerves system
# build process. The file is stored in `/usr/share/fwup/revert.fw`.
# 2. On the device, run `fwup -t revert revert.fw -d $NERVES_FW_DEVPATH`. If
# it succeeds, reboot. If not, then it's possible that there isn't a previous
# firmware or the metadata about what's stored where is corrupt or out of
# sync.
#
# 1. Run `fwup -c -f fwup-ops.conf -o ops.fw` and copy ops.fw to
# the device. This is done automatically as part of the Nerves system
# build process. The file is stored in `/usr/share/fwup/ops.fw`.
# 2. On the device, run `fwup -t <task> -d /dev/rootdisk0 --enable-trim /usr/share/fwup/ops.fw`.
# 3. Reboot after running `revert` or `factory-reset`.
#
# It is critical that this is kept in sync with the main fwup.conf.

require-fwup-version="0.19.0"
require-fwup-version="1.0.0"

#
# Firmware metadata
Expand All @@ -30,16 +38,8 @@ define(NERVES_FW_PLATFORM, "rpi3")
define(NERVES_FW_ARCHITECTURE, "arm")
define(NERVES_FW_AUTHOR, "The Farmbot Team")

define(NERVES_FW_DEVPATH, "/dev/mmcblk0")
define(NERVES_FW_APPLICATION_PART0_DEVPATH, "/dev/mmcblk0p3") # Linux part number is 1-based
define(NERVES_FW_APPLICATION_PART0_FSTYPE, "ext4")
define(NERVES_FW_APPLICATION_PART0_TARGET, "/root")

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

# This configuration file will create an image that has an MBR and the
# following 3 partitions:
# This configuration file will create an image that
# has an MBR and the following layout:
#
# +----------------------------+
# | MBR |
Expand Down Expand Up @@ -150,6 +150,65 @@ uboot-environment uboot-env {
block-count = ${UBOOT_ENV_COUNT}
}

##
# factory-reset
##
task factory-reset {
on-init {
info("Erasing all writable data")
# This requires --enable-trim
# Trim may not work on MicroSD card, so don't rely on it
trim(${APP_PART_OFFSET}, ${APP_PART_COUNT})
raw_memset(${APP_PART_OFFSET}, 256, 0xff)
}
}

##
# prevent-revert
#
# Pass `--enable-trim` to also clear out the partition that no longer should be used.
##
task prevent-revert.a {
# Check that we're running on B
require-partition-offset(0, ${BOOT_B_PART_OFFSET})
require-partition-offset(1, ${ROOTFS_B_PART_OFFSET})
require-uboot-variable(uboot-env, "nerves_fw_active", "b")

on-init {
info("Preventing reverts to partition A")
# Remove U-Boot variables that fwup uses to allow reverting images
uboot_unsetenv(uboot-env, "a.nerves_fw_platform")
uboot_unsetenv(uboot-env, "a.nerves_fw_architecture")
# Clear out the old image using TRIM. This requires --enable-trim
trim(${ROOTFS_A_PART_OFFSET}, ${ROOTFS_A_PART_COUNT})
trim(${BOOT_A_PART_OFFSET}, ${BOOT_A_PART_COUNT})
}
}
task prevent-revert.b {
# Check that we're running on A
require-partition-offset(0, ${BOOT_A_PART_OFFSET})
require-partition-offset(1, ${ROOTFS_A_PART_OFFSET})
require-uboot-variable(uboot-env, "nerves_fw_active", "a")

on-init {
info("Preventing reverts to partition B")
# Remove U-Boot variables that fwup uses to allow reverting images
uboot_unsetenv(uboot-env, "b.nerves_fw_platform")
uboot_unsetenv(uboot-env, "b.nerves_fw_architecture")
# Clear out the image using TRIM. This requires --enable-trim
trim(${ROOTFS_B_PART_OFFSET}, ${ROOTFS_B_PART_COUNT})
trim(${BOOT_B_PART_OFFSET}, ${BOOT_B_PART_COUNT})
}
}
task prevent-revert.fail {
on-init {
error("Error detecting active partition")
}
}

##
# revert
##
task revert.a {
# This task reverts to the A partition, so check that we're running on B
require-partition-offset(0, ${BOOT_B_PART_OFFSET})
Expand Down Expand Up @@ -211,7 +270,11 @@ task revert.wrongplatform {
}
}

# Run "fwup /usr/share/fwup/revert.fw -t status -d /dev/mmcblk0 -q -U" to check the status.
##
# status
#
# Run "fwup /usr/share/fwup/ops.fw -t status -d /dev/rootdisk0 -q -U" to check the status.
##
task status.aa {
require-path-at-offset("/", ${ROOTFS_A_PART_OFFSET})
require-uboot-variable(uboot-env, "nerves_fw_active", "a")
Expand All @@ -235,3 +298,15 @@ task status.ba {
task status.fail {
on-init { error("fail") }
}

##
# validate
#
# The fwup configuration for this device always validates, so this doesn't do anything.
##
task validate {
on-init {
info("Validate")
uboot_setenv(uboot-env, "nerves_fw_validated", "1")
}
}
Loading

0 comments on commit d26c626

Please sign in to comment.