diff --git a/Kconfig b/Kconfig index 46b85300f37dd8c3563aca66fbba6c26a00a04c1..4c549ccbb21f2467674eb3e20c1ba5a5e6973d20 100644 --- a/Kconfig +++ b/Kconfig @@ -27,6 +27,9 @@ endchoice config AB_BOOT bool "Use A/B partition scheme and environment" +config EMMC_BOOT + bool "Use eMMC to store bootloader and environment" + config HEAD_BUILD bool "Use latest HEAD of all layers" @@ -41,6 +44,11 @@ config KAS_INCLUDE_AB_BOOT default "kas/dev/ab-boot.yml" depends on AB_BOOT +config KAS_INCLUDE_EMMC_BOOT + string + default "kas/dev/emmc-boot.yml" + depends on EMMC_BOOT + config KAS_INCLUDE_HW string default "kas/ked-mx6ul.yml" if HW_IMX6UL diff --git a/kas/dev/emmc-boot.yml b/kas/dev/emmc-boot.yml new file mode 100644 index 0000000000000000000000000000000000000000..14636c3d3cf9d2220fcc7c0654e4d262b8f43210 --- /dev/null +++ b/kas/dev/emmc-boot.yml @@ -0,0 +1,9 @@ +# Copyright (C) 2023 Kontron Electronics GmbH +# SPDX-License-Identifier: MIT + +header: + version: 12 + +local_conf_header: + ab-boot: | + MACHINEOVERRIDES .= ":emmc-boot" diff --git a/layers/meta-ked-imx/classes/bootfs.bbclass b/layers/meta-ked-imx/classes/bootfs.bbclass deleted file mode 100644 index 1928b0d2432b9de7e1286532aa4fbb2723e9b071..0000000000000000000000000000000000000000 --- a/layers/meta-ked-imx/classes/bootfs.bbclass +++ /dev/null @@ -1,22 +0,0 @@ -IMAGE_BOOTFS ?= "${IMAGE_ROOTFS}/../bootfs" -IMAGE_BOOTFS_NAME ?= "${IMAGE_BASENAME}-bootfs-${MACHINE}-${DISTRO_CODENAME}" - -do_bootfs() { - if [ -d ${IMAGE_BOOTFS} ]; then - rm -rf ${IMAGE_BOOTFS}/* - else - mkdir ${IMAGE_BOOTFS} - fi - - cp -L ${DEPLOY_DIR_IMAGE}/fitImage ${IMAGE_BOOTFS}/fitImage_active - cp -L ${DEPLOY_DIR_IMAGE}/fitImage ${IMAGE_BOOTFS}/fitImage_inactive - echo "AB" > ${IMAGE_BOOTFS}/sys_active - - if [ -e ${IMGDEPLOYDIR}/${IMAGE_BOOTFS_NAME}.tar.gz ];then - rm ${IMGDEPLOYDIR}/${IMAGE_BOOTFS_NAME}.tar.gz - fi - cd ${IMAGE_BOOTFS} - tar cvfz ${IMGDEPLOYDIR}/${IMAGE_BOOTFS_NAME}.tar.gz ./* -} - -addtask do_bootfs after do_rootfs before do_image diff --git a/layers/meta-ked-imx/recipes-bsp/u-boot/u-boot-ktn/ked-mx6ul/fw_env.config b/layers/meta-ked-imx/recipes-bsp/u-boot/u-boot-ktn/ked-mx6ul/fw_env.config deleted file mode 100644 index 5c68a68391ce09a078d541de3229f7f2044a4b21..0000000000000000000000000000000000000000 --- a/layers/meta-ked-imx/recipes-bsp/u-boot/u-boot-ktn/ked-mx6ul/fw_env.config +++ /dev/null @@ -1,13 +0,0 @@ -# Configuration file for fw_(printenv/setenv) utility. -# Up to two entries are valid, in this case the redundant -# environment sector is assumed present. -# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash. -# Futhermore, if the Flash sector size is omitted, this value is assumed to -# be the same as the Environment size, which is valid for NOR and SPI-dataflash -# Device offset must be prefixed with 0x to be parsed as a hexadecimal value. - -# NOR example -# MTD device name Device offset Env. size Flash sector size Number of sectors - -/dev/mtd2 0x0000 0x10000 0x4000 -/dev/mtd3 0x0000 0x10000 0x4000 diff --git a/layers/meta-ked-imx/recipes-bsp/u-boot/u-boot-ktn/ked-mx8mm/fw_env.config b/layers/meta-ked-imx/recipes-bsp/u-boot/u-boot-ktn/ked-mx8mm/fw_env.config deleted file mode 100644 index 7e1dfd00aaae420ded4dce2cc4567c881c9d08e0..0000000000000000000000000000000000000000 --- a/layers/meta-ked-imx/recipes-bsp/u-boot/u-boot-ktn/ked-mx8mm/fw_env.config +++ /dev/null @@ -1,13 +0,0 @@ -# Configuration file for fw_(printenv/setenv) utility. -# Up to two entries are valid, in this case the redundant -# environment sector is assumed present. -# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash. -# Futhermore, if the Flash sector size is omitted, this value is assumed to -# be the same as the Environment size, which is valid for NOR and SPI-dataflash -# Device offset must be prefixed with 0x to be parsed as a hexadecimal value. - -# NOR example -# MTD device name Device offset Env. size Flash sector size Number of sectors - -/dev/mtd1 0x0000 0x10000 0x4000 -/dev/mtd2 0x0000 0x10000 0x4000 diff --git a/layers/meta-ked-imx/recipes-bsp/u-boot/u-boot-ktn_2023.04.bb b/layers/meta-ked-imx/recipes-bsp/u-boot/u-boot-ktn_2023.04.bb index c32caec81fe711be1dee06cf48853e94b7b7281c..cfdbe2ff90eaba8535cf9a723d427350ff012a6e 100644 --- a/layers/meta-ked-imx/recipes-bsp/u-boot/u-boot-ktn_2023.04.bb +++ b/layers/meta-ked-imx/recipes-bsp/u-boot/u-boot-ktn_2023.04.bb @@ -12,9 +12,30 @@ SRCBRANCH = "develop-v2023.04-ktn-imx" SRC_URI[md5sum] = "d86276b74616cc9945e38fc1412772c9" SRC_URI[sha256sum] = "7a986967fd3a79432a9a0a6a3ff27edb67c6e96583cb4abeb886fdd7f74f0824" -SRC_URI:append = " \ - file://fw_env.config \ -" +UBOOT_ENV_PART ?= "" +UBOOT_ENV_PART_2 ?= "" +UBOOT_ENV_OFFSET ?= "0x0" +UBOOT_ENV_OFFSET_2 ?= "0x0" + +UBOOT_ENV_PART:ktn-mx8mm ?= "/dev/mtd1" +UBOOT_ENV_PART_2:ktn-mx8mm ?= "/dev/mtd2" + +UBOOT_ENV_PART:ktn-mx6ul ?= "/dev/mtd2" +UBOOT_ENV_PART_2:ktn-mx6ul ?= "/dev/mtd3" + +UBOOT_ENV_PART:emmc-boot ?= "/dev/mmcblk0boot1" +UBOOT_ENV_PART_2:emmc-boot ?= "/dev/mmcblk0boot1" +UBOOT_ENV_OFFSET:emmc-boot ?= "0x1E0000" +UBOOT_ENV_OFFSET_2:emmc-boot ?= "0x1F0000" + +do_install:prepend() { + if [ -n "${UBOOT_ENV_PART}" ]; then + echo "${UBOOT_ENV_PART} ${UBOOT_ENV_OFFSET} 0x10000 0x4000" > ${WORKDIR}/fw_env.config + if [ -n "${UBOOT_ENV_PART_2}" ]; then + echo "${UBOOT_ENV_PART_2} ${UBOOT_ENV_OFFSET_2} 0x10000 0x4000" >> ${WORKDIR}/fw_env.config + fi + fi +} # Overwrite the default environment SRC_URI += " \ diff --git a/layers/meta-ked-imx/swupdate/recipes-core/images/image-ked-swupdate-platform.inc b/layers/meta-ked-imx/swupdate/recipes-core/images/image-ked-swupdate-platform.inc index 5ced8fb0b5523e8c63dbd075db587a8715bfbadb..a08de5f21ad3db24fc6988640117d4bce5d2182f 100644 --- a/layers/meta-ked-imx/swupdate/recipes-core/images/image-ked-swupdate-platform.inc +++ b/layers/meta-ked-imx/swupdate/recipes-core/images/image-ked-swupdate-platform.inc @@ -1,13 +1,38 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/swupdate:" -inherit bootfs +IMAGE_BOOT_FILES:append:ab-boot = " \ + fitImage;fitImage_active \ + fitImage;fitImage_inactive \ + sys_active \ +" + +do_bootfs() { +} + +do_bootfs:ab-boot() { + echo "AB" > ${DEPLOY_DIR_IMAGE}/sys_active +} +addtask do_bootfs after do_rootfs before do_image SWUPDATE_IMAGES += " \ fitImage \ - ${IMAGE_BOOTFS_NAME}.tar.gz \ ${UBOOT_INITIAL_ENV}-${MACHINE} \ ${UBOOT_BINARY} \ " +SWUPDATE_IMAGES:append:ab-boot += " \ + fitImage_active \ + fitImage_inactive \ + sys_active \ +" + +SWUPDATE_IMAGES:remove:ab-boot += " \ + fitImage \ +" + SWUPDATE_IMAGES_FSTYPES[fitImage] = "" SWUPDATE_IMAGES_NOAPPEND_MACHINE[fitImage] = "1" + +SRC_URI:append:kontron-mx8mm += " \ + file://setup-bootpart.sh \ +" diff --git a/layers/meta-ked-imx/swupdate/recipes-core/images/swupdate/kontron-mx8mm/setup-bootpart.sh b/layers/meta-ked-imx/swupdate/recipes-core/images/swupdate/kontron-mx8mm/setup-bootpart.sh new file mode 100755 index 0000000000000000000000000000000000000000..dcdc11b655d95144541aaeee96c9c547adf7f8cb --- /dev/null +++ b/layers/meta-ked-imx/swupdate/recipes-core/images/swupdate/kontron-mx8mm/setup-bootpart.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +mkdir -p /mnt/boot +mount LABEL=boot /mnt/boot +cp fitImage /mnt/boot/fitImage_active +cp fitImage /mnt/boot/fitImage_active +cp sys_Active /mnt/boot/sys_Active +umount /mnt/boot diff --git a/layers/meta-ked-imx/swupdate/recipes-core/images/swupdate/kontron-mx8mm/sw-description b/layers/meta-ked-imx/swupdate/recipes-core/images/swupdate/kontron-mx8mm/sw-description index 8862c79bfb36847ec1823b640048138bb85c6f57..c3ddc3eacc3ee4a077f012590c789548199d3914 100644 --- a/layers/meta-ked-imx/swupdate/recipes-core/images/swupdate/kontron-mx8mm/sw-description +++ b/layers/meta-ked-imx/swupdate/recipes-core/images/swupdate/kontron-mx8mm/sw-description @@ -57,7 +57,7 @@ software = "start=2048", "name=boot", "type=0x83", - "fstype=ext4" + "fstype=vfat" ]; partition-2 = [ "size=9G", @@ -76,7 +76,7 @@ software = partition-4 = [ "size=9G", "start=41064448", - "name=data", + "name=user", "type=0x83", "fstype=ext4" ]; @@ -102,15 +102,14 @@ software = compressed = "zlib"; type = "archive"; path = "/"; - }, + } + ); + + scripts: ( { - filename = "@@IMAGE_BOOTFS_NAME@@.tar.gz"; - sha256="@@@IMAGE_BOOTFS_NAME@@.tar.gz"; - device = "/dev/mmcblk0p1"; - filesystem = "ext4"; - compressed = "zlib"; - type = "archive"; - path = "/"; + filename = "setup-bootpart.sh"; + sha256="@setup-bootpart.sh"; + type = "postinstall"; } );