Giter VIP home page Giter VIP logo

Comments (5)

fhunleth avatar fhunleth commented on August 26, 2024

I have not done this, but I would expect the process to be adding a line to the config.txt to add the appropriate device tree file and then to add that device tree file to the fwup.conf to make sure that it gets put on the Raspberry Pi's boot partition. There's some info on modifying fwup.conf at https://hexdocs.pm/nerves/advanced-configuration.html#overwriting-files-in-the-boot-partition.

If you've done this, could you post what you did?

from nerves_system_rpi4.

umerkiani avatar umerkiani commented on August 26, 2024

I tried to follow the documentation along but that didn't help

My Config.txt file is

config.txt

My fwup.conf file looks like this
fwup.txt

After following all the changes I am still unable to enable second UART of RPI4.

from nerves_system_rpi4.

fhunleth avatar fhunleth commented on August 26, 2024

It looks like you need to add:

dtoverlay=uart2

to your config.txt.

Since I don't know this for sure, I'd recommend manually modifying the config.txt file on the MicroSD card until you get something to work and then copy that over to the version of config.txt in your project.

from nerves_system_rpi4.

greghgradwell avatar greghgradwell commented on August 26, 2024

@umerkiani I couldn't get the additional UARTs to show up until I added the device tree overlays to the fwup.conf file: https://hexdocs.pm/nerves/advanced-configuration.html#device-tree-overlays
I had already made the changes Frank mentioned to the config.txt file (lines 52-54).

For example, I added UART3, UART4, and UART5 with an fwup.conf like this: fwup.txt
If you search for "uart3", "uart4" or "uart5" you'll see the lines that I added.

from nerves_system_rpi4.

umerkiani avatar umerkiani commented on August 26, 2024

I solved this by customising config.txt file and fwup.txt file

`# Default Nerves RPi 4 config.txt

It's possible to override this file by using a custom fwup.conf

configuration to pull in a replacement.

Useful links:

http://rpf.io/configtxt

https://www.raspberrypi.org/documentation/configuration/device-tree.md

https://github.com/raspberrypi/documentation/blob/master/configuration/device-tree.md

https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README

Disable the boot rainbow

disable_splash=1

This, along with the Raspberry Pi "x" firmware is needed for the camera

to work. The Raspberry Pi "x" firmware is selected via the Buildroot

configuration. See Target packages->Hardware handling->Firmware.

gpu_mem=192

Enable I2C, SPI, and audio

dtparam=i2c_arm=on
dtparam=spi=on
dtparam=audio=on

Enable drivers for the Raspberry Pi 7" Touchscreen

This makes it possible to run Scenic out of the box with the popular

Raspberry Pi 7" Touchscreen. It appears to be harmless for non-touchscreen

users, but if not, let us know!

NOTE: The touchscreen seems to work fine with these commented out on the RPi4

#dtoverlay=rpi-ft5406
#dtoverlay=rpi-backlight

Comment this in or modify to enable OneWire

NOTE: check that the overlay that you specify is in the boot partition or

this won't work.

#dtoverlay=w1-gpio-pullup,gpiopin=4

The ramoops overlay works with the pstore driver to preserve crash

information across reboots in DRAM

dtoverlay=ramoops

Enable the UART (/dev/ttyS0)

enable_uart=1

dtoverlay=uart2
dtoverlay=uart3
dtoverlay=uart4
dtoverlay=uart5

Enable DRM VC4 V3D driver on top of the dispmanx display stack

#dtoverlay=vc4-fkms-v3d
#max_framebuffers=2

`

and added overlay files to fwup.txt file

`# Firmware configuration file for the Raspberry Pi 4

require-fwup-version="0.15.0" # For the trim() call

Firmware metadata

All of these can be overriden using environment variables of the same name.

Run 'fwup -m' to query values in a .fw file.

Use 'fw_printenv' to query values on the target.

These are used by Nerves libraries to introspect.

define(NERVES_FW_PRODUCT, "Nerves Firmware")
define(NERVES_FW_DESCRIPTION, "")
define(NERVES_FW_VERSION, "${NERVES_SDK_VERSION}")
define(NERVES_FW_PLATFORM, "rpi4")
define(NERVES_FW_ARCHITECTURE, "arm")
define(NERVES_FW_AUTHOR, "The Nerves 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, "f2fs")
define(NERVES_FW_APPLICATION_PART0_TARGET, "/root")
define(NERVES_PROVISIONING, "${NERVES_SYSTEM}/images/fwup_include/provisioning.conf")

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:

+----------------------------+

| MBR |

+----------------------------+

| Firmware configuration data|

| (formatted as uboot env) |

+----------------------------+

| p0*: Boot A (FAT32) |

| zImage, start.elf, |

| config.txt, etc. |

+----------------------------+

| p0*: Boot B (FAT32) |

+----------------------------+

| p1*: Rootfs A (squashfs) |

+----------------------------+

| p1*: Rootfs B (squashfs) |

+----------------------------+

| p2: Application (f2fs) |

+----------------------------+

The p0/p1 partition points to whichever of configurations A or B that is

active.

The image is sized to be less than 1 GB so that it fits on nearly any SDCard

around. If you have a larger SDCard and need more space, feel free to bump

the partition sizes below.

The Raspberry Pi is incredibly picky on the partition sizes and in ways that

I don't understand. Test changes one at a time to make sure that they boot.

(Sizes are in 512 byte blocks)

define(UBOOT_ENV_OFFSET, 16)
define(UBOOT_ENV_COUNT, 16) # 8 KB

define(BOOT_A_PART_OFFSET, 63)
define(BOOT_A_PART_COUNT, 38630)
define-eval(BOOT_B_PART_OFFSET, "${BOOT_A_PART_OFFSET} + ${BOOT_A_PART_COUNT}")
define(BOOT_B_PART_COUNT, ${BOOT_A_PART_COUNT})

Let the rootfs have room to grow up to 128 MiB and align it to the nearest 1

MB boundary

define(ROOTFS_A_PART_OFFSET, 77324)
define(ROOTFS_A_PART_COUNT, 289044)
define-eval(ROOTFS_B_PART_OFFSET, "${ROOTFS_A_PART_OFFSET} + ${ROOTFS_A_PART_COUNT}")
define(ROOTFS_B_PART_COUNT, ${ROOTFS_A_PART_COUNT})

Application partition. This partition can occupy all of the remaining space.

Size it to fit the destination.

define-eval(APP_PART_OFFSET, "${ROOTFS_B_PART_OFFSET} + ${ROOTFS_B_PART_COUNT}")
define(APP_PART_COUNT, 1048576)

Firmware archive metadata

meta-product = ${NERVES_FW_PRODUCT}
meta-description = ${NERVES_FW_DESCRIPTION}
meta-version = ${NERVES_FW_VERSION}
meta-platform = ${NERVES_FW_PLATFORM}
meta-architecture = ${NERVES_FW_ARCHITECTURE}
meta-author = ${NERVES_FW_AUTHOR}
meta-vcs-identifier = ${NERVES_FW_VCS_IDENTIFIER}
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 fixup.dat {
host-path = "${NERVES_SYSTEM}/images/rpi-firmware/fixup.dat"
}
file-resource start.elf {
host-path = "${NERVES_SYSTEM}/images/rpi-firmware/start.elf"
}
file-resource config.txt {
host-path = "${NERVES_SYSTEM}/images/config.txt"
}
file-resource cmdline.txt {
host-path = "${NERVES_SYSTEM}/images/cmdline.txt"
}
file-resource zImage {
host-path = "${NERVES_SYSTEM}/images/zImage"
}
file-resource bcm2711-rpi-4-b.dtb {
host-path = "${NERVES_SYSTEM}/images/bcm2711-rpi-4-b.dtb"
}
file-resource rpi-ft5406.dtbo {
host-path = "${NERVES_SYSTEM}/images/rpi-firmware/overlays/rpi-ft5406.dtbo"
}
file-resource rpi-backlight.dtbo {
host-path = "${NERVES_SYSTEM}/images/rpi-firmware/overlays/rpi-backlight.dtbo"
}
file-resource w1-gpio-pullup.dtbo {
host-path = "${NERVES_SYSTEM}/images/rpi-firmware/overlays/w1-gpio-pullup.dtbo"
}
file-resource pi3-miniuart-bt.dtbo {
host-path = "${NERVES_SYSTEM}/images/rpi-firmware/overlays/pi3-miniuart-bt.dtbo"
}
file-resource vc4-fkms-v3d.dtbo {
host-path = "${NERVES_SYSTEM}/images/rpi-firmware/overlays/vc4-fkms-v3d.dtbo"
}
file-resource uart2.dtbo {
host-path = "${NERVES_SYSTEM}/images/rpi-firmware/overlays/uart2.dtbo"
}
file-resource uart3.dtbo {
host-path = "${NERVES_SYSTEM}/images/rpi-firmware/overlays/uart3.dtbo"
}
file-resource uart4.dtbo {
host-path = "${NERVES_SYSTEM}/images/rpi-firmware/overlays/uart4.dtbo"
}
file-resource uart5.dtbo {
host-path = "${NERVES_SYSTEM}/images/rpi-firmware/overlays/uart5.dtbo"
}
file-resource ramoops.dtbo {
host-path = "${NERVES_SYSTEM}/images/ramoops.dtb"
}

file-resource rootfs.img {
host-path = ${ROOTFS}

# Error out if the rootfs size exceeds the partition size
assert-size-lte = ${ROOTFS_A_PART_COUNT}

}

mbr mbr-a {
partition 0 {
block-offset = ${BOOT_A_PART_OFFSET}
block-count = ${BOOT_A_PART_COUNT}
type = 0xc # FAT32
boot = true
}
partition 1 {
block-offset = ${ROOTFS_A_PART_OFFSET}
block-count = ${ROOTFS_A_PART_COUNT}
type = 0x83 # Linux
}
partition 2 {
block-offset = ${APP_PART_OFFSET}
block-count = ${APP_PART_COUNT}
type = 0x83 # Linux
expand = true
}
# partition 3 is unused
}

mbr mbr-b {
partition 0 {
block-offset = ${BOOT_B_PART_OFFSET}
block-count = ${BOOT_B_PART_COUNT}
type = 0xc # FAT32
boot = true
}
partition 1 {
block-offset = ${ROOTFS_B_PART_OFFSET}
block-count = ${ROOTFS_B_PART_COUNT}
type = 0x83 # Linux
}
partition 2 {
block-offset = ${APP_PART_OFFSET}
block-count = ${APP_PART_COUNT}
type = 0x83 # Linux
expand = true
}
# partition 3 is unused
}

Location where installed firmware information is stored.

While this is called "u-boot", u-boot isn't involved in this

setup. It just provides a convenient key/value store format.

uboot-environment uboot-env {
block-offset = ${UBOOT_ENV_OFFSET}
block-count = ${UBOOT_ENV_COUNT}
}

This firmware task writes everything to the destination media

task complete {
# Only match if not mounted
require-unmounted-destination = true

on-init {
    mbr_write(mbr-a)

    fat_mkfs(${BOOT_A_PART_OFFSET}, ${BOOT_A_PART_COUNT})
    fat_setlabel(${BOOT_A_PART_OFFSET}, "BOOT-A")
    fat_mkdir(${BOOT_A_PART_OFFSET}, "overlays")

    uboot_clearenv(uboot-env)

    include("${NERVES_PROVISIONING}")

    uboot_setenv(uboot-env, "nerves_fw_active", "a")
    uboot_setenv(uboot-env, "nerves_fw_devpath", ${NERVES_FW_DEVPATH})
    uboot_setenv(uboot-env, "a.nerves_fw_application_part0_devpath", ${NERVES_FW_APPLICATION_PART0_DEVPATH})
    uboot_setenv(uboot-env, "a.nerves_fw_application_part0_fstype", ${NERVES_FW_APPLICATION_PART0_FSTYPE})
    uboot_setenv(uboot-env, "a.nerves_fw_application_part0_target", ${NERVES_FW_APPLICATION_PART0_TARGET})
    uboot_setenv(uboot-env, "a.nerves_fw_product", ${NERVES_FW_PRODUCT})
    uboot_setenv(uboot-env, "a.nerves_fw_description", ${NERVES_FW_DESCRIPTION})
    uboot_setenv(uboot-env, "a.nerves_fw_version", ${NERVES_FW_VERSION})
    uboot_setenv(uboot-env, "a.nerves_fw_platform", ${NERVES_FW_PLATFORM})
    uboot_setenv(uboot-env, "a.nerves_fw_architecture", ${NERVES_FW_ARCHITECTURE})
    uboot_setenv(uboot-env, "a.nerves_fw_author", ${NERVES_FW_AUTHOR})
    uboot_setenv(uboot-env, "a.nerves_fw_vcs_identifier", ${NERVES_FW_VCS_IDENTIFIER})
    uboot_setenv(uboot-env, "a.nerves_fw_misc", ${NERVES_FW_MISC})
    uboot_setenv(uboot-env, "a.nerves_fw_uuid", "\${FWUP_META_UUID}")
}

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") }
on-resource fixup.dat { fat_write(${BOOT_A_PART_OFFSET}, "fixup.dat") }
on-resource zImage { fat_write(${BOOT_A_PART_OFFSET}, "kernel7.img") }
on-resource bcm2711-rpi-4-b.dtb { fat_write(${BOOT_A_PART_OFFSET}, "bcm2711-rpi-4-b.dtb") }
on-resource rpi-ft5406.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/rpi-ft5406.dtbo") }
on-resource rpi-backlight.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/rpi-backlight.dtbo") }
on-resource w1-gpio-pullup.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo") }
on-resource pi3-miniuart-bt.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/pi3-miniuart-bt.dtbo") }
on-resource vc4-fkms-v3d.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/vc4-fkms-v3d.dtbo") }
on-resource uart2.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/uart2.dtbo") }
on-resource uart3.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/uart3.dtbo") }
on-resource uart4.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/uart4.dtbo") }
on-resource uart5.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/uart5.dtbo") }
on-resource ramoops.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/ramoops.dtbo") }

on-resource rootfs.img {
    # write to the first rootfs partition
    raw_write(${ROOTFS_A_PART_OFFSET})
}

on-finish {
    # Clear out any old data in the B partition that might be mistaken for
    # a file system. This is mostly to avoid confusion in humans when
    # reprogramming SDCards with unknown contents.
    raw_memset(${BOOT_B_PART_OFFSET}, 256, 0xff)
    raw_memset(${ROOTFS_B_PART_OFFSET}, 256, 0xff)

    # Invalidate the application data partition so that it is guaranteed to
    # trigger the corrupt filesystem detection code on first boot and get
    # formatted. If this isn't done and an old SDCard is reused, the
    # application data could be in a weird state.
    raw_memset(${APP_PART_OFFSET}, 256, 0xff)
}

}

task upgrade.a {
# This task upgrades the A partition
require-partition-offset(1, ${ROOTFS_B_PART_OFFSET})

# Verify the expected platform/architecture
require-uboot-variable(uboot-env, "b.nerves_fw_platform", "${NERVES_FW_PLATFORM}")
require-uboot-variable(uboot-env, "b.nerves_fw_architecture", "${NERVES_FW_ARCHITECTURE}")

on-init {
    info("Upgrading partition A")

    # Clear some firmware information just in case this update gets
    # interrupted midway. If this partition was bootable, it's not going to
    # be soon.
    uboot_unsetenv(uboot-env, "a.nerves_fw_version")
    uboot_unsetenv(uboot-env, "a.nerves_fw_platform")
    uboot_unsetenv(uboot-env, "a.nerves_fw_architecture")
    uboot_unsetenv(uboot-env, "a.nerves_fw_uuid")

    # Reset the previous contents of the A boot partition
    fat_mkfs(${BOOT_A_PART_OFFSET}, ${BOOT_A_PART_COUNT})
    fat_setlabel(${BOOT_A_PART_OFFSET}, "BOOT-A")
    fat_mkdir(${BOOT_A_PART_OFFSET}, "overlays")

    # Indicate that the entire partition can be cleared
    trim(${ROOTFS_A_PART_OFFSET}, ${ROOTFS_A_PART_COUNT})
}

# 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 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") }
on-resource fixup.dat { fat_write(${BOOT_A_PART_OFFSET}, "fixup.dat") }
on-resource zImage { fat_write(${BOOT_A_PART_OFFSET}, "kernel7.img") }
on-resource bcm2711-rpi-4-b.dtb { fat_write(${BOOT_A_PART_OFFSET}, "bcm2711-rpi-4-b.dtb") }
on-resource rpi-ft5406.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/rpi-ft5406.dtbo") }
on-resource rpi-backlight.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/rpi-backlight.dtbo") }
on-resource w1-gpio-pullup.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo") }
on-resource pi3-miniuart-bt.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/pi3-miniuart-bt.dtbo") }
on-resource vc4-fkms-v3d.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/vc4-fkms-v3d.dtbo") }
on-resource uart2.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/uart2.dtbo") }
on-resource uart3.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/uart3.dtbo") }
on-resource uart4.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/uart4.dtbo") }
on-resource uart5.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/uart5.dtbo") }
on-resource ramoops.dtbo { fat_write(${BOOT_A_PART_OFFSET}, "overlays/ramoops.dtbo") }
on-resource rootfs.img {
    delta-source-raw-offset=${ROOTFS_B_PART_OFFSET}
    delta-source-raw-count=${ROOTFS_B_PART_COUNT}
    raw_write(${ROOTFS_A_PART_OFFSET})
}

on-finish {
    # Update firmware metadata
    uboot_setenv(uboot-env, "a.nerves_fw_application_part0_devpath", ${NERVES_FW_APPLICATION_PART0_DEVPATH})
    uboot_setenv(uboot-env, "a.nerves_fw_application_part0_fstype", ${NERVES_FW_APPLICATION_PART0_FSTYPE})
    uboot_setenv(uboot-env, "a.nerves_fw_application_part0_target", ${NERVES_FW_APPLICATION_PART0_TARGET})
    uboot_setenv(uboot-env, "a.nerves_fw_product", ${NERVES_FW_PRODUCT})
    uboot_setenv(uboot-env, "a.nerves_fw_description", ${NERVES_FW_DESCRIPTION})
    uboot_setenv(uboot-env, "a.nerves_fw_version", ${NERVES_FW_VERSION})
    uboot_setenv(uboot-env, "a.nerves_fw_platform", ${NERVES_FW_PLATFORM})
    uboot_setenv(uboot-env, "a.nerves_fw_architecture", ${NERVES_FW_ARCHITECTURE})
    uboot_setenv(uboot-env, "a.nerves_fw_author", ${NERVES_FW_AUTHOR})
    uboot_setenv(uboot-env, "a.nerves_fw_vcs_identifier", ${NERVES_FW_VCS_IDENTIFIER})
    uboot_setenv(uboot-env, "a.nerves_fw_misc", ${NERVES_FW_MISC})
    uboot_setenv(uboot-env, "a.nerves_fw_uuid", "\${FWUP_META_UUID}")

# Switch over to boot the new firmware
    uboot_setenv(uboot-env, "nerves_fw_active", "a")
    mbr_write(mbr-a)
}

on-error {
}

}

task upgrade.b {
# This task upgrades the B partition
require-partition-offset(1, ${ROOTFS_A_PART_OFFSET})

# Verify the expected platform/architecture
require-uboot-variable(uboot-env, "a.nerves_fw_platform", "${NERVES_FW_PLATFORM}")
require-uboot-variable(uboot-env, "a.nerves_fw_architecture", "${NERVES_FW_ARCHITECTURE}")

on-init {
    info("Upgrading partition B")

    # Clear some firmware information just in case this update gets
    # interrupted midway.
    uboot_unsetenv(uboot-env, "b.nerves_fw_version")
    uboot_unsetenv(uboot-env, "b.nerves_fw_platform")
    uboot_unsetenv(uboot-env, "b.nerves_fw_architecture")
    uboot_unsetenv(uboot-env, "b.nerves_fw_uuid")

    # Reset the previous contents of the B boot partition
    fat_mkfs(${BOOT_B_PART_OFFSET}, ${BOOT_B_PART_COUNT})
    fat_setlabel(${BOOT_B_PART_OFFSET}, "BOOT-B")
    fat_mkdir(${BOOT_B_PART_OFFSET}, "overlays")

    trim(${ROOTFS_B_PART_OFFSET}, ${ROOTFS_B_PART_COUNT})
}

# 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 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") }
on-resource fixup.dat { fat_write(${BOOT_B_PART_OFFSET}, "fixup.dat") }
on-resource zImage { fat_write(${BOOT_B_PART_OFFSET}, "kernel7.img") }
on-resource bcm2711-rpi-4-b.dtb { fat_write(${BOOT_B_PART_OFFSET}, "bcm2711-rpi-4-b.dtb") }
on-resource rpi-ft5406.dtbo { fat_write(${BOOT_B_PART_OFFSET}, "overlays/rpi-ft5406.dtbo") }
on-resource rpi-backlight.dtbo { fat_write(${BOOT_B_PART_OFFSET}, "overlays/rpi-backlight.dtbo") }
on-resource w1-gpio-pullup.dtbo { fat_write(${BOOT_B_PART_OFFSET}, "overlays/w1-gpio-pullup.dtbo") }
on-resource pi3-miniuart-bt.dtbo { fat_write(${BOOT_B_PART_OFFSET}, "overlays/pi3-miniuart-bt.dtbo") }
on-resource vc4-fkms-v3d.dtbo { fat_write(${BOOT_B_PART_OFFSET}, "overlays/vc4-fkms-v3d.dtbo") }
on-resource uart2.dtbo { fat_write(${BOOT_B_PART_OFFSET}, "overlays/uart2.dtbo") }
on-resource uart3.dtbo { fat_write(${BOOT_B_PART_OFFSET}, "overlays/uart3.dtbo") }
on-resource uart4.dtbo { fat_write(${BOOT_B_PART_OFFSET}, "overlays/uart4.dtbo") }
on-resource uart5.dtbo { fat_write(${BOOT_B_PART_OFFSET}, "overlays/uart5.dtbo") }
on-resource ramoops.dtbo { fat_write(${BOOT_B_PART_OFFSET}, "overlays/ramoops.dtbo") }
on-resource rootfs.img {
    delta-source-raw-offset=${ROOTFS_A_PART_OFFSET}
    delta-source-raw-count=${ROOTFS_A_PART_COUNT}
    raw_write(${ROOTFS_B_PART_OFFSET})
}

on-finish {
    # Update firmware metadata
    uboot_setenv(uboot-env, "b.nerves_fw_application_part0_devpath", ${NERVES_FW_APPLICATION_PART0_DEVPATH})
    uboot_setenv(uboot-env, "b.nerves_fw_application_part0_fstype", ${NERVES_FW_APPLICATION_PART0_FSTYPE})
    uboot_setenv(uboot-env, "b.nerves_fw_application_part0_target", ${NERVES_FW_APPLICATION_PART0_TARGET})
    uboot_setenv(uboot-env, "b.nerves_fw_product", ${NERVES_FW_PRODUCT})
    uboot_setenv(uboot-env, "b.nerves_fw_description", ${NERVES_FW_DESCRIPTION})
    uboot_setenv(uboot-env, "b.nerves_fw_version", ${NERVES_FW_VERSION})
    uboot_setenv(uboot-env, "b.nerves_fw_platform", ${NERVES_FW_PLATFORM})
    uboot_setenv(uboot-env, "b.nerves_fw_architecture", ${NERVES_FW_ARCHITECTURE})
    uboot_setenv(uboot-env, "b.nerves_fw_author", ${NERVES_FW_AUTHOR})
    uboot_setenv(uboot-env, "b.nerves_fw_vcs_identifier", ${NERVES_FW_VCS_IDENTIFIER})
    uboot_setenv(uboot-env, "b.nerves_fw_misc", ${NERVES_FW_MISC})
    uboot_setenv(uboot-env, "b.nerves_fw_uuid", "\${FWUP_META_UUID}")

# Switch over to boot the new firmware
    uboot_setenv(uboot-env, "nerves_fw_active", "b")
    mbr_write(mbr-b)
}

on-error {
}

}

task upgrade.unexpected {
require-uboot-variable(uboot-env, "a.nerves_fw_platform", "${NERVES_FW_PLATFORM}")
require-uboot-variable(uboot-env, "a.nerves_fw_architecture", "${NERVES_FW_ARCHITECTURE}")
on-init {
error("Please check the media being upgraded. It doesn't look like either the A or B partitions are active.")
}
}

task upgrade.wrongplatform {
on-init {
error("Expecting platform=${NERVES_FW_PLATFORM} and architecture=${NERVES_FW_ARCHITECTURE}")
}
}
`

from nerves_system_rpi4.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.