Skip to content
Permalink
Browse files

Implement support for swupdate, local updates

This commit adds support for updating the system using swupdate, using
a dual root filesystem scheme:

 - genimage.cfg is updated to add another root filesystem partition,
   to implement the dual copy scheme

 - sw-description is the swupdate image description file, that will be
   part of the swupdate update file

 - postupdate.sh is the shell script that will be executed on the
   target once the upgrade has completed successfully.

 - gen-swupdate-image.sh is the shell script executed on the build
   machine at the end of the Buildroot build to generate the swupdate
   update file

 - extlinux.conf is updated so that the root= kernel argument is
   properly adjusted depending on which partition we are booting on

 - stm32mp15_dk_defconfig is updated with swupdate, the sgdisk tool
   from gptfdisk, and to call the gen-swupdate-image.sh script as a
   post-image script.

 - the kernel configuration is updated with additional options for USB
   mass storage support

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  • Loading branch information
tpetazzoni committed Sep 21, 2019
1 parent 57b1da9 commit a7d0c599ee7828bcc073172ea950992cf91f3ba7
@@ -0,0 +1,13 @@
#!/bin/sh

BOARD_DIR=$(dirname $0)

cp ${BOARD_DIR}/sw-description ${BINARIES_DIR}

IMG_FILES="sw-description rootfs.ext4.gz"

pushd ${BINARIES_DIR}
for f in ${IMG_FILES} ; do
echo ${f}
done | cpio -ovL -H crc > buildroot.swu
popd
@@ -15,10 +15,15 @@ image sdcard.img {
image = "u-boot.stm32"
}

partition rootfs {
partition rootfs1 {
image = "rootfs.ext4"
partition-type = 0x83
bootable = "yes"
size = 256M
}

partition rootfs2 {
partition-type = 0x83
size = 256M
}
}
@@ -64,6 +64,8 @@ CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_SIZE=65536
CONFIG_SRAM=y
CONFIG_EEPROM_AT24=y
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
CONFIG_NETDEVICES=y
CONFIG_VIRTIO_NET=y
CONFIG_KS8851=y
@@ -125,6 +127,7 @@ CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PLATFORM=y
CONFIG_USB_STORAGE=y
CONFIG_USB_DWC2=y
CONFIG_USB_CHIPIDEA=y
CONFIG_USB_CHIPIDEA_HOST=y
@@ -180,4 +183,6 @@ CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_PRINTK_TIME=y
@@ -1,4 +1,4 @@
label stm32mp15-buildroot
kernel /boot/zImage
devicetree /boot/stm32mp157c-dk2.dtb
append root=/dev/mmcblk0p4 rootwait console=ttySTM0,115200 vt.global_cursor_default=0
append root=/dev/mmcblk0p${devplist} rootwait console=ttySTM0,115200 vt.global_cursor_default=0
@@ -0,0 +1,3 @@
#!/bin/sh
sgdisk -A 4:toggle:2 -A 5:toggle:2 /dev/mmcblk0
reboot
@@ -0,0 +1,21 @@
software = {
version = "0.1.0";
rootfs = {
rootfs-1: {
images: (
{
filename = "rootfs.ext4.gz";
compressed = true;
device = "/dev/mmcblk0p4";
});
}
rootfs-2: {
images: (
{
filename = "rootfs.ext4.gz";
compressed = true;
device = "/dev/mmcblk0p5";
});
}
}
}
@@ -5,7 +5,7 @@ BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y
BR2_TARGET_GENERIC_ROOT_PASSWD="root"
BR2_ROOTFS_OVERLAY="board/stmicroelectronics/stm32mp157-dk/overlay/"
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh board/stmicroelectronics/stm32mp157-dk/gen-swupdate-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/stmicroelectronics/stm32mp157-dk/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
@@ -21,13 +21,18 @@ BR2_PACKAGE_QT5=y
BR2_PACKAGE_QT5BASE_EXAMPLES=y
BR2_PACKAGE_QT5BASE_FONTCONFIG=y
BR2_PACKAGE_EVTEST=y
BR2_PACKAGE_GPTFDISK=y
BR2_PACKAGE_GPTFDISK_SGDISK=y
BR2_PACKAGE_LIBDRM=y
BR2_PACKAGE_LIBDRM_INSTALL_TESTS=y
BR2_PACKAGE_DROPBEAR=y
BR2_PACKAGE_GESFTPSERVER=y
BR2_PACKAGE_SWUPDATE=y
# BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE is not set
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
BR2_TARGET_ROOTFS_EXT2_GZIP=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT=y

0 comments on commit a7d0c59

Please sign in to comment.
You can’t perform that action at this time.