Current section

Files

Jump to
nerves_system_rpi fwup_include fwup-common.conf
Raw

fwup_include/fwup-common.conf

#
# 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, "rpi")
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/mmcblk0p7") # Linux part number is 1-based
define(NERVES_FW_APPLICATION_PART0_FSTYPE, "ext4")
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) |
# +----------------------------+
# | p1: Boot A (FAT32) |
# | zImage, bootcode.bin, |
# | config.txt, etc. |
# +----------------------------+
# | p2: Boot B (FAT32) |
# +----------------------------+
# | p0: Autoboot (FAT32) |
# +----------------------------+
# | p3: Extended partition |
# +----------------------------+
# | p4: Rootfs A (squashfs) |
# +----------------------------+
# | p5: Rootfs B (squashfs) |
# +----------------------------+
# | p6: Application (ext4) |
# +----------------------------+
#
# p0 comes after p1 and p2 to simplify upgrading Nerves Raspberry Pi images that
# predated the tryboot update.
#
# 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})
define-eval(AUTOBOOT_PART_OFFSET, "${BOOT_B_PART_OFFSET} + ${BOOT_B_PART_COUNT}")
define-eval(AUTOBOOT_PART_COUNT, 32749)
define-eval(EXTENDED_PART_OFFSET, "${AUTOBOOT_PART_OFFSET} + ${AUTOBOOT_PART_COUNT}")
# Let the rootfs have room to grow up to ~128 MiB. The offsets and sizes have been
# cleverly calculated so that APP_PART_OFFSET is the exact same when calculated
# via OLD_ROOTFS_B_PART_OFFSET+OLD_ROOTFS_B_PART_COUNT and ROOTFS_B_PART_OFFSET+ROOTFS_B_PART_COUNT.
# This lets us upgrade Raspberry Pis with the old partitioning scheme. If you don't
# care about this, delete everything that's "OLD_" or "old-" and change the partitions
# as you wish.
define(ROOTFS_A_PART_OFFSET, 110080)
define(ROOTFS_A_PART_COUNT, 272666)
define-eval(ROOTFS_B_PART_OFFSET, "${ROOTFS_A_PART_OFFSET} + ${ROOTFS_A_PART_COUNT}")
define(ROOTFS_B_PART_COUNT, ${ROOTFS_A_PART_COUNT})
define(OLD_ROOTFS_A_PART_OFFSET, 77324)
define(OLD_ROOTFS_A_PART_COUNT, 289044)
define-eval(OLD_ROOTFS_B_PART_OFFSET, "${OLD_ROOTFS_A_PART_OFFSET} + ${OLD_ROOTFS_A_PART_COUNT}")
define(OLD_ROOTFS_B_PART_COUNT, ${OLD_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}
mbr mbr {
partition 0 {
block-offset = ${AUTOBOOT_PART_OFFSET}
block-count = ${AUTOBOOT_PART_COUNT}
type = 0xc # FAT32
boot = true
}
partition 1 {
block-offset = ${BOOT_A_PART_OFFSET}
block-count = ${BOOT_A_PART_COUNT}
type = 0xc # FAT32
boot = true
}
partition 2 {
block-offset = ${BOOT_B_PART_OFFSET}
block-count = ${BOOT_B_PART_COUNT}
type = 0xc # FAT32
boot = true
}
partition 3 {
type = 0xf # Extended partition
block-offset = ${EXTENDED_PART_OFFSET}
}
partition 4 {
block-offset = ${ROOTFS_A_PART_OFFSET}
block-count = ${ROOTFS_A_PART_COUNT}
type = 0x83 # Linux
}
partition 5 {
block-offset = ${ROOTFS_B_PART_OFFSET}
block-count = ${ROOTFS_B_PART_COUNT}
type = 0x83 # Linux
}
partition 6 {
block-offset = ${APP_PART_OFFSET}
block-count = ${APP_PART_COUNT}
type = 0x83 # Linux
expand = true
}
}
# 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}
}
file-resource autoboot-a.txt {
contents = "\
[all]\n\
tryboot_a_b=1\n\
boot_partition=2\n\
[tryboot]\n\
boot_partition=3\n\
\n"
}
file-resource autoboot-b.txt {
contents = "\
[all]\n\
tryboot_a_b=1\n\
boot_partition=3\n\
[tryboot]\n\
boot_partition=2\n\
\n"
}