Skip to content

Commit a7d0c59

Browse files
committed
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>
1 parent 57b1da9 commit a7d0c59

File tree

7 files changed

+55
-3
lines changed

7 files changed

+55
-3
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
BOARD_DIR=$(dirname $0)
4+
5+
cp ${BOARD_DIR}/sw-description ${BINARIES_DIR}
6+
7+
IMG_FILES="sw-description rootfs.ext4.gz"
8+
9+
pushd ${BINARIES_DIR}
10+
for f in ${IMG_FILES} ; do
11+
echo ${f}
12+
done | cpio -ovL -H crc > buildroot.swu
13+
popd

board/stmicroelectronics/stm32mp157-dk/genimage.cfg

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@ image sdcard.img {
1515
image = "u-boot.stm32"
1616
}
1717

18-
partition rootfs {
18+
partition rootfs1 {
1919
image = "rootfs.ext4"
2020
partition-type = 0x83
2121
bootable = "yes"
2222
size = 256M
2323
}
24+
25+
partition rootfs2 {
26+
partition-type = 0x83
27+
size = 256M
28+
}
2429
}

board/stmicroelectronics/stm32mp157-dk/linux.config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ CONFIG_BLK_DEV_RAM=y
6464
CONFIG_BLK_DEV_RAM_SIZE=65536
6565
CONFIG_SRAM=y
6666
CONFIG_EEPROM_AT24=y
67+
CONFIG_SCSI=y
68+
CONFIG_BLK_DEV_SD=y
6769
CONFIG_NETDEVICES=y
6870
CONFIG_VIRTIO_NET=y
6971
CONFIG_KS8851=y
@@ -125,6 +127,7 @@ CONFIG_USB_EHCI_HCD=y
125127
CONFIG_USB_EHCI_HCD_PLATFORM=y
126128
CONFIG_USB_OHCI_HCD=y
127129
CONFIG_USB_OHCI_HCD_PLATFORM=y
130+
CONFIG_USB_STORAGE=y
128131
CONFIG_USB_DWC2=y
129132
CONFIG_USB_CHIPIDEA=y
130133
CONFIG_USB_CHIPIDEA_HOST=y
@@ -180,4 +183,6 @@ CONFIG_MSDOS_FS=y
180183
CONFIG_VFAT_FS=y
181184
CONFIG_TMPFS=y
182185
CONFIG_TMPFS_POSIX_ACL=y
186+
CONFIG_NLS_CODEPAGE_437=y
187+
CONFIG_NLS_ISO8859_1=y
183188
CONFIG_PRINTK_TIME=y
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
label stm32mp15-buildroot
22
kernel /boot/zImage
33
devicetree /boot/stm32mp157c-dk2.dtb
4-
append root=/dev/mmcblk0p4 rootwait console=ttySTM0,115200 vt.global_cursor_default=0
4+
append root=/dev/mmcblk0p${devplist} rootwait console=ttySTM0,115200 vt.global_cursor_default=0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
sgdisk -A 4:toggle:2 -A 5:toggle:2 /dev/mmcblk0
3+
reboot
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
software = {
2+
version = "0.1.0";
3+
rootfs = {
4+
rootfs-1: {
5+
images: (
6+
{
7+
filename = "rootfs.ext4.gz";
8+
compressed = true;
9+
device = "/dev/mmcblk0p4";
10+
});
11+
}
12+
rootfs-2: {
13+
images: (
14+
{
15+
filename = "rootfs.ext4.gz";
16+
compressed = true;
17+
device = "/dev/mmcblk0p5";
18+
});
19+
}
20+
}
21+
}

configs/stm32mp157_dk_defconfig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ BR2_TOOLCHAIN_EXTERNAL=y
55
BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y
66
BR2_TARGET_GENERIC_ROOT_PASSWD="root"
77
BR2_ROOTFS_OVERLAY="board/stmicroelectronics/stm32mp157-dk/overlay/"
8-
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
8+
BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh board/stmicroelectronics/stm32mp157-dk/gen-swupdate-image.sh"
99
BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/stmicroelectronics/stm32mp157-dk/genimage.cfg"
1010
BR2_LINUX_KERNEL=y
1111
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
@@ -21,13 +21,18 @@ BR2_PACKAGE_QT5=y
2121
BR2_PACKAGE_QT5BASE_EXAMPLES=y
2222
BR2_PACKAGE_QT5BASE_FONTCONFIG=y
2323
BR2_PACKAGE_EVTEST=y
24+
BR2_PACKAGE_GPTFDISK=y
25+
BR2_PACKAGE_GPTFDISK_SGDISK=y
2426
BR2_PACKAGE_LIBDRM=y
2527
BR2_PACKAGE_LIBDRM_INSTALL_TESTS=y
2628
BR2_PACKAGE_DROPBEAR=y
2729
BR2_PACKAGE_GESFTPSERVER=y
30+
BR2_PACKAGE_SWUPDATE=y
31+
# BR2_PACKAGE_SWUPDATE_INSTALL_WEBSITE is not set
2832
BR2_TARGET_ROOTFS_EXT2=y
2933
BR2_TARGET_ROOTFS_EXT2_4=y
3034
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
35+
BR2_TARGET_ROOTFS_EXT2_GZIP=y
3136
# BR2_TARGET_ROOTFS_TAR is not set
3237
BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
3338
BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT=y

0 commit comments

Comments
 (0)