Pull request #56: feat(coreos-emmc-flasher): beaglebone support
Merge in ICO/coreos from feat/emmc-flasher-poc to master * commit '367814e94c29b4a3a2e344343f1d35fb89993052': feat(coreos-emmc-flasher): beaglebone support
This commit is contained in:
commit
06081b8151
|
|
@ -5,6 +5,7 @@
|
|||
MACHINE_EXTRA_RRECOMMENDS = "kernel-modules kernel-devicetree"
|
||||
EXTRA_IMAGEDEPENDS += "virtual/bootloader"
|
||||
|
||||
|
||||
DEFAULTTUNE ?= "cortexa8hf-neon"
|
||||
include conf/machine/include/arm/armv7a/tune-cortexa8.inc
|
||||
|
||||
|
|
@ -66,3 +67,4 @@ COREOS_PLATFORM1_ROOT ?= "/dev/mmcblk0p4"
|
|||
|
||||
require conf/machine/include/coreos-generic-features/efi.inc
|
||||
require conf/machine/include/coreos-generic-features/legacy-mbr-disk.inc
|
||||
require conf/machine/include/coreos-generic-features/emmc.inc
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
# This configuration file should be included for all hardware that has an
|
||||
# integrated emmc
|
||||
|
||||
MACHINE_FEATURES += "emmc"
|
||||
|
||||
# Generate a SWU image to flash the emmc
|
||||
do_image[depends] += "coreos-emmc-flasher-${MACHINE}:do_swuimage"
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
COMPATIBLE_MACHINE = "beaglebone"
|
||||
|
||||
require coreos-emmc-flasher.inc
|
||||
require coreos-emmc-flasher-uboot.inc
|
||||
|
||||
SWUPDATE_IMAGES += "MLO"
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
software =
|
||||
{
|
||||
version = "@@DISTRO_VERSION@@";
|
||||
@@MACHINE@@ = {
|
||||
hardware-compatibility: ["1.0"];
|
||||
factory = {
|
||||
emmc = {
|
||||
partitions: (
|
||||
{
|
||||
type = "diskpart";
|
||||
device = "/dev/mmcblk1";
|
||||
properties: {
|
||||
labeltype = "dos";
|
||||
partition-1 = [ "size=32M", "start=133120", "name=efi", "type=0xef", "fstype=fat16"];
|
||||
};
|
||||
}
|
||||
);
|
||||
images: (
|
||||
{
|
||||
filename = "MLO";
|
||||
device = "/dev/mmcblk1";
|
||||
offset = "128K";
|
||||
sha256 = "$swupdate_get_sha256(MLO)";
|
||||
},
|
||||
{
|
||||
filename = "u-boot-beaglebone.img";
|
||||
device = "/dev/mmcblk1";
|
||||
offset = "384K";
|
||||
sha256 = "$swupdate_get_sha256(u-boot-beaglebone.img)";
|
||||
|
||||
}
|
||||
);
|
||||
files: (
|
||||
{
|
||||
filename = "efibootguardarm.efi";
|
||||
path = "/EFI/BOOT/bootarm.efi";
|
||||
device = "/dev/mmcblk1p1";
|
||||
filesystem = "vfat";
|
||||
sha256 = "$swupdate_get_sha256(efibootguardarm.efi)";
|
||||
properties: {
|
||||
create-destination = "true";
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
# Machine that use u-boot can include this file after
|
||||
# coreo-swupdate-flasher.inc
|
||||
|
||||
# Add support to flash u-boot
|
||||
IMAGE_DEPENDS += "virtual/bootloader"
|
||||
|
||||
UBOOT_SUFFIX ??= "img"
|
||||
SWUPDATE_IMAGES += "u-boot"
|
||||
SWUPDATE_IMAGES_FSTYPES[u-boot] = ".${UBOOT_SUFFIX}"
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
DESCRIPTION = "SWU Image generation to flash the internal emmc"
|
||||
SECTION = "bootloaders"
|
||||
LICENSE = "CLOSED"
|
||||
PR = "r1"
|
||||
|
||||
SRC_URI = " \
|
||||
file://sw-description \
|
||||
"
|
||||
|
||||
# efibootguard
|
||||
# ==============================================================================
|
||||
# efibootguard support is not machine depends so it can be done here
|
||||
|
||||
require conf/image-uefi.conf
|
||||
|
||||
# The efibootguard binary has to be embedded into the image. swupdate will check
|
||||
# that the binary exist
|
||||
IMAGE_DEPENDS += "efibootguard"
|
||||
SWUPDATE_IMAGES += "efibootguard${EFI_ARCH}"
|
||||
|
||||
# Override or variable are not supported in var[flag] statement, but having more
|
||||
# flags than necessary doesn't do any arm
|
||||
SWUPDATE_IMAGES_FSTYPES[efibootguardx64] = ".efi"
|
||||
SWUPDATE_IMAGES_FSTYPES[efibootguardaa64] = ".efi"
|
||||
SWUPDATE_IMAGES_FSTYPES[efibootguardarm] = ".efi"
|
||||
|
||||
# Image generated should be named coreos-swupdater-flasher-${MACHINE}
|
||||
# and not the default coreos-swupdate-flasher-${MACHINE}-${MACHINE}
|
||||
IMAGE_BASENAME ?= "coreos-emmc-flasher"
|
||||
inherit swupdate
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
From 323c7fdda60758506dea9da6c477e42a0dbe86ca Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Dolt <samuel.dolt@netmodule.com>
|
||||
Date: Wed, 22 Feb 2023 13:22:27 +0100
|
||||
Subject: [PATCH] fs: add support to create FAT16 partition
|
||||
|
||||
Currently swupdate can create vfat partition using an embedded
|
||||
copy of the fat_fs library. The partition created by fat_fs is
|
||||
can be any FAT format (12/16/32) based on the partition size.
|
||||
|
||||
As the partition created by fat_fs was not readable by U-Boot,
|
||||
this commit add a new "fat16" filesystem type that use the
|
||||
external binary mkfs.fat to always create FAT16 partition.
|
||||
---
|
||||
fs/diskformat.c | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/fs/diskformat.c b/fs/diskformat.c
|
||||
index 8d58fc3..f98c9d7 100644
|
||||
--- a/fs/diskformat.c
|
||||
+++ b/fs/diskformat.c
|
||||
@@ -19,6 +19,21 @@ static inline int ext_mkfs_short(const char *device_name, const char *fstype)
|
||||
}
|
||||
#endif
|
||||
|
||||
+int fat_mkfs_extern(const char *device_name, const char *fstype)
|
||||
+{
|
||||
+ char cmd[100] = "mkfs.fat -F ";
|
||||
+ if(strcmp(fstype, "fat16") == 0){
|
||||
+ strcat(cmd, "16 ");
|
||||
+ } else {
|
||||
+ ERROR("fat_mkfs_extern: unsupported fstype %s", fstype);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ strncat(cmd, device_name, sizeof(cmd) - strlen(cmd) - 1);
|
||||
+
|
||||
+ TRACE("fat_mkfs_extern: running %s", cmd);
|
||||
+ return system(cmd);
|
||||
+}
|
||||
+
|
||||
struct supported_filesystems {
|
||||
const char *fstype;
|
||||
int (*mkfs)(const char *device_name, const char *fstype);
|
||||
@@ -28,6 +43,7 @@ static struct supported_filesystems fs[] = {
|
||||
#if defined(CONFIG_FAT_FILESYSTEM)
|
||||
{"vfat", fat_mkfs},
|
||||
#endif
|
||||
+ {"fat16", fat_mkfs_extern},
|
||||
#if defined(CONFIG_EXT_FILESYSTEM)
|
||||
{"ext2", ext_mkfs_short},
|
||||
{"ext3", ext_mkfs_short},
|
||||
|
|
@ -20,3 +20,7 @@ CONFIG_SYSTEMD=y
|
|||
CONFIG_UPDATE_STATE_CHOICE_BOOTLOADER=y
|
||||
CONFIG_UPDATE_STATE_BOOTLOADER="ustate"
|
||||
CONFIG_LIBCONFIG=y
|
||||
CONFIG_DISKPART=y
|
||||
CONFIG_DISKPART_FORMAT=y
|
||||
CONFIG_FAT_FILESYSTEM=y
|
||||
CONFIG_EXT_FILESYSTEM=y
|
||||
|
|
|
|||
|
|
@ -37,3 +37,6 @@ case $ROOT_PARTLABEL in
|
|||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Allow to use image that flash the emmc
|
||||
SWUPDATE_ARGS="${SWUPDATE_ARGS} -e factory,emmc"
|
||||
|
|
|
|||
|
|
@ -3,20 +3,26 @@
|
|||
FILESEXTRAPATHS:prepend := "${THISDIR}/swupdate:"
|
||||
RDEPENDS:${PN}:append = " efibootguard"
|
||||
|
||||
SRC_URI += " \
|
||||
file://webserver-config.sh \
|
||||
file://sw-collections-config.sh \
|
||||
"
|
||||
SRC_URI += "file://webserver-config.sh \
|
||||
file://sw-collections-config.sh \
|
||||
file://0001-fs-add-support-to-create-FAT16-partition.patch \
|
||||
"
|
||||
|
||||
# 0001-fs-add-support-to-create-FAT16-partition.patch depends on the
|
||||
# mkfs.fat binary
|
||||
RDEPENDS:${PN} += "dosfstools"
|
||||
|
||||
# Don't use /www as the web root
|
||||
wwwdir = "/usr/share/swupdate-www"
|
||||
|
||||
FILES:${PN} += " \
|
||||
${SWUPDATE_SW_VERSIONS_FILE} \
|
||||
${SWUPDATE_HW_COMPATIBILITY_FILE} \
|
||||
${libdir}/swupdate/conf.d/sw-collections-config.sh \
|
||||
"
|
||||
|
||||
FILES:${PN}-www += " \
|
||||
${libdir}/swupdate/conf.d/webserver-config.sh \
|
||||
${libdir}/swupdate/conf.d/sw-collections-config.sh \
|
||||
"
|
||||
|
||||
do_install:append() {
|
||||
|
|
@ -25,4 +31,6 @@ do_install:append() {
|
|||
|
||||
install -m 755 ${WORKDIR}/sw-collections-config.sh ${D}${libdir}/swupdate/conf.d/
|
||||
echo "${MACHINE} 1.0" > ${D}${SWUPDATE_HW_COMPATIBILITY_FILE}
|
||||
}
|
||||
}
|
||||
|
||||
PR = "r1"
|
||||
Loading…
Reference in New Issue