Merge branch 'dey-3.2/master' into dey-3.2/maint

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2021-11-11 16:23:43 +01:00
commit fe2a1f281e
188 changed files with 14052 additions and 937 deletions

View File

@ -219,6 +219,28 @@ CONVERSION_CMD_tf = "trustence_sign_cpio ${IMAGE_NAME}.rootfs.${type}"
CONVERSION_DEPENDS_tf = "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'trustfence-sign-tools-native', '', d)}"
IMAGE_TYPES += "cpio.gz.u-boot.tf"
#
# Sign read-only rootfs
#
do_image_squashfs[postfuncs] += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'rootfs_sign', '', d)}"
rootfs_sign() {
# Set environment variables for trustfence configuration
export CONFIG_SIGN_KEYS_PATH="${TRUSTFENCE_SIGN_KEYS_PATH}"
[ -n "${CONFIG_KEY_INDEX}" ] && export CONFIG_KEY_INDEX="${TRUSTFENCE_KEY_INDEX}"
[ -n "${CONFIG_SIGN_MODE}" ] && export CONFIG_SIGN_MODE="${TRUSTFENCE_SIGN_MODE}"
ROOTFS_IMAGE="${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.squashfs"
TMP_ROOTFS_IMAGE_SIGNED="$(mktemp ${ROOTFS_IMAGE}-signed.XXXXXX)"
# Sign rootfs read-only image
trustfence-sign-artifact.sh -p "${DIGI_FAMILY}" -r "${ROOTFS_IMAGE}" "${TMP_ROOTFS_IMAGE_SIGNED}"
mv "${TMP_ROOTFS_IMAGE_SIGNED}" "${ROOTFS_IMAGE}"
}
rootfs_sign[dirs] = "${DEPLOY_DIR_IMAGE}"
do_image_squashfs[vardeps] += "TRUSTFENCE_SIGN_KEYS_PATH TRUSTFENCE_KEY_INDEX"
################################################################################
# SDCARD IMAGES #
################################################################################
@ -305,3 +327,4 @@ IMAGE_CMD_sdcard() {
# The sdcard image requires the boot and rootfs images to be built before
IMAGE_TYPEDEP_sdcard = "${SDIMG_BOOTFS_TYPE} ${SDIMG_ROOTFS_TYPE}.gz"

View File

@ -0,0 +1,2 @@
pkg_postinst_ontarget_${PN}() {
}

View File

@ -17,9 +17,13 @@ LAYERSERIES_COMPAT_digi-arm = "gatesgarth"
# See fsl-eula-unpack.bbclass.
FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V13 = "1b4db4b25c3a1e422c0c0ed64feb65d2"
FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V19 = "a632fefd1c359980434f9389833cab3a"
FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V22 = "3c3fe2b904fd694f28d2f646ee16dddb"
FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V25 = "f35df765ff17e69043ea21f350e3229c"
FSL_EULA_FILE_MD5SUMS_append = " \
${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V13} \
${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V19} \
${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V22} \
${FSL_EULA_FILE_MD5SUM_LA_OPT_NXP_SOFTWARE_LICENSE_V25} \
"
# Digi's General and Open Source license agreements
@ -29,8 +33,8 @@ DIGI_OPEN_EULA_FILE = "${LAYERDIR}/DIGI_OPEN_EULA"
# Additional license directories
LICENSE_PATH += "${LAYERDIR}/custom-licenses"
DIGI_LOG_GIT ?= "git://log-sln-git.digi.com/"
DIGI_MTK_GIT ?= "git://stash.digi.com/"
DIGI_LOG_GIT ?= "git://log-sln-git.digi.com"
DIGI_MTK_GIT ?= "git://stash.digi.com"
DIGI_GIT ?= "${DIGI_LOG_GIT}"
DIGI_PKG_SRC ?= "https://ftp1.digi.com/support/digiembeddedyocto/source"

View File

@ -43,8 +43,7 @@ BT_TTY ?= "ttymxc1"
# XBee
XBEE_TTY ?= "ttymxc4"
# U-Boot script to be copied to the boot image
BOOT_SCRIPTS = "boot.scr:boot.scr"
# Flash image types
IMAGE_FSTYPES ?= "boot.vfat ext4.gz sdcard.gz tar.bz2 recovery.vfat"
# Add SQUASHFS if read-only-rootfs is enabled
IMAGE_FSTYPES += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "squashfs", "", d)}'

View File

@ -5,11 +5,13 @@
# Contains the ConnectCore 6 module.
include conf/machine/include/ccimx6.inc
HAS_WIFI_VIRTWLANS = "false"
# Wireless external module
WIRELESS_MODULE_append = " ${@oe.utils.conditional('HAVE_WIFI', '1', 'kernel-module-qualcomm', '', d)}"
HAS_WIFI_VIRTWLANS = "true"
# Firmware
MACHINE_FIRMWARE_append = " ${@oe.utils.conditional('HAVE_BT', '1' , 'firmware-atheros-ar3k', '', d)}"
MACHINE_FIRMWARE_append = " ${@oe.utils.conditional('HAVE_WIFI', '1' , 'firmware-atheros-ath6kl', '', d)}"
MACHINE_FIRMWARE_append = " ${@oe.utils.conditional('HAVE_BT', '1' , 'firmware-atheros-ar3k firmware-qualcomm-qca6564-bt', '', d)}"
MACHINE_FIRMWARE_append = " ${@oe.utils.conditional('HAVE_WIFI', '1' , 'firmware-atheros-ath6kl firmware-qualcomm-qca6564-wifi', '', d)}"
PREFERRED_PROVIDER_virtual/libg2d_mx6 = "imx-gpu-g2d"
@ -43,8 +45,7 @@ BT_TTY ?= "ttymxc1"
# XBee
XBEE_TTY ?= "ttymxc4"
# U-Boot script to be copied to the boot image
BOOT_SCRIPTS = "boot.scr:boot.scr"
# Flash image types
IMAGE_FSTYPES ?= "boot.vfat ext4.gz sdcard.gz tar.bz2 recovery.vfat"
# Add SQUASHFS if read-only-rootfs is enabled
IMAGE_FSTYPES += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "squashfs", "", d)}'

View File

@ -39,8 +39,7 @@ BT_TTY ?= "ttymxc0"
# XBee
XBEE_TTY ?= "ttymxc1"
# U-Boot script to be copied to the boot image
BOOT_SCRIPTS = "boot.scr:boot.scr"
# Flash image types
IMAGE_FSTYPES ?= "tar.bz2 ubifs boot.ubifs recovery.ubifs"
# Add SQUASHFS if read-only-rootfs is enabled
IMAGE_FSTYPES += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "squashfs", "", d)}'

View File

@ -35,11 +35,10 @@ SERIAL_CONSOLES ?= "115200;ttymxc4"
# Bluetooth tty
BT_TTY ?= "ttymxc0"
# U-Boot script to be copied to the boot image
BOOT_SCRIPTS = "boot.scr:boot.scr"
# Flash image types
IMAGE_FSTYPES ?= "tar.bz2 ubifs boot.ubifs recovery.ubifs"
# Add SQUASHFS if read-only-rootfs is enabled
IMAGE_FSTYPES += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "squashfs", "", d)}'
# Default image for install scripts
DEFAULT_IMAGE_NAME ?= "core-image-base"

View File

@ -21,6 +21,7 @@ UBOOT_DTB_NAME = "ccimx8mm-dvk.dtb"
KERNEL_DEVICETREE ?= " \
digi/ccimx8mm-dvk.dtb \
digi/_ov_board_flexspi_ccimx8m-dvk.dtbo \
digi/_ov_board_gpio-watchdog_ccimx8m-dvk.dtbo \
digi/_ov_board_hsd101pfw2-lvds_ccimx8m-dvk.dtbo \
digi/_ov_board_lvds_ccimx8m-dvk.dtbo \
@ -40,8 +41,7 @@ XBEE_RESET_N_GPIO ?= "mca-gpio@15,gpio1@8"
XBEE_SLEEP_RQ_GPIO ?= "mca-gpio@11,gpio1@7"
XBEE_TTY ?= "ttymxc3"
# U-Boot script to be copied to the boot image
BOOT_SCRIPTS = "boot.scr:boot.scr"
# Flash image types
IMAGE_FSTYPES ?= "boot.vfat ext4.gz sdcard.gz tar.bz2 recovery.vfat"
# Add SQUASHFS if read-only-rootfs is enabled
IMAGE_FSTYPES += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "squashfs", "", d)}'

View File

@ -21,6 +21,7 @@ UBOOT_DTB_NAME = "ccimx8mn-dvk.dtb"
KERNEL_DEVICETREE ?= " \
digi/ccimx8mn-dvk.dtb \
digi/_ov_board_flexspi_ccimx8m-dvk.dtbo \
digi/_ov_board_gpio-watchdog_ccimx8m-dvk.dtbo \
digi/_ov_board_hsd101pfw2-lvds_ccimx8m-dvk.dtbo \
digi/_ov_board_lvds_ccimx8m-dvk.dtbo \
@ -42,8 +43,7 @@ XBEE_RESET_N_GPIO ?= "mca-gpio@15,gpio1@8"
XBEE_SLEEP_RQ_GPIO ?= "mca-gpio@11,gpio1@7"
XBEE_TTY ?= "ttymxc3"
# U-Boot script to be copied to the boot image
BOOT_SCRIPTS = "boot.scr:boot.scr"
# Flash image types
IMAGE_FSTYPES ?= "boot.vfat ext4.gz sdcard.gz tar.bz2 recovery.vfat"
# Add SQUASHFS if read-only-rootfs is enabled
IMAGE_FSTYPES += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "squashfs", "", d)}'

View File

@ -29,8 +29,7 @@ XBEE_RESET_N_GPIO ?= "gpio3@13"
XBEE_SLEEP_RQ_GPIO ?= "gpio3@16"
XBEE_TTY ?= "ttyLP0"
# U-Boot script to be copied to the boot image
BOOT_SCRIPTS = "boot.scr:boot.scr"
# Flash image types
IMAGE_FSTYPES ?= "boot.vfat ext4.gz sdcard.gz tar.bz2 recovery.vfat"
# Add SQUASHFS if read-only-rootfs is enabled
IMAGE_FSTYPES += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "squashfs", "", d)}'

View File

@ -15,6 +15,7 @@ UBOOT_CONFIG[ccimx8x_sbc_pro512MB] = "ccimx8x_sbc_pro512MB_defconfig,,u-boot-dtb
KERNEL_DEVICETREE ?= " \
digi/ccimx8x-sbc-pro.dtb \
digi/_ov_board_flexcan1_ccimx8x-sbc-pro.dtbo \
digi/_ov_board_flexspi_ccimx8x-sbc-pro.dtbo \
digi/_ov_board_gpio-watchdog_ccimx8x-sbc-pro.dtbo \
digi/_ov_board_hsd101pfw2-lvds_ccimx8x-sbc-pro.dtbo \
digi/_ov_board_lpuart3_ccimx8x-sbc-pro.dtbo \
@ -41,9 +42,8 @@ XBEE_RESET_N_GPIO ?= "mca-gpio@15"
XBEE_SLEEP_RQ_GPIO ?= "mca-gpio@11"
XBEE_TTY ?= "ttyMCA0"
# U-Boot script to be copied to the boot image
BOOT_SCRIPTS = "boot.scr:boot.scr"
UBOOT_HAS_FASTBOOT = "true"
# Flash image types
IMAGE_FSTYPES ?= "boot.vfat ext4.gz sdcard.gz tar.bz2 recovery.vfat"
# Add SQUASHFS if read-only-rootfs is enabled
IMAGE_FSTYPES += '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "squashfs", "", d)}'

View File

@ -11,6 +11,7 @@ include conf/machine/include/tune-cortexa9.inc
# Platform u-boot settings
UBOOT_PREFIX = "u-boot"
UBOOT_SUFFIX = "imx"
UBOOT_HAS_FASTBOOT = "true"
# Linux kernel configuration
KERNEL_DEFCONFIG ?= "arch/arm/configs/ccimx6sbc_defconfig"
@ -43,4 +44,5 @@ MACHINE_FEATURES += "accel-graphics accel-video wifi bluetooth pci"
TRUSTFENCE_SIGN_MODE = "HAB"
# Adding 'wayland' along with 'x11' enables the xwayland backend
DISTRO_FEATURES_append = " wayland"
# Adding pam is required for SELinux functionality
DISTRO_FEATURES_append = " wayland pam"

View File

@ -11,6 +11,7 @@ include conf/machine/include/arm/arch-arm64.inc
# Platform u-boot settings
UBOOT_PREFIX = "imx-boot"
UBOOT_SUFFIX = "bin"
UBOOT_HAS_FASTBOOT = "true"
# The bootloader image that gets flashed consists of U-Boot and several fw binaries
EXTRA_IMAGEDEPENDS = "imx-boot"

View File

@ -79,3 +79,10 @@ DEFAULT_IMAGE_NAME ??= "dey-image-qt"
# List of graphical images names (for install scripts)
GRAPHICAL_IMAGES ?= "dey-image-qt dey-image-webkit"
# Include DEY SELinux policy modifications by default
DEY_SELINUX_POLICY ?= "1"
# U-Boot scripts to include in 'linux' partition
# (use the '+=' operator, since other layers may append scripts to this list)
BOOT_SCRIPTS += "boot.scr:boot.scr"

View File

@ -1,4 +1,4 @@
# Copyright (C) 2016-2020 Digi International.
# Copyright (C) 2016-2021 Digi International.
SUMMARY = "Qualcomm firmware files for Digi's platforms."
SECTION = "base"
@ -11,7 +11,7 @@ QUALCOMM_WIFI_DRIVER ?= "proprietary"
# Selects whether to apply the "Deep Sleep + Internal Clock" workaround
BT_INTCLOCK_WORKAROUND ?= "0"
BT_INTCLOCK_WORKAROUND_ccimx6ul = "1"
BT_INTCLOCK_WORKAROUND_ccimx6qpsbc = "1"
BT_INTCLOCK_WORKAROUND_ccimx6 = "1"
# Bluetooth 5.0 firmware files
FW_QUALCOMM_BT_5 = " \
@ -115,4 +115,4 @@ FILES_${PN}-${QCA_MODEL}-bt = "/lib/firmware/qca"
FILES_${PN}-${QCA_MODEL}-wifi = "/lib/firmware"
PACKAGE_ARCH = "${MACHINE_ARCH}"
COMPATIBLE_MACHINE = "(ccimx6qpsbc|ccimx6ul|ccimx8x|ccimx8m)"
COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul|ccimx8x|ccimx8m)"

View File

@ -0,0 +1,9 @@
# Configuration file for fw_(printenv/setenv) utility.
# Up to two entries are valid, in this case the redundant
# environment sector is assumed present.
# If both copies are set to the same offset, an automatic mechanism will
# determine the first good sectors where each copy lives, skipping bad blocks.
# Device name Offset Size Erase-size No.Blocks
/dev/mtd1 0x0 0x20000 0x20000 8
/dev/mtd1 0x0 0x20000 0x20000 8

View File

@ -2,8 +2,17 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
# Chose a between a default hard-coded config file (for read-only rootfs)
# or a dynamically generated one (with a postinst script)
FW_CONFIG_FILE = "${@bb.utils.contains('STORAGE_MEDIA', 'mtd', \
bb.utils.contains('IMAGE_FEATURES', 'read-only-rootfs', \
'${STORAGE_MEDIA}/fw_env.config_default', \
'${STORAGE_MEDIA}/fw_env.config', d), \
'${STORAGE_MEDIA}/fw_env.config', \
d)}"
SRC_URI += " \
file://${STORAGE_MEDIA}/fw_env.config \
file://${FW_CONFIG_FILE} \
file://0001-Implement-support-for-environment-encryption-by-CAAM.patch \
file://0002-Implement-U-Boot-environment-access-functions.patch \
file://0003-tools-env-add-support-to-set-dynamic-location-of-env.patch \
@ -11,7 +20,7 @@ SRC_URI += " \
do_install_append() {
install -d ${D}${sysconfdir}
install -m 0644 ${WORKDIR}/${STORAGE_MEDIA}/fw_env.config ${D}${sysconfdir}/
install -m 0644 ${WORKDIR}/${FW_CONFIG_FILE} ${D}${sysconfdir}/fw_env.config
}
pkg_postinst_ontarget_${PN}() {
@ -61,3 +70,5 @@ pkg_postinst_ontarget_${PN}() {
${CONFIG_FILE}
fi
}
inherit ${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "remove-pkg-postinst-ontarget", "", d)}

View File

@ -15,7 +15,12 @@ PROVIDES += "u-boot"
S = "${WORKDIR}/git"
# Select internal or Github U-Boot repo
UBOOT_GIT_URI ?= "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_GIT}u-boot-denx.git', '${DIGI_GITHUB_GIT}/u-boot.git;protocol=https', d)}"
DIGI_LOG_REPO = "u-boot-denx.git"
DIGI_MTK_REPO = "uboot/u-boot-denx.git"
GITHUB_REPO = "u-boot.git"
UBOOT_GIT_URI ?= "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1' , \
oe.utils.conditional('DIGI_GIT', '${DIGI_LOG_GIT}', '${DIGI_GIT}/${DIGI_LOG_REPO}', '${DIGI_GIT}/${DIGI_MTK_REPO};protocol=ssh', d), \
'${DIGI_GITHUB_GIT}/${GITHUB_REPO};protocol=https', d)}"
SRC_URI = " \
${UBOOT_GIT_URI};branch=${SRCBRANCH} \

View File

@ -2,6 +2,54 @@
# U-Boot bootscript for EMMC/SD images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# Dual boot update verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
echo "Booting from system B"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
fi
else
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
fi
# Back up environment variables
setenv ORIG_extra_bootargs ${extra_bootargs}
@ -25,20 +73,6 @@ else
fi
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux mmc ${mmcbootdev}:${mmcpart}

View File

@ -77,9 +77,16 @@ echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
if test \"\$\{dualboot\}\" = yes; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
echo " linux_b ${INSTALL_LINUX_FILENAME}"
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
@ -116,15 +123,19 @@ fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Partition the eMMC user data area for Linux
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
saveenv;
echo \"\";
echo \"\";
@ -138,49 +149,103 @@ setenv bootcmd "
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} fat ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} fat ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} fat ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"Aborted.\";
exit;
echo \"\";
update linux_a mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete. Rebooting into recovery mode for final deployment.\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;

View File

@ -77,9 +77,16 @@ echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
if test \"\$\{dualboot\}\" = yes; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
echo " linux_b ${INSTALL_LINUX_FILENAME}"
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
@ -116,15 +123,20 @@ fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Partition the eMMC user data area for Linux
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
# NOTE: insert some 'usb reset' commands to avoid EHCI timeouts
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
saveenv;
echo \"\";
echo \"\";
@ -139,49 +151,104 @@ setenv bootcmd "
exit;
fi;
usb start;
echo \"\";
echo \"\";
echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} fat ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} fat ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} fat ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"Aborted.\";
exit;
echo \"\";
update linux_a usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
usb reset;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete. Rebooting into recovery mode for final deployment.\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;

View File

@ -0,0 +1,308 @@
#!/bin/sh
#===============================================================================
#
# Copyright (C) 2021 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
#
# Description:
# Script to flash Yocto build artifacts over USB to the target.
#===============================================================================
# set -x
#
# U-Boot script for installing Linux images created by Yocto
#
# Exit on any error
set -e
# Parse uuu cmd output
getenv()
{
uuu -v fb: ucmd printenv "${1}" | sed -ne "s,^${1}=,,g;T;p"
}
show_usage()
{
echo "Usage: $0 [options]"
echo ""
echo " Options:"
echo " -h Show this help."
echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', "
echo " 'dey-image-webkit', 'core-image-base'..."
echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided."
echo " -n No wait. Skips 10 seconds delay to stop script."
echo " -u <u-boot-filename> U-Boot filename."
echo " Auto-determined by variant if not provided."
exit 2
}
# Update a partition
# Params:
# 1. partition
# 2. file
part_update()
{
echo "\033[36m"
echo "====================================================================================="
echo "Updating '${1}' partition with file: ${2}"
echo "====================================================================================="
echo "\033[0m"
if [ "${1}" = "bootloader" ]; then
uuu fb: flash "${1}" "${2}"
else
uuu fb: flash -raw2sparse "${1}" "${2}"
fi
}
clear
echo "############################################################"
echo "# Linux firmware install through USB OTG #"
echo "############################################################"
# Command line admits the following parameters:
# -u <u-boot-filename>
# -i <image-name>
while getopts 'hi:nu:' c
do
case $c in
h) show_usage ;;
i) IMAGE_NAME=${OPTARG} ;;
n) NOWAIT=true ;;
u) INSTALL_UBOOT_FILENAME=${OPTARG} ;;
esac
done
# Enable the redirect support to get u-boot variables values
uuu fb: ucmd setenv stdout serial,fastboot
# Check if dualboot variable is active
dualboot=$(getenv "dualboot")
if [ "${dualboot}" = "yes" ]; then
DUALBOOT=true;
fi
echo ""
echo "Determining image files to use..."
# Determine U-Boot file to program basing on SOM's SOC type (linked to bus width)
if [ -z ${INSTALL_UBOOT_FILENAME} ]; then
module_variant=$(getenv "module_variant")
# Determine U-Boot file to program basing on SOM's variant
if [ -n "$module_variant" ] || [ "$module_variant" = "0x00" ]; then
if [ "$module_variant" = "0x01" ] || \
[ "$module_variant" = "0x02" ]; then
module_ram="2GB"
else
module_ram="1GB"
fi
INSTALL_UBOOT_FILENAME="u-boot-##MACHINE##${module_ram}.imx"
fi
# U-Boot when the checked value is empty.
if [ -n "${INSTALL_UBOOT_FILENAME}" ]; then
true
else
# remove redirect
uuu fb: ucmd setenv stdout serial
echo ""
echo "[ERROR] Cannot determine U-Boot file for this module!"
echo ""
echo "1. Set variable 'INSTALL_UBOOT_FILENAME' depending on your ConnectCore 6 QuadPlus variant:"
echo " - For a QuadPlus CPU with 2GB DDR3, run:"
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##2GB.imx"
echo " - For a DualPlus CPU with 1GB DDR3, run:"
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##1GB.imx"
echo ""
echo ""
echo "2. Run the install script again."
echo ""
echo "Aborted"
echo ""
exit
fi
fi
# remove redirect
uuu fb: ucmd setenv stdout serial
# Determine linux, recovery, and rootfs image filenames to update
if [ -z "${IMAGE_NAME}" ]; then
IMAGE_NAME="##DEFAULT_IMAGE_NAME##"
fi
GRAPHICAL_IMAGES="##GRAPHICAL_IMAGES##"
for g in ${GRAPHICAL_IMAGES}; do
if [ "${IMAGE_NAME}" = "${g}" ]; then
BASEFILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##"
fi
done
if [ -z "${BASEFILENAME}" ]; then
BASEFILENAME="${IMAGE_NAME}"
fi
INSTALL_LINUX_FILENAME="${BASEFILENAME}-##MACHINE##.boot.vfat"
INSTALL_RECOVERY_FILENAME="${BASEFILENAME}-##MACHINE##.recovery.vfat"
INSTALL_ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
COMPRESSED_ROOTFS_IMAGE="${INSTALL_ROOTFS_FILENAME}.gz"
# If the rootfs image is compressed, make sure to decompress it before the update
if [ -f ${COMPRESSED_ROOTFS_IMAGE} ] && [ ! -f ${INSTALL_ROOTFS_FILENAME} ]; then
echo "\033[36m"
echo "====================================================================================="
echo "Decompressing rootfs image '${COMPRESSED_ROOTFS_IMAGE}'"
echo "====================================================================================="
echo "\033[0m"
gzip -d -k -f "${COMPRESSED_ROOTFS_IMAGE}"
fi
# Verify existance of files before starting the update
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}"
for f in ${FILES}; do
if [ ! -f ${f} ]; then
echo "\033[31m[ERROR] Could not find file '${f}'\033[0m"
ABORT=true
fi
done;
[ "${ABORT}" = true ] && exit 1
# parts names
LINUX_NAME="linux"
RECOVERY_NAME="recovery"
ROOTFS_NAME="rootfs"
# Print warning about storage media being deleted
if [ "${NOWAIT}" != true ]; then
WAIT=10
printf "\n"
printf " ====================\n"
printf " = IMPORTANT! =\n"
printf " ====================\n"
printf " This process will erase your eMMC and will install the following files\n"
printf " on the partitions of the eMMC.\n"
printf "\n"
printf " PARTITION\tFILENAME\n"
printf " ---------\t--------\n"
printf " bootloader\t${INSTALL_UBOOT_FILENAME}\n"
if [ "${DUALBOOT}" = true ]; then
printf " ${LINUX_NAME}_a\t${INSTALL_LINUX_FILENAME}\n"
printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n"
printf " ${ROOTFS_NAME}_a\t${INSTALL_ROOTFS_FILENAME}\n"
printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n"
else
printf " ${LINUX_NAME}\t${INSTALL_LINUX_FILENAME}\n"
printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n"
printf " ${ROOTFS_NAME}\t${INSTALL_ROOTFS_FILENAME}\n"
fi
printf "\n"
printf " Press CTRL+C now if you wish to abort.\n"
printf "\n"
while [ ${WAIT} -gt 0 ]; do
printf "\r Update process starts in %d " ${WAIT}
sleep 1
WAIT=$(( ${WAIT} - 1 ))
done
printf "\r \n"
printf " Starting update process\n"
fi
# Skip user confirmation for U-Boot update
uuu fb: ucmd setenv forced_update 1
# Update U-Boot
part_update "bootloader" "${INSTALL_UBOOT_FILENAME}"
# Set MMC to boot from BOOT1 partition
uuu fb: ucmd mmc partconf 0 1 1 1
# Set 'bootcmd' for the second part of the script that will
# - Reset environment to defaults
# - Save the environment
# - Partition the eMMC user data area for Linux
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
uuu fb: ucmd setenv bootcmd "
env default -a;
setenv dualboot \${dualboot};
saveenv;
echo \"\";
echo \"\";
echo \">> Creating Linux partition table on the eMMC\";
echo \"\";
echo \"\";
run partition_mmc_linux;
if test \$? -eq 1; then
echo \"[ERROR] Failed to create Linux partition table!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Start installation Linux firmware files\";
echo \"\";
echo \"\";
saveenv;
fastboot 0;
"
uuu fb: ucmd saveenv
uuu fb: acmd reset
# Wait for the target to reset
sleep 3
# Restart fastboot with the latest MMC partition configuration
uuu fb: ucmd setenv fastboot_dev sata
uuu fb: ucmd setenv fastboot_dev mmc
# Set fastboot buffer address to $loadaddr, just in case
uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
if [ "${DUALBOOT}" = true ]; then
# Update Linux A
part_update "${LINUX_NAME}_a" "${INSTALL_LINUX_FILENAME}"
# Update Linux B
part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}"
# Update Rootfs A
part_update "${ROOTFS_NAME}_a" "${INSTALL_ROOTFS_FILENAME}"
# Update Rootfs B
part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}"
else
# Update Linux
part_update "${LINUX_NAME}" "${INSTALL_LINUX_FILENAME}"
# Update Recovery
part_update "${RECOVERY_NAME}" "${INSTALL_RECOVERY_FILENAME}"
# Update Rootfs
part_update "${ROOTFS_NAME}" "${INSTALL_ROOTFS_FILENAME}"
fi
# If the rootfs image was originally compressed, remove the uncompressed image
if [ -f ${COMPRESSED_ROOTFS_IMAGE} ] && [ -f ${INSTALL_ROOTFS_FILENAME} ]; then
rm -f "${INSTALL_ROOTFS_FILENAME}"
fi
if [ "${DUALBOOT}" != true ]; then
# Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes
uuu fb: ucmd setenv recovery_command wipe_update
fi
uuu fb: ucmd saveenv
# Reset the target
uuu fb: acmd reset
echo "\033[32m"
echo "============================================================="
echo "Done! Wait for the target to complete first boot process."
echo "============================================================="
echo "\033[0m"
exit

View File

@ -2,6 +2,54 @@
# U-Boot bootscript for EMMC/SD images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# Dual boot update verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
echo "Booting from system B"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
fi
else
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
fi
# Back up environment variables
setenv ORIG_extra_bootargs ${extra_bootargs}
@ -53,20 +101,6 @@ else
fi
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux mmc ${mmcbootdev}:${mmcpart}

View File

@ -88,9 +88,16 @@ echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
if test \"\$\{dualboot\}\" = yes; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
echo " linux_b ${INSTALL_LINUX_FILENAME}"
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
@ -127,15 +134,19 @@ fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Partition the eMMC user data area for Linux
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
saveenv;
echo \"\";
echo \"\";
@ -149,49 +160,103 @@ setenv bootcmd "
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} fat ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} fat ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} fat ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"Aborted.\";
exit;
echo \"\";
update linux_a mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete. Rebooting into recovery mode for final deployment.\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;

View File

@ -88,9 +88,16 @@ echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
if test \"\$\{dualboot\}\" = yes; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
echo " linux_b ${INSTALL_LINUX_FILENAME}"
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
@ -127,15 +134,20 @@ fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Partition the eMMC user data area for Linux
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
# NOTE: insert some 'usb reset' commands to avoid EHCI timeouts
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
saveenv;
echo \"\";
echo \"\";
@ -150,49 +162,104 @@ setenv bootcmd "
exit;
fi;
usb start;
echo \"\";
echo \"\";
echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} fat ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} fat ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} fat ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"Aborted.\";
exit;
echo \"\";
update linux_a usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
usb reset;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete. Rebooting into recovery mode for final deployment.\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;

View File

@ -0,0 +1,326 @@
#!/bin/sh
#===============================================================================
#
# Copyright (C) 2021 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
#
# Description:
# Script to flash Yocto build artifacts over USB to the target.
#===============================================================================
# set -x
#
# U-Boot script for installing Linux images created by Yocto
#
# Exit on any error
set -e
# Parse uuu cmd output
getenv()
{
uuu -v fb: ucmd printenv "${1}" | sed -ne "s,^${1}=,,g;T;p"
}
show_usage()
{
echo "Usage: $0 [options]"
echo ""
echo " Options:"
echo " -h Show this help."
echo " -i <dey-image-name> Image name that prefixes the image filenames, such as 'dey-image-qt', "
echo " 'dey-image-webkit', 'core-image-base'..."
echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided."
echo " -n No wait. Skips 10 seconds delay to stop script."
echo " -u <u-boot-filename> U-Boot filename."
echo " Auto-determined by variant if not provided."
exit 2
}
# Update a partition
# Params:
# 1. partition
# 2. file
part_update()
{
echo "\033[36m"
echo "====================================================================================="
echo "Updating '${1}' partition with file: ${2}"
echo "====================================================================================="
echo "\033[0m"
if [ "${1}" = "bootloader" ]; then
uuu fb: flash "${1}" "${2}"
else
uuu fb: flash -raw2sparse "${1}" "${2}"
fi
}
clear
echo "############################################################"
echo "# Linux firmware install through USB OTG #"
echo "############################################################"
# Command line admits the following parameters:
# -u <u-boot-filename>
# -i <image-name>
while getopts 'hi:nu:' c
do
case $c in
h) show_usage ;;
i) IMAGE_NAME=${OPTARG} ;;
n) NOWAIT=true ;;
u) INSTALL_UBOOT_FILENAME=${OPTARG} ;;
esac
done
# Enable the redirect support to get u-boot variables values
uuu fb: ucmd setenv stdout serial,fastboot
# Check if dualboot variable is active
dualboot=$(getenv "dualboot")
if [ "${dualboot}" = "yes" ]; then
DUALBOOT=true;
fi
echo ""
echo "Determining image files to use..."
# Determine U-Boot file to program basing on SOM's SOC type (linked to bus width)
if [ -z ${INSTALL_UBOOT_FILENAME} ]; then
soc_family=$(getenv "soc_family")
if [ -n "$soc_family" ]; then
module_variant=$(getenv "module_variant")
# Determine U-Boot file to program basing on SOM's variant
if [ -n "$module_variant" ] || [ "$module_variant" = "0x00" ]; then
if [ "$module_variant" = "0x12" ]; then
INSTALL_UBOOT_FILENAME="u-boot-cc${soc_family}sbc2GB.imx"
elif [ "$module_variant" = "0x01" ] || \
[ "$module_variant" = "0x02" ] || \
[ "$module_variant" = "0x04" ] || \
[ "$module_variant" = "0x05" ] || \
[ "$module_variant" = "0x0b" ] || \
[ "$module_variant" = "0x0d" ] || \
[ "$module_variant" = "0x10" ] || \
[ "$module_variant" = "0x11" ] || \
[ "$module_variant" = "0x14" ] || \
[ "$module_variant" = "0x15" ] || \
[ "$module_variant" = "0x16" ]; then
INSTALL_UBOOT_FILENAME="u-boot-cc${soc_family}sbc.imx"
else
INSTALL_UBOOT_FILENAME="u-boot-cc${soc_family}sbc512MB.imx"
fi
fi
fi
# U-Boot when the checked value is empty.
if [ -n "${INSTALL_UBOOT_FILENAME}" ]; then
true
else
# remove redirect
uuu fb: ucmd setenv stdout serial
echo ""
echo "[ERROR] Cannot determine U-Boot file for this module!"
echo ""
echo "1. Set variable 'INSTALL_UBOOT_FILENAME' depending on your ConnectCore 6 variant:"
echo " - For a Quad/Dual CPU with 2GB DDR3, run:"
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc2GB.imx"
echo " - For a Quad/Dual CPU with 1GB DDR3, run:"
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc.imx"
echo " - For a Quad/Dual CPU with 512MB DDR3, run:"
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc512MB.imx"
echo " - For a DualLite/Solo CPU with 1GB DDR3, run:"
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc.imx"
echo " - For a DualLite/Solo CPU with 512MB DDR3, run:"
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc512MB.imx"
echo ""
echo "2. Run the install script again."
echo ""
echo "Aborted"
echo ""
exit
fi
fi
# remove redirect
uuu fb: ucmd setenv stdout serial
# Determine linux, recovery, and rootfs image filenames to update
if [ -z "${IMAGE_NAME}" ]; then
IMAGE_NAME="##DEFAULT_IMAGE_NAME##"
fi
GRAPHICAL_IMAGES="##GRAPHICAL_IMAGES##"
for g in ${GRAPHICAL_IMAGES}; do
if [ "${IMAGE_NAME}" = "${g}" ]; then
BASEFILENAME="${IMAGE_NAME}-##GRAPHICAL_BACKEND##"
fi
done
if [ -z "${BASEFILENAME}" ]; then
BASEFILENAME="${IMAGE_NAME}"
fi
INSTALL_LINUX_FILENAME="${BASEFILENAME}-##MACHINE##.boot.vfat"
INSTALL_RECOVERY_FILENAME="${BASEFILENAME}-##MACHINE##.recovery.vfat"
INSTALL_ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
COMPRESSED_ROOTFS_IMAGE="${INSTALL_ROOTFS_FILENAME}.gz"
# If the rootfs image is compressed, make sure to decompress it before the update
if [ -f ${COMPRESSED_ROOTFS_IMAGE} ] && [ ! -f ${INSTALL_ROOTFS_FILENAME} ]; then
echo "\033[36m"
echo "====================================================================================="
echo "Decompressing rootfs image '${COMPRESSED_ROOTFS_IMAGE}'"
echo "====================================================================================="
echo "\033[0m"
gzip -d -k -f "${COMPRESSED_ROOTFS_IMAGE}"
fi
# Verify existance of files before starting the update
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}"
for f in ${FILES}; do
if [ ! -f ${f} ]; then
echo "\033[31m[ERROR] Could not find file '${f}'\033[0m"
ABORT=true
fi
done;
[ "${ABORT}" = true ] && exit 1
# parts names
LINUX_NAME="linux"
RECOVERY_NAME="recovery"
ROOTFS_NAME="rootfs"
# Print warning about storage media being deleted
if [ "${NOWAIT}" != true ]; then
WAIT=10
printf "\n"
printf " ====================\n"
printf " = IMPORTANT! =\n"
printf " ====================\n"
printf " This process will erase your eMMC and will install the following files\n"
printf " on the partitions of the eMMC.\n"
printf "\n"
printf " PARTITION\tFILENAME\n"
printf " ---------\t--------\n"
printf " bootloader\t${INSTALL_UBOOT_FILENAME}\n"
if [ "${DUALBOOT}" = true ]; then
printf " ${LINUX_NAME}_a\t${INSTALL_LINUX_FILENAME}\n"
printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n"
printf " ${ROOTFS_NAME}_a\t${INSTALL_ROOTFS_FILENAME}\n"
printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n"
else
printf " ${LINUX_NAME}\t${INSTALL_LINUX_FILENAME}\n"
printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n"
printf " ${ROOTFS_NAME}\t${INSTALL_ROOTFS_FILENAME}\n"
fi
printf "\n"
printf " Press CTRL+C now if you wish to abort.\n"
printf "\n"
while [ ${WAIT} -gt 0 ]; do
printf "\r Update process starts in %d " ${WAIT}
sleep 1
WAIT=$(( ${WAIT} - 1 ))
done
printf "\r \n"
printf " Starting update process\n"
fi
# Skip user confirmation for U-Boot update
uuu fb: ucmd setenv forced_update 1
# Update U-Boot
part_update "bootloader" "${INSTALL_UBOOT_FILENAME}"
# Set MMC to boot from BOOT1 partition
uuu fb: ucmd mmc partconf 0 1 1 1
# Set 'bootcmd' for the second part of the script that will
# - Reset environment to defaults
# - Save the environment
# - Partition the eMMC user data area for Linux
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
uuu fb: ucmd setenv bootcmd "
env default -a;
setenv dualboot \${dualboot};
saveenv;
echo \"\";
echo \"\";
echo \">> Creating Linux partition table on the eMMC\";
echo \"\";
echo \"\";
run partition_mmc_linux;
if test \$? -eq 1; then
echo \"[ERROR] Failed to create Linux partition table!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Start installation Linux firmware files\";
echo \"\";
echo \"\";
saveenv;
fastboot 0;
"
uuu fb: ucmd saveenv
uuu fb: acmd reset
# Wait for the target to reset
sleep 3
# Restart fastboot with the latest MMC partition configuration
uuu fb: ucmd setenv fastboot_dev sata
uuu fb: ucmd setenv fastboot_dev mmc
# Set fastboot buffer address to $loadaddr, just in case
uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
if [ "${DUALBOOT}" = true ]; then
# Update Linux A
part_update "${LINUX_NAME}_a" "${INSTALL_LINUX_FILENAME}"
# Update Linux B
part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}"
# Update Rootfs A
part_update "${ROOTFS_NAME}_a" "${INSTALL_ROOTFS_FILENAME}"
# Update Rootfs B
part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}"
else
# Update Linux
part_update "${LINUX_NAME}" "${INSTALL_LINUX_FILENAME}"
# Update Recovery
part_update "${RECOVERY_NAME}" "${INSTALL_RECOVERY_FILENAME}"
# Update Rootfs
part_update "${ROOTFS_NAME}" "${INSTALL_ROOTFS_FILENAME}"
fi
# If the rootfs image was originally compressed, remove the uncompressed image
if [ -f ${COMPRESSED_ROOTFS_IMAGE} ] && [ -f ${INSTALL_ROOTFS_FILENAME} ]; then
rm -f "${INSTALL_ROOTFS_FILENAME}"
fi
if [ "${DUALBOOT}" != true ]; then
# Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes
uuu fb: ucmd setenv recovery_command wipe_update
fi
uuu fb: ucmd saveenv
# Reset the target
uuu fb: acmd reset
echo "\033[32m"
echo "============================================================="
echo "Done! Wait for the target to complete first boot process."
echo "============================================================="
echo "\033[0m"
exit

View File

@ -81,9 +81,16 @@ echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
if test \"\$\{dualboot\}\" = yes; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
echo " linux_b ${INSTALL_LINUX_FILENAME}"
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
@ -121,65 +128,129 @@ fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'singlemtdsys' and 'dualboot' if previously set
# - Run 'partition_nand_linux' script to re-partition the NAND if needed
# - Save the environment
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv singlemtdsys ${singlemtdsys};
setenv dualboot ${dualboot};
run partition_nand_linux;
saveenv;
if test \"\$\{singlemtdsys\}\" = yes; then
run ubivolscript;
else
force_erase="-e"
fi;
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"\";
update linux_a mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
if test \"\$\{singlemtdsys\}\" != yes; then
nand erase.part update;
fi;
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
saveenv;
echo \"\";
echo \"\";
echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\";
echo \"\";
echo \"\";
nand erase.part linux;
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
echo \"\";
echo \"Aborted.\";
exit;
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\";
echo \"\";
echo \"\";
nand erase.part recovery;
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\";
echo \"\";
echo \"\";
nand erase.part rootfs;
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
nand erase.part update;
setenv boot_recovery yes;
setenv recovery_command wipe_update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete. Rebooting into recovery mode for final deployment.\";
echo \"\";
echo \"\";
sleep 1;
reset;
"

View File

@ -81,9 +81,16 @@ echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
if test \"\$\{dualboot\}\" = yes; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
echo " linux_b ${INSTALL_LINUX_FILENAME}"
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
@ -110,7 +117,7 @@ echo ""
update uboot usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
update uboot usb ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
@ -121,64 +128,128 @@ fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'singlemtdsys' and 'dualboot' if previously set
# - Run 'partition_nand_linux' script to re-partition the NAND if needed
# - Save the environment
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv singlemtdsys ${singlemtdsys};
setenv dualboot ${dualboot};
run partition_nand_linux;
saveenv;
if test \"\$\{singlemtdsys\}\" = yes; then
run ubivolscript;
else
force_erase="-e"
fi;
usb start;
echo \"\";
echo \"\";
echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\";
echo \"\";
echo \"\";
nand erase.part linux;
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\";
echo \"\";
echo \"\";
nand erase.part recovery;
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\";
echo \"\";
echo \"\";
nand erase.part rootfs;
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"Aborted.\";
exit;
echo \"\";
update linux_a usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME} ${force_erase};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
if test \"\$\{singlemtdsys\}\" != yes; then
nand erase.part update;
fi;
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
echo \"\";
nand erase.part update;
setenv boot_recovery yes;
setenv recovery_command wipe_update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete. Rebooting into recovery mode for final deployment.\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;

View File

@ -18,6 +18,9 @@
# U-Boot script for installing Linux images created by Yocto
#
# Exit on any error
set -e
# Parse uuu cmd output
getenv()
{
@ -55,8 +58,16 @@ part_update()
echo "====================================================================================="
echo "\033[0m"
# When in Multi-MTD mode, pass -e to update command to force the erase
# of the MTD partition before programming. This is usually done by
# 'update' command except when a UBI volume is already found.
# On the install script, the MTD partition table may have changed, so
# we'd better clean the partition.
if [ "${SINGLEMTDSYS}" != true ]; then
ERASE="-e"
fi
uuu fb: download -f "${2}"
uuu "fb[-t ${3}]:" ucmd update "${1}" ram \${fastboot_buffer} \${fastboot_bytes}
uuu "fb[-t ${3}]:" ucmd update "${1}" ram \${fastboot_buffer} \${fastboot_bytes} ${ERASE}
}
clear
@ -77,12 +88,24 @@ do
esac
done
echo ""
echo "Determining image files to use..."
# Enable the redirect support to get u-boot variables values
uuu fb: ucmd setenv stdout serial,fastboot
# Check if dualboot variable is active
dualboot=$(getenv "dualboot")
if [ "${dualboot}" = "yes" ]; then
DUALBOOT=true;
fi
# Check if singlemtdsys variable is active
singlemtdsys=$(getenv "singlemtdsys")
if [ "${singlemtdsys}" = "yes" ]; then
SINGLEMTDSYS=true;
fi
echo ""
echo "Determining image files to use..."
# Determine U-Boot filename if not provided
if [ -z "${INSTALL_UBOOT_FILENAME}" ]; then
module_variant=$(getenv "module_variant")
@ -100,13 +123,13 @@ if [ -z "${INSTALL_UBOOT_FILENAME}" ]; then
fi
fi
# remove redirect
uuu fb: ucmd setenv stdout serial
# U-Boot when the checked value is empty.
if [ -n "${INSTALL_UBOOT_FILENAME}" ]; then
true
else
# remove redirect
uuu fb: ucmd setenv stdout serial
echo ""
echo "[ERROR] Cannot determine U-Boot file for this module!"
echo ""
@ -126,6 +149,9 @@ if [ -z "${INSTALL_UBOOT_FILENAME}" ]; then
fi
fi
# remove redirect
uuu fb: ucmd setenv stdout serial
# Determine linux, recovery, and rootfs image filenames to update
if [ -z "${IMAGE_NAME}" ]; then
IMAGE_NAME="##DEFAULT_IMAGE_NAME##"
@ -154,32 +180,43 @@ done;
[ "${ABORT}" = true ] && exit 1
# parts names
LINUX_NAME="linux"
RECOVERY_NAME="recovery"
ROOTFS_NAME="rootfs"
# Print warning about storage media being deleted
if [ ! "${NOWAIT}" = true ]; then
if [ "${NOWAIT}" != true ]; then
WAIT=10
echo ""
echo " ===================="
echo " = IMPORTANT! ="
echo " ===================="
echo " This process will erase your NAND and will install the following files"
echo " on the partitions of the NAND."
echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
echo ""
echo " Press CTRL+C now if you wish to abort."
echo ""
printf "\n"
printf " ====================\n"
printf " = IMPORTANT! =\n"
printf " ====================\n"
printf " This process will erase your NAND and will install the following files\n"
printf " on the partitions of the NAND.\n"
printf "\n"
printf " PARTITION\tFILENAME\n"
printf " ---------\t--------\n"
printf " bootloader\t${INSTALL_UBOOT_FILENAME}\n"
if [ "${DUALBOOT}" = true ]; then
printf " ${LINUX_NAME}_a\t${INSTALL_LINUX_FILENAME}\n"
printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n"
printf " ${ROOTFS_NAME}_a\t${INSTALL_ROOTFS_FILENAME}\n"
printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n"
else
printf " ${LINUX_NAME}\t${INSTALL_LINUX_FILENAME}\n"
printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n"
printf " ${ROOTFS_NAME}\t${INSTALL_ROOTFS_FILENAME}\n"
fi
printf "\n"
printf " Press CTRL+C now if you wish to abort.\n"
printf "\n"
while [ ${WAIT} -gt 0 ]; do
printf "\r Update process starts in %d " ${WAIT}
sleep 1
WAIT=$(( ${WAIT} - 1 ))
done
printf "\r \n"
echo " Starting update process"
printf " Starting update process\n"
fi
# Set fastboot buffer address to $loadaddr, just in case
@ -200,6 +237,8 @@ part_update "uboot" "${INSTALL_UBOOT_FILENAME}" 5000
# - Erase the 'update' partition
uuu fb: ucmd setenv bootcmd "
env default -a;
setenv dualboot \${dualboot};
setenv singlemtdsys \${singlemtdsys};
saveenv;
echo \"\";
echo \"\";
@ -218,22 +257,42 @@ sleep 3
# Set fastboot buffer address to $loadaddr
uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
# Update Linux
part_update "linux" "${INSTALL_LINUX_FILENAME}" 15000
# Create partition table
uuu "fb[-t 10000]:" ucmd run partition_nand_linux
# Update Recovery
part_update "recovery" "${INSTALL_RECOVERY_FILENAME}" 15000
if [ "${SINGLEMTDSYS}" = true ]; then
uuu "fb[-t 30000]:" ucmd nand erase.part system
uuu "fb[-t 10000]:" ucmd run ubivolscript
fi
# Update Rootfs
part_update "rootfs" "${INSTALL_ROOTFS_FILENAME}" 90000
if [ "${DUALBOOT}" = true ]; then
# Update Linux A
part_update "${LINUX_NAME}_a" "${INSTALL_LINUX_FILENAME}" 15000
# Update Linux B
part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}" 15000
# Update Rootfs A
part_update "${ROOTFS_NAME}_a" "${INSTALL_ROOTFS_FILENAME}" 90000
# Update Rootfs B
part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}" 90000
else
# Update Linux
part_update "${LINUX_NAME}" "${INSTALL_LINUX_FILENAME}" 15000
# Update Recovery
part_update "${RECOVERY_NAME}" "${INSTALL_RECOVERY_FILENAME}" 15000
# Update Rootfs
part_update "${ROOTFS_NAME}" "${INSTALL_ROOTFS_FILENAME}" 90000
fi
# Erase the 'Update' partition
uuu fb: ucmd nand erase.part update
# Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes
uuu fb: ucmd setenv recovery_command wipe_update
if [ "${SINGLEMTDSYS}" != true ] && [ "${DUALBOOT}" != true ]; then
# Erase the 'Update' partition
uuu "fb[-t 20000]:" ucmd nand erase.part update
fi
if [ "${DUALBOOT}" != true ]; then
# Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes
uuu fb: ucmd setenv recovery_command wipe_update
fi
uuu fb: ucmd saveenv
# Reset the target

View File

@ -2,6 +2,40 @@
# U-Boot bootscript for NAND images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# Dual boot update verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
setenv mtdbootpart ${active_system}
setenv mtdlinuxindex ${mtdlinux_a_index}
setenv mtdrootfsindex ${mtdrootfs_a_index}
setenv rootfsvol ${rootfsvol_a}
else
echo "Booting from system B"
setenv mtdbootpart ${active_system}
setenv mtdlinuxindex ${mtdlinux_b_index}
setenv mtdrootfsindex ${mtdrootfs_b_index}
setenv rootfsvol ${rootfsvol_b}
fi
fi
else
if test "${mtdbootpart}" = "recovery"; then
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
true
fi
fi
# Back up environment variables
setenv ORIG_extra_bootargs ${extra_bootargs}
@ -37,12 +71,6 @@ else
fi
fi
if test "${mtdbootpart}" = "recovery"; then
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
true
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux nand ${mtdbootpart}

View File

@ -2,6 +2,40 @@
# U-Boot bootscript for NAND images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# Dual boot update verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
setenv mtdbootpart ${active_system}
setenv mtdlinuxindex ${mtdlinux_a_index}
setenv mtdrootfsindex ${mtdrootfs_a_index}
setenv rootfsvol ${rootfsvol_a}
else
echo "Booting from system B"
setenv mtdbootpart ${active_system}
setenv mtdlinuxindex ${mtdlinux_b_index}
setenv mtdrootfsindex ${mtdrootfs_b_index}
setenv rootfsvol ${rootfsvol_b}
fi
fi
else
if test "${mtdbootpart}" = "recovery"; then
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
true
fi
fi
# Back up environment variables
setenv ORIG_extra_bootargs ${extra_bootargs}
@ -37,12 +71,6 @@ else
fi
fi
if test "${mtdbootpart}" = "recovery"; then
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
true
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux nand ${mtdbootpart}

View File

@ -48,9 +48,16 @@ echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
if test \"\$\{dualboot\}\" = yes; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
echo " linux_b ${INSTALL_LINUX_FILENAME}"
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
@ -91,17 +98,20 @@ fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Force on-the-fly updates to avoid possible verification errors
# - Partition the eMMC user data area for Linux
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
# - Configure recovery to wipe 'update' partition
# - Disable on-the-fly updates
# - Run 'recovery' and let the system boot after
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
saveenv;
setenv otf-update yes;
echo \"\";
@ -116,50 +126,104 @@ setenv bootcmd "
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"Aborted.\";
exit;
echo \"\";
update linux_a mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
setenv otf-update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete. Rebooting into recovery mode for final deployment.\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;

View File

@ -48,9 +48,16 @@ echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
if test \"\$\{dualboot\}\" = yes; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
echo " linux_b ${INSTALL_LINUX_FILENAME}"
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
@ -80,7 +87,7 @@ echo ""
update uboot usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
update uboot usb ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
@ -91,17 +98,20 @@ fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Force on-the-fly updates to avoid possible verification errors
# - Partition the eMMC user data area for Linux
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
# - Configure recovery to wipe 'update' partition
# - Disable on-the-fly updates
# - Run 'recovery' and let the system boot after
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
saveenv;
setenv otf-update yes;
echo \"\";
@ -117,50 +127,104 @@ setenv bootcmd "
exit;
fi;
usb start;
echo \"\";
echo \"\";
echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"Aborted.\";
exit;
echo \"\";
update linux_a usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
setenv otf-update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete. Rebooting into recovery mode for final deployment.\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;

View File

@ -18,6 +18,9 @@
# U-Boot script for installing Linux images created by Yocto
#
# Exit on any error
set -e
# Parse uuu cmd output
getenv()
{
@ -76,6 +79,18 @@ do
esac
done
# Enable the redirect support to get u-boot variables values
uuu fb: ucmd setenv stdout serial,fastboot
# Check if dualboot variable is active
dualboot=$(getenv "dualboot")
if [ "${dualboot}" = "yes" ]; then
DUALBOOT=true;
fi
# remove redirect
uuu fb: ucmd setenv stdout serial
echo ""
echo "Determining image files to use..."
@ -124,32 +139,43 @@ done;
[ "${ABORT}" = true ] && exit 1
# parts names
LINUX_NAME="linux"
RECOVERY_NAME="recovery"
ROOTFS_NAME="rootfs"
# Print warning about storage media being deleted
if [ ! "${NOWAIT}" = true ]; then
if [ "${NOWAIT}" != true ]; then
WAIT=10
echo ""
echo " ===================="
echo " = IMPORTANT! ="
echo " ===================="
echo " This process will erase your eMMC and will install the following files"
echo " on the partitions of the eMMC."
echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
echo ""
echo " Press CTRL+C now if you wish to abort."
echo ""
printf "\n"
printf " ====================\n"
printf " = IMPORTANT! =\n"
printf " ====================\n"
printf " This process will erase your eMMC and will install the following files\n"
printf " on the partitions of the eMMC.\n"
printf "\n"
printf " PARTITION\tFILENAME\n"
printf " ---------\t--------\n"
printf " bootloader\t${INSTALL_UBOOT_FILENAME}\n"
if [ "${DUALBOOT}" = true ]; then
printf " ${LINUX_NAME}_a\t${INSTALL_LINUX_FILENAME}\n"
printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n"
printf " ${ROOTFS_NAME}_a\t${INSTALL_ROOTFS_FILENAME}\n"
printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n"
else
printf " ${LINUX_NAME}\t${INSTALL_LINUX_FILENAME}\n"
printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n"
printf " ${ROOTFS_NAME}\t${INSTALL_ROOTFS_FILENAME}\n"
fi
printf "\n"
printf " Press CTRL+C now if you wish to abort.\n"
printf "\n"
while [ ${WAIT} -gt 0 ]; do
printf "\r Update process starts in %d " ${WAIT}
sleep 1
WAIT=$(( ${WAIT} - 1 ))
done
printf "\r \n"
echo " Starting update process"
printf " Starting update process\n"
fi
# Set fastboot buffer address to $loadaddr, just in case
@ -173,6 +199,7 @@ uuu fb: ucmd mmc partconf 0 1 1 1
# - Update the 'rootfs' partition
uuu fb: ucmd setenv bootcmd "
env default -a;
setenv dualboot \${dualboot};
saveenv;
echo \"\";
echo \"\";
@ -208,24 +235,34 @@ uuu fb: ucmd setenv fastboot_dev mmc
# Set fastboot buffer address to $loadaddr, just in case
uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
# Update Linux
part_update "linux" "${INSTALL_LINUX_FILENAME}"
# Update Recovery
part_update "recovery" "${INSTALL_RECOVERY_FILENAME}"
# Update Rootfs
part_update "rootfs" "${INSTALL_ROOTFS_FILENAME}"
if [ "${DUALBOOT}" = true ]; then
# Update Linux A
part_update "${LINUX_NAME}_a" "${INSTALL_LINUX_FILENAME}"
# Update Linux B
part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}"
# Update Rootfs A
part_update "${ROOTFS_NAME}_a" "${INSTALL_ROOTFS_FILENAME}"
# Update Rootfs B
part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}"
else
# Update Linux
part_update "${LINUX_NAME}" "${INSTALL_LINUX_FILENAME}"
# Update Recovery
part_update "${RECOVERY_NAME}" "${INSTALL_RECOVERY_FILENAME}"
# Update Rootfs
part_update "${ROOTFS_NAME}" "${INSTALL_ROOTFS_FILENAME}"
fi
# If the rootfs image was originally compressed, remove the uncompressed image
if [ -f ${COMPRESSED_ROOTFS_IMAGE} ] && [ -f ${INSTALL_ROOTFS_FILENAME} ]; then
rm -f "${INSTALL_ROOTFS_FILENAME}"
fi
# Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes
uuu fb: ucmd setenv recovery_command wipe_update
if [ "${DUALBOOT}" != true ]; then
# Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes
uuu fb: ucmd setenv recovery_command wipe_update
fi
uuu fb: ucmd saveenv
# Reset the target

View File

@ -2,10 +2,63 @@
# U-Boot bootscript for EMMC/SD images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# Dual boot update verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
echo "Booting from system B"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
fi
else
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
fi
# Back up environment variables
setenv ORIG_overlays ${overlays}
setenv ORIG_extra_bootargs ${extra_bootargs}
# Set SOC type to "imx8mm" if not already defined by U-Boot
if test ! -n "${soc_type}"; then
setenv soc_type "imx8mm"
fi
#
# Determine overlays to apply depending on the hardware capabilities
# described by the HWID, SOM version, and carrier board version.
@ -28,20 +81,6 @@ if test -n "${module_ram}"; then
fi
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux mmc ${mmcbootdev}:${mmcpart}

View File

@ -2,10 +2,63 @@
# U-Boot bootscript for EMMC/SD images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# Dual boot update verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
echo "Booting from system B"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
fi
else
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
fi
# Back up environment variables
setenv ORIG_overlays ${overlays}
setenv ORIG_extra_bootargs ${extra_bootargs}
# Set SOC type to "imx8mn" if not already defined by U-Boot
if test ! -n "${soc_type}"; then
setenv soc_type "imx8mn"
fi
#
# Determine overlays to apply depending on the hardware capabilities
# described by the HWID, SOM version, and carrier board version.
@ -37,20 +90,6 @@ if test "${board_version}" -lt "3"; then
setenv overlays _ov_board_v1-v2_ccimx8mn-dvk.dtbo,${overlays}
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux mmc ${mmcbootdev}:${mmcpart}

View File

@ -2,6 +2,54 @@
# U-Boot bootscript for EMMC/SD images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# Dual boot update verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
echo "Booting from system B"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
fi
else
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
fi
# Back up environment variables
setenv ORIG_overlays ${overlays}
setenv ORIG_extra_bootargs ${extra_bootargs}
@ -45,20 +93,6 @@ if test "${soc_type}" = "imx8qxp"; then
setenv overlays _ov_som_quad_ccimx8x.dtbo,${overlays}
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux mmc ${mmcbootdev}:${mmcpart}

View File

@ -2,6 +2,54 @@
# U-Boot bootscript for EMMC/SD images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# Dual boot update verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
echo "Booting from system B"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
fi
else
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
fi
# Back up environment variables
setenv ORIG_overlays ${overlays}
setenv ORIG_extra_bootargs ${extra_bootargs}
@ -50,20 +98,6 @@ if test "${board_version}" -le "3"; then
setenv overlays _ov_board_v1-v3_ccimx8x-sbc-pro.dtbo,${overlays}
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux mmc ${mmcbootdev}:${mmcpart}

View File

@ -119,9 +119,16 @@ echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
if test \"\$\{dualboot\}\" = yes; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
echo " linux_b ${INSTALL_LINUX_FILENAME}"
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
@ -162,17 +169,20 @@ fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Force on-the-fly updates to avoid possible verification errors
# - Partition the eMMC user data area for Linux
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
# - Configure recovery to wipe 'update' partition
# - Disable on-the-fly updates
# - Run 'recovery' and let the system boot after
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
saveenv;
setenv otf-update yes;
echo \"\";
@ -187,50 +197,104 @@ setenv bootcmd "
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"Aborted.\";
exit;
echo \"\";
update linux_a mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
setenv otf-update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete. Rebooting into recovery mode for final deployment.\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;

View File

@ -119,9 +119,16 @@ echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
if test \"\$\{dualboot\}\" = yes; then
echo " linux_a ${INSTALL_LINUX_FILENAME}"
echo " linux_b ${INSTALL_LINUX_FILENAME}"
echo " rootfs_a ${INSTALL_ROOTFS_FILENAME}"
echo " rootfs_b ${INSTALL_ROOTFS_FILENAME}"
else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
fi
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
@ -151,7 +158,7 @@ echo ""
update uboot usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
# Use old-style update with source file system argument
update uboot mmc ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
update uboot usb ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME}
if test $? -eq 1; then
echo "[ERROR] Failed to update U-Boot boot loader!";
echo "";
@ -162,17 +169,21 @@ fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set
# - Save the environment
# - Force on-the-fly updates to avoid possible verification errors
# - Partition the eMMC user data area for Linux
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
# - Configure recovery to wipe 'update' partition
# - Disable on-the-fly updates
# - Run 'recovery' and let the system boot after
# - If Dual Boot
# - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
# NOTE: insert some 'usb reset' commands to avoid EHCI timeouts
setenv bootcmd "
env default -a;
setenv dualboot ${dualboot};
saveenv;
setenv otf-update yes;
echo \"\";
@ -188,50 +199,105 @@ setenv bootcmd "
exit;
fi;
usb start;
echo \"\";
echo \"\";
echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
if test \"\$\{dualboot\}\" = yes; then
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_a\";
echo \"\";
echo \"Aborted.\";
exit;
echo \"\";
update linux_a usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_a!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux_b\";
echo \"\";
echo \"\";
update linux_b usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux_b!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
usb reset;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_a\";
echo \"\";
echo \"\";
update rootfs_a usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_a partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs_b\";
echo \"\";
echo \"\";
update rootfs_b usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs_b partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
else
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_LINUX_FILENAME} on linux\";
echo \"\";
echo \"\";
update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_RECOVERY_FILENAME} on recovery\";
echo \"\";
echo \"\";
update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
echo \"\";
echo \">> Installing file ${INSTALL_ROOTFS_FILENAME} on rootfs\";
echo \"\";
echo \"\";
update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
echo \"\";
setenv boot_recovery yes;
setenv recovery_command wipe_update;
setenv otf-update;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete. Rebooting into recovery mode for final deployment.\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;

View File

@ -18,6 +18,9 @@
# U-Boot script for installing Linux images created by Yocto
#
# Exit on any error
set -e
# Parse uuu cmd output
getenv()
{
@ -76,14 +79,20 @@ do
esac
done
# Enable the redirect support to get u-boot variables values
uuu fb: ucmd setenv stdout serial,fastboot
# Check if dualboot variable is active
dualboot=$(getenv "dualboot")
if [ "${dualboot}" = "yes" ]; then
DUALBOOT=true;
fi
echo ""
echo "Determining image files to use..."
# Determine U-Boot file to program basing on SOM's SOC type (linked to bus width)
if [ -z ${INSTALL_UBOOT_FILENAME} ]; then
# Enable the redirect support to get u-boot variables values
uuu fb: ucmd setenv stdout serial,fastboot
# Since SOMs with the B0 SOC might have an older U-Boot that doesn't export the
# SOC revision to the environment, use B0 by default
soc_rev=$(getenv "soc_rev")
@ -118,13 +127,13 @@ if [ -z ${INSTALL_UBOOT_FILENAME} ]; then
INSTALL_UBOOT_FILENAME="imx-boot-##MACHINE##-${soc_rev}-${module_ram}_${bus_width}.bin"
fi
# remove redirect
uuu fb: ucmd setenv stdout serial
# U-Boot when the checked value is empty.
if [ -n "${INSTALL_UBOOT_FILENAME}" ]; then
true
else
# remove redirect
uuu fb: ucmd setenv stdout serial
echo ""
echo "[ERROR] Cannot determine U-Boot file for this module!"
echo ""
@ -146,6 +155,9 @@ if [ -z ${INSTALL_UBOOT_FILENAME} ]; then
fi
fi
# remove redirect
uuu fb: ucmd setenv stdout serial
# Determine linux, recovery, and rootfs image filenames to update
if [ -z "${IMAGE_NAME}" ]; then
IMAGE_NAME="##DEFAULT_IMAGE_NAME##"
@ -186,32 +198,43 @@ done;
[ "${ABORT}" = true ] && exit 1
# parts names
LINUX_NAME="linux"
RECOVERY_NAME="recovery"
ROOTFS_NAME="rootfs"
# Print warning about storage media being deleted
if [ ! "${NOWAIT}" = true ]; then
if [ "${NOWAIT}" != true ]; then
WAIT=10
echo ""
echo " ===================="
echo " = IMPORTANT! ="
echo " ===================="
echo " This process will erase your eMMC and will install the following files"
echo " on the partitions of the eMMC."
echo ""
echo " PARTITION FILENAME"
echo " --------- --------"
echo " bootloader ${INSTALL_UBOOT_FILENAME}"
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
echo ""
echo " Press CTRL+C now if you wish to abort."
echo ""
printf "\n"
printf " ====================\n"
printf " = IMPORTANT! =\n"
printf " ====================\n"
printf " This process will erase your eMMC and will install the following files\n"
printf " on the partitions of the eMMC.\n"
printf "\n"
printf " PARTITION\tFILENAME\n"
printf " ---------\t--------\n"
printf " bootloader\t${INSTALL_UBOOT_FILENAME}\n"
if [ "${DUALBOOT}" = true ]; then
printf " ${LINUX_NAME}_a\t${INSTALL_LINUX_FILENAME}\n"
printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n"
printf " ${ROOTFS_NAME}_a\t${INSTALL_ROOTFS_FILENAME}\n"
printf " ${ROOTFS_NAME}_b\t${INSTALL_ROOTFS_FILENAME}\n"
else
printf " ${LINUX_NAME}\t${INSTALL_LINUX_FILENAME}\n"
printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n"
printf " ${ROOTFS_NAME}\t${INSTALL_ROOTFS_FILENAME}\n"
fi
printf "\n"
printf " Press CTRL+C now if you wish to abort.\n"
printf "\n"
while [ ${WAIT} -gt 0 ]; do
printf "\r Update process starts in %d " ${WAIT}
sleep 1
WAIT=$(( ${WAIT} - 1 ))
done
printf "\r \n"
echo " Starting update process"
printf " Starting update process\n"
fi
# Skip user confirmation for U-Boot update
@ -232,6 +255,7 @@ uuu fb: ucmd mmc partconf 0 1 1 1
# - Update the 'rootfs' partition
uuu fb: ucmd setenv bootcmd "
env default -a;
setenv dualboot \${dualboot};
saveenv;
echo \"\";
echo \"\";
@ -267,24 +291,34 @@ uuu fb: ucmd setenv fastboot_dev mmc
# Set fastboot buffer address to $loadaddr, just in case
uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
# Update Linux
part_update "linux" "${INSTALL_LINUX_FILENAME}"
# Update Recovery
part_update "recovery" "${INSTALL_RECOVERY_FILENAME}"
# Update Rootfs
part_update "rootfs" "${INSTALL_ROOTFS_FILENAME}"
if [ "${DUALBOOT}" = true ]; then
# Update Linux A
part_update "${LINUX_NAME}_a" "${INSTALL_LINUX_FILENAME}"
# Update Linux B
part_update "${LINUX_NAME}_b" "${INSTALL_LINUX_FILENAME}"
# Update Rootfs A
part_update "${ROOTFS_NAME}_a" "${INSTALL_ROOTFS_FILENAME}"
# Update Rootfs B
part_update "${ROOTFS_NAME}_b" "${INSTALL_ROOTFS_FILENAME}"
else
# Update Linux
part_update "${LINUX_NAME}" "${INSTALL_LINUX_FILENAME}"
# Update Recovery
part_update "${RECOVERY_NAME}" "${INSTALL_RECOVERY_FILENAME}"
# Update Rootfs
part_update "${ROOTFS_NAME}" "${INSTALL_ROOTFS_FILENAME}"
fi
# If the rootfs image was originally compressed, remove the uncompressed image
if [ -f ${COMPRESSED_ROOTFS_IMAGE} ] && [ -f ${INSTALL_ROOTFS_FILENAME} ]; then
rm -f "${INSTALL_ROOTFS_FILENAME}"
fi
# Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes
uuu fb: ucmd setenv recovery_command wipe_update
if [ "${DUALBOOT}" != true ]; then
# Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes
uuu fb: ucmd setenv recovery_command wipe_update
fi
uuu fb: ucmd saveenv
# Reset the target

View File

@ -16,6 +16,7 @@
# Digi-mounted partitions: linux, update
SUBSYSTEM=="block", ENV{ID_PART_ENTRY_NAME}=="linux*|update*", ACTION=="add", RUN+="/etc/udev/scripts/mount_digiparts.sh", GOTO="automount_rules_end"
SUBSYSTEM=="mtd", ATTRS{name}=="linux*|update*", ACTION=="add", RUN+="/etc/udev/scripts/mount_digiparts.sh", GOTO="automount_rules_end"
SUBSYSTEM=="ubi", ATTRS{name}=="linux*|update*", ACTION=="add", RUN+="/etc/udev/scripts/mount_digiparts.sh", GOTO="automount_rules_end"
# Avoid mounting recovery partition
SUBSYSTEM=="block", ENV{ID_PART_ENTRY_NAME}=="recovery*", ACTION=="add", GOTO="automount_rules_end"

View File

@ -22,6 +22,8 @@ if [ "${SUBSYSTEM}" = "block" ]; then
elif [ "${SUBSYSTEM}" = "mtd" ]; then
MTDN="$(echo ${DEVNAME} | cut -f 3 -d /)"
PARTNAME="$(grep ${MTDN} /proc/mtd | sed -ne 's,.*"\(.*\)",\1,g;T;p')"
elif [ "${SUBSYSTEM}" = "ubi" ]; then
PARTNAME="$(cat /sys/${DEVPATH}/name)"
fi
MOUNT_PARAMS="-o silent"
@ -89,4 +91,12 @@ elif [ "${SUBSYSTEM}" = "mtd" ]; then
logger -t udev "ERROR: Could not mount '${PARTNAME}' partition, volume not found"
rmdir --ignore-fail-on-non-empty ${MOUNTPOINT}
fi
elif [ "${SUBSYSTEM}" = "ubi" ]; then
# In the case of a 'system' partition with many UBI volumes, the device
# is always /dev/ubi0
# Mount the volume.
if ! mount -t ubifs ubi0:${PARTNAME} ${MOUNT_PARAMS} ${MOUNTPOINT}; then
logger -t udev "ERROR: Could not mount '${PARTNAME}' volume"
rmdir --ignore-fail-on-non-empty ${MOUNTPOINT}
fi
fi

View File

@ -8,13 +8,13 @@ PKGNAME = "mca_tool"
# ARM tarball
SRC_URI_arm = "${DIGI_PKG_SRC}/${PKGNAME}-${PV}-${TUNE_ARCH}.tar.gz;name=arm"
SRC_URI[arm.md5sum] = "bbeded0a955a026d302cd4ee212d920e"
SRC_URI[arm.sha256sum] = "33de60f59bfa3e4b867bd872f05413a823852a1e33b21efcddd714454978bb9a"
SRC_URI[arm.md5sum] = "ffa8967cb9b684f3846b641a5d57b8f6"
SRC_URI[arm.sha256sum] = "057c289990d79f0b749e9d0d7af2570332e9215e697de75dc6851d89bdd61dff"
# AARCH64 tarball
SRC_URI_aarch64 = "${DIGI_PKG_SRC}/${PKGNAME}-${PV}-${TUNE_ARCH}.tar.gz;name=aarch64"
SRC_URI[aarch64.md5sum] = "cf64de7f5aad9cd6a102afd18aebd8bb"
SRC_URI[aarch64.sha256sum] = "c4652b8c0dd54315d7890c47798199948ea595a7dea8de5b6d68a1bfd3853557"
SRC_URI[aarch64.md5sum] = "12033830965f2861628461c612a7604e"
SRC_URI[aarch64.sha256sum] = "2467e426c6a4e6b89f4aaced846c1f52787e130f16ffb62e6f046bea7bc4f21f"
S = "${WORKDIR}/${PKGNAME}-${PV}"

View File

@ -33,13 +33,14 @@ done
SCRIPT_NAME="$(basename ${0})"
SCRIPT_PATH="$(cd $(dirname ${0}) && pwd)"
while getopts "bdilop:" c; do
while getopts "bdilorp:" c; do
case "${c}" in
b) ARTIFACT_BOOTSCRIPT="y";;
d) ARTIFACT_DTB="y";;
i) ARTIFACT_INITRAMFS="y";;
l) ARTIFACT_KERNEL="y";;
o) ARTIFACT_DTB_OVERLAY="y";;
r) ARTIFACT_ROOTFS="y";;
p) PLATFORM="${OPTARG}";;
esac
done
@ -56,6 +57,7 @@ Usage: ${SCRIPT_NAME} [OPTIONS] input-unsigned-image output-signed-image
-o sign/encrypt DTB overlay
-i sign/encrypt initramfs
-l sign/encrypt Linux image
-r sign read-only rootfs image
Supported platforms: ccimx6, ccimx6ul, ccimx8x, ccimx8mn, ccimx8mm
@ -88,20 +90,24 @@ if [ "${PLATFORM}" = "ccimx6" ]; then
CONFIG_FDT_LOADADDR="0x18000000"
CONFIG_RAMDISK_LOADADDR="0x19000000"
CONFIG_KERNEL_LOADADDR="0x12000000"
CONFIG_ROOTFS_LOADADDR="0x19800000"
CONFIG_CSF_SIZE="0x4000"
elif [ "${PLATFORM}" = "ccimx6ul" ]; then
CONFIG_FDT_LOADADDR="0x83000000"
CONFIG_RAMDISK_LOADADDR="0x83800000"
CONFIG_KERNEL_LOADADDR="0x80800000"
CONFIG_ROOTFS_LOADADDR="0x84000000"
CONFIG_CSF_SIZE="0x4000"
elif [ "${PLATFORM}" = "ccimx8x" ]; then
CONFIG_FDT_LOADADDR="0x82000000"
CONFIG_RAMDISK_LOADADDR="0x82100000"
CONFIG_KERNEL_LOADADDR="0x80280000"
CONFIG_ROOTFS_LOADADDR="0x82900000"
elif [ "${PLATFORM}" = "ccimx8mn" ] || [ "${PLATFORM}" = "ccimx8mm" ]; then
CONFIG_FDT_LOADADDR="0x43000000"
CONFIG_RAMDISK_LOADADDR="0x43800000"
CONFIG_KERNEL_LOADADDR="0x40480000"
CONFIG_ROOTFS_LOADADDR="0x44000000"
CONFIG_CSF_SIZE="0x2000"
else
echo "Invalid platform: ${PLATFORM}"
@ -116,9 +122,10 @@ fi
[ "${ARTIFACT_BOOTSCRIPT}" = "y" ] && CONFIG_RAM_START="${CONFIG_KERNEL_LOADADDR}"
# DTB overlays are loaded to $initrd_addr, just like the ramdisk
[ "${ARTIFACT_DTB_OVERLAY}" = "y" ] && CONFIG_RAM_START="${CONFIG_RAMDISK_LOADADDR}"
[ "${ARTIFACT_ROOTFS}" = "y" ] && CONFIG_RAM_START="${CONFIG_ROOTFS_LOADADDR}"
if [ -z "${CONFIG_RAM_START}" ]; then
echo "Specify the type of image to process (-b, -i, -d, -l, or -o)"
echo "Specify the type of image to process (-b, -i, -d, -l, -r, or -o)"
exit 1
fi

View File

@ -12,7 +12,12 @@ SRCREV = "${AUTOREV}"
S = "${WORKDIR}"
# Select internal or Github U-Boot repo
UBOOT_GIT_URI ?= "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_GIT}u-boot-denx.git', '${DIGI_GITHUB_GIT}/u-boot.git;protocol=https', d)}"
DIGI_LOG_REPO = "u-boot-denx.git"
DIGI_MTK_REPO = "uboot/u-boot-denx.git"
GITHUB_REPO = "u-boot.git"
UBOOT_GIT_URI ?= "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1' , \
oe.utils.conditional('DIGI_GIT', '${DIGI_LOG_GIT}', '${DIGI_GIT}/${DIGI_LOG_REPO}', '${DIGI_GIT}/${DIGI_MTK_REPO};protocol=ssh', d), \
'${DIGI_GITHUB_GIT}/${GITHUB_REPO};protocol=https', d)}"
SRC_URI = " \
${UBOOT_GIT_URI};branch=${SRCBRANCH} \

View File

@ -1,4 +1,4 @@
# Copyright (C) 2016-2020 Digi International.
# Copyright (C) 2016-2021 Digi International.
SUMMARY = "Qualcomm's wireless driver for qca65xx"
DESCRIPTION = "qcacld-2.0 module"
@ -11,7 +11,7 @@ PV = "v4.0.11.213X"
SRCBRANCH = "qca65X4/dey-3.2/maint"
SRCREV = "${AUTOREV}"
QCOM_GIT_URI = "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_MTK_GIT}linux/qcacld-2.0.git;protocol=ssh', '${DIGI_GITHUB_GIT}/qcacld-2.0.git;protocol=https', d)}"
QCOM_GIT_URI = "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_MTK_GIT}/linux/qcacld-2.0.git;protocol=ssh', '${DIGI_GITHUB_GIT}/qcacld-2.0.git;protocol=https', d)}"
SRC_URI = " \
${QCOM_GIT_URI};branch=${SRCBRANCH} \

View File

@ -8,7 +8,13 @@ SRCBRANCH = "v5.4/dey-3.2/maint"
SRCREV = "${AUTOREV}"
# Select internal or Github Linux repo
LINUX_GIT_URI ?= "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1' , '${DIGI_GIT}linux-2.6.git', '${DIGI_GITHUB_GIT}/linux.git;protocol=https', d)}"
DIGI_LOG_REPO = "linux-2.6.git"
DIGI_MTK_REPO = "linux/linux.git"
GITHUB_REPO = "linux.git"
LINUX_GIT_URI ?= "${@oe.utils.conditional('DIGI_INTERNAL_GIT', '1' , \
oe.utils.conditional('DIGI_GIT', '${DIGI_LOG_GIT}', '${DIGI_GIT}/${DIGI_LOG_REPO}', '${DIGI_GIT}/${DIGI_MTK_REPO};protocol=ssh', d), \
'${DIGI_GITHUB_GIT}/${GITHUB_REPO};protocol=https', d)}"
SRC_URI = "${LINUX_GIT_URI};branch=${SRCBRANCH}"
S = "${WORKDIR}/git"

View File

@ -88,4 +88,14 @@ do_copy_defconfig () {
}
addtask copy_defconfig after do_patch before do_kernel_localversion
# Apply configuration fragments
do_configure_append() {
# Only accept fragments ending in .cfg. If the fragments contain
# something other than kernel configs, it will be filtered out
# automatically.
if [ -n "${@' '.join(find_cfgs(d))}" ]; then
${S}/scripts/kconfig/merge_config.sh -m -O ${B} ${B}/.config ${@" ".join(find_cfgs(d))}
fi
}
COMPATIBLE_MACHINE = "(ccimx6ul|ccimx8x|ccimx8m|ccimx6)"

View File

@ -56,3 +56,7 @@ fakeroot toolchain_create_sdk_dey_version() {
}
toolchain_create_sdk_dey_version[vardepsexclude] = "DATETIME"
#
# Add dependency for read-only signed rootfs
#
DEPENDS += "${@oe.utils.conditional('TRUSTFENCE_SIGN', '1', 'trustfence-sign-tools-native', '', d)}"

View File

@ -1,6 +1,6 @@
DISTRO = "dey"
DISTRO_NAME = "Digi Embedded Yocto"
DISTRO_VERSION = "3.2-r1"
DISTRO_VERSION = "3.2-r2"
DISTRO_CODENAME = "gatesgarth"
SDK_VENDOR = "-deysdk"
SDK_VERSION := "${@d.getVar('DISTRO_VERSION')}"
@ -79,6 +79,11 @@ PREFERRED_PROVIDER_virtual/wpebackend = "wpebackend-fdo"
# Use recipe from our meta-digi layer
PREFERRED_VERSION_tensorflow-lite ?= "2.5.0"
# Use gatesgarth default GLIBC version
# This will be removed once we update to the next
# Yocto version
PREFERRED_VERSION_glibc ?= "2.32"
SDK_NAME = "${DISTRO}-${TCLIBC}-${SDKMACHINE}-${IMAGE_BASENAME}-${TUNE_PKGARCH}-${MACHINE}"
SDKPATH = "/opt/${DISTRO}/${SDK_VERSION}/${MACHINE}"

View File

@ -8,6 +8,8 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
BBFILES_DYNAMIC += " \
webkit:${LAYERDIR}/dynamic-layers/webkit/*/*/*.bb \
webkit:${LAYERDIR}/dynamic-layers/webkit/*/*/*.bbappend \
selinux:${LAYERDIR}/dynamic-layers/selinux/*/*/*.bb \
selinux:${LAYERDIR}/dynamic-layers/selinux/*/*/*.bbappend \
"
BBFILE_COLLECTIONS += "digi-dey"

View File

@ -0,0 +1 @@
include selinux_dey.inc

View File

@ -0,0 +1 @@
include selinux_dey.inc

View File

@ -0,0 +1 @@
include selinux_dey.inc

View File

@ -0,0 +1 @@
IMAGE_INSTALL_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'packagegroup-core-selinux', '', d)}"

View File

@ -0,0 +1,32 @@
..........................................................................
. WARNING
.
. This file is a kernel configuration fragment, and not a full kernel
. configuration file. The final kernel configuration is made up of
. an assembly of processed fragments, each of which is designed to
. capture a specific part of the final configuration (e.g. platform
. configuration, feature configuration, and board specific hardware
. configuration). For more information on kernel configuration, please
. consult the product documentation.
.
..........................................................................
CONFIG_AUDIT=y
CONFIG_NETWORK_SECMARK=y
CONFIG_EXT2_FS_SECURITY=y
CONFIG_EXT3_FS_SECURITY=y
CONFIG_EXT4_FS_SECURITY=y
CONFIG_JFS_SECURITY=y
CONFIG_REISERFS_FS_SECURITY=y
CONFIG_JFFS2_FS_SECURITY=y
CONFIG_SECURITY=y
CONFIG_SECURITYFS=y
CONFIG_SECURITY_NETWORK=y
CONFIG_SECURITY_SELINUX=y
CONFIG_SECURITY_SELINUX_BOOTPARAM=y
CONFIG_SECURITY_SELINUX_DISABLE=y
CONFIG_SECURITY_SELINUX_DEVELOP=y
CONFIG_SECURITY_SELINUX_AVC_STATS=y
CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1
CONFIG_AUDIT_GENERIC=y
CONFIG_DEFAULT_SECURITY_DAC=n
CONFIG_LSM="lockdown,yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor"

View File

@ -0,0 +1,3 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
SRC_URI += " ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'file://selinux.cfg', '', d)}"

View File

@ -0,0 +1,881 @@
From: Gabriel Valcazar <gabriel.valcazar@digi.com>
Date: Fri, 20 Aug 2021 11:59:27 +0200
Subject: [PATCH 1/2] Apply rules for DEY prebuilt images
These rules were obtained by putting the system's SELinux in permissive mode,
extracting all of the AVC denials, and then running them through audit2allow.
This allows to use most of the features that are expected to work out of the
box in DEY.
Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
---
policy/modules/admin/alsa.te | 10 +++++
policy/modules/admin/dmesg.te | 7 ++++
policy/modules/admin/netutils.te | 7 ++++
policy/modules/apps/pulseaudio.if | 9 +++++
policy/modules/apps/pulseaudio.te | 15 +++++++
policy/modules/kernel/corecommands.if | 8 ++++
policy/modules/kernel/devices.if | 48 +++++++++++++++++++++++
policy/modules/roles/sysadm.if | 24 ++++++++++++
policy/modules/roles/sysadm.te | 47 ++++++++++++++++++++++
policy/modules/services/acpi.if | 8 ++++
policy/modules/services/acpi.te | 20 ++++++++++
policy/modules/services/apache.if | 8 ++++
policy/modules/services/bluetooth.if | 10 +++++
policy/modules/services/bluetooth.te | 10 +++++
policy/modules/services/consolekit.te | 7 ++++
policy/modules/services/dbus.if | 8 ++++
policy/modules/services/dbus.te | 7 ++++
policy/modules/services/modemmanager.te | 10 +++++
policy/modules/services/networkmanager.if | 8 ++++
policy/modules/services/networkmanager.te | 23 +++++++++++
policy/modules/system/init.te | 7 ++++
policy/modules/system/libraries.if | 8 ++++
policy/modules/system/locallogin.te | 9 +++++
policy/modules/system/logging.if | 8 ++++
policy/modules/system/logging.te | 11 ++++++
policy/modules/system/modutils.te | 8 ++++
policy/modules/system/mount.te | 7 ++++
policy/modules/system/selinuxutil.te | 8 ++++
policy/modules/system/sysnetwork.te | 8 ++++
policy/modules/system/systemd.if | 24 ++++++++++++
policy/modules/system/systemd.te | 22 +++++++++++
policy/modules/system/udev.if | 8 ++++
policy/modules/system/udev.te | 7 ++++
policy/modules/system/userdomain.if | 8 ++++
policy/modules/system/userdomain.te | 7 ++++
policy/modules/system/xdg.if | 16 ++++++++
36 files changed, 460 insertions(+)
diff --git a/policy/modules/admin/alsa.te b/policy/modules/admin/alsa.te
index 09d590add..2762fc664 100644
--- a/policy/modules/admin/alsa.te
+++ b/policy/modules/admin/alsa.te
@@ -111,3 +111,13 @@ optional_policy(`
hal_use_fds(alsa_t)
hal_write_log(alsa_t)
')
+
+########################################
+#
+# DEY custom rules
+#
+
+allow alsa_t var_lock_t:file { getattr lock open read write };
+
+allow alsa_t alsa_var_lib_t:lnk_file read;
+xdg_config_dirs_search(alsa_t)
diff --git a/policy/modules/admin/dmesg.te b/policy/modules/admin/dmesg.te
index 228baecd8..ccec67c80 100644
--- a/policy/modules/admin/dmesg.te
+++ b/policy/modules/admin/dmesg.te
@@ -60,3 +60,10 @@ optional_policy(`
optional_policy(`
udev_read_db(dmesg_t)
')
+
+########################################
+#
+# DEY custom rules
+#
+
+corecmd_map_exec_bin_files(dmesg_t)
diff --git a/policy/modules/admin/netutils.te b/policy/modules/admin/netutils.te
index 5cdfe2196..31e9d970c 100644
--- a/policy/modules/admin/netutils.te
+++ b/policy/modules/admin/netutils.te
@@ -212,3 +212,10 @@ userdom_use_inherited_user_terminals(traceroute_t)
# nmap searches .
userdom_dontaudit_search_user_home_dirs(traceroute_t)
userdom_dontaudit_search_user_home_content(traceroute_t)
+
+########################################
+#
+# DEY custom rules
+#
+
+allow ping_t bin_t:file { execute map read };
diff --git a/policy/modules/apps/pulseaudio.if b/policy/modules/apps/pulseaudio.if
index 1b9c6ccde..aeac19008 100644
--- a/policy/modules/apps/pulseaudio.if
+++ b/policy/modules/apps/pulseaudio.if
@@ -147,6 +147,15 @@ interface(`pulseaudio_signull',`
allow $1 pulseaudio_t:process signull;
')
+interface(`pulseaudio_connectto',`
+ gen_require(`
+ type pulseaudio_t;
+ ')
+
+ allow $1 pulseaudio_t:unix_stream_socket connectto;
+ allow $1 pulseaudio_t:fd use;
+')
+
########################################
## <summary>
## Use file descriptors for
diff --git a/policy/modules/apps/pulseaudio.te b/policy/modules/apps/pulseaudio.te
index 3a50fc5b2..ce24736f3 100644
--- a/policy/modules/apps/pulseaudio.te
+++ b/policy/modules/apps/pulseaudio.te
@@ -311,3 +311,18 @@ optional_policy(`
optional_policy(`
unconfined_signull(pulseaudio_client)
')
+
+########################################
+#
+# DEY custom rules
+#
+
+allow pulseaudio_t self:capability net_admin;
+systemd_watch_logind_sessions_files(pulseaudio_t)
+allow pulseaudio_t user_runtime_root_t:dir { add_name create read remove_name write };
+allow pulseaudio_t user_runtime_root_t:file { create getattr lock open read unlink write };
+allow pulseaudio_t user_runtime_root_t:sock_file { create setattr };
+allow pulseaudio_t user_home_dir_t:dir create;
+dbus_write_sock_file(pulseaudio_t)
+sysadm_use_fds(pulseaudio_t)
+sysadm_connectto_socket(pulseaudio_t)
diff --git a/policy/modules/kernel/corecommands.if b/policy/modules/kernel/corecommands.if
index c605ca5f7..e7b41c32c 100644
--- a/policy/modules/kernel/corecommands.if
+++ b/policy/modules/kernel/corecommands.if
@@ -199,6 +199,14 @@ interface(`corecmd_check_exec_bin_files',`
allow $1 bin_t:file { execute getattr };
')
+interface(`corecmd_map_exec_bin_files',`
+ gen_require(`
+ type bin_t;
+ ')
+
+ allow $1 bin_t:file { execute map read };
+')
+
########################################
## <summary>
## Read files in bin directories.
diff --git a/policy/modules/kernel/devices.if b/policy/modules/kernel/devices.if
index 406b29796..e4ad0d3b8 100644
--- a/policy/modules/kernel/devices.if
+++ b/policy/modules/kernel/devices.if
@@ -2114,6 +2114,14 @@ interface(`dev_getattr_input_dev',`
allow $1 event_device_t:chr_file getattr;
')
+interface(`dev_read_input_dev',`
+ gen_require(`
+ type event_device_t;
+ ')
+
+ allow $1 event_device_t:chr_file read;
+')
+
########################################
## <summary>
## Set the attributes of the event devices.
@@ -2260,6 +2268,38 @@ interface(`dev_dontaudit_setattr_framebuffer_dev',`
dontaudit $1 framebuf_device_t:chr_file setattr;
')
+interface(`dev_read_write_framebuffer_dev',`
+ gen_require(`
+ type framebuf_device_t;
+ ')
+
+ allow $1 framebuf_device_t:chr_file { read write };
+')
+
+interface(`dev_use_gpiochip',`
+ gen_require(`
+ type gpiochip_device_t;
+ ')
+
+ allow $1 gpiochip_device_t:chr_file { ioctl open read write };
+')
+
+interface(`dev_use_watchdog',`
+ gen_require(`
+ type watchdog_device_t;
+ ')
+
+ allow $1 watchdog_device_t:chr_file { ioctl open read write };
+')
+
+interface(`dev_use_wireless',`
+ gen_require(`
+ type wireless_device_t;
+ ')
+
+ allow $1 wireless_device_t:chr_file { ioctl open read write };
+')
+
########################################
## <summary>
## Read the framebuffer.
@@ -5064,6 +5104,14 @@ interface(`dev_dontaudit_getattr_video_dev',`
dontaudit $1 v4l_device_t:chr_file getattr;
')
+interface(`dev_handle_video_dev',`
+ gen_require(`
+ type v4l_device_t;
+ ')
+
+ allow $1 v4l_device_t:chr_file { ioctl map open read write };
+')
+
########################################
## <summary>
## Set the attributes of video4linux device nodes.
diff --git a/policy/modules/roles/sysadm.if b/policy/modules/roles/sysadm.if
index 5c2871842..49416d26e 100644
--- a/policy/modules/roles/sysadm.if
+++ b/policy/modules/roles/sysadm.if
@@ -211,6 +211,14 @@ interface(`sysadm_sigchld',`
allow $1 sysadm_t:process sigchld;
')
+interface(`sysadm_transition',`
+ gen_require(`
+ type sysadm_t;
+ ')
+
+ allow $1 sysadm_t:process transition;
+')
+
########################################
## <summary>
## Inherit and use sysadm file descriptors
@@ -229,6 +237,22 @@ interface(`sysadm_use_fds',`
allow $1 sysadm_t:fd use;
')
+interface(`sysadm_connectto_socket',`
+ gen_require(`
+ type sysadm_t;
+ ')
+
+ allow $1 sysadm_t:unix_stream_socket connectto;
+')
+
+interface(`sysadm_sendto_unix_dgram_socket',`
+ gen_require(`
+ type sysadm_t;
+ ')
+
+ allow $1 sysadm_t:unix_dgram_socket sendto;
+')
+
########################################
## <summary>
## Read and write sysadm user unnamed pipes.
diff --git a/policy/modules/roles/sysadm.te b/policy/modules/roles/sysadm.te
index 310a4fad2..4a3dc7a58 100644
--- a/policy/modules/roles/sysadm.te
+++ b/policy/modules/roles/sysadm.te
@@ -1375,3 +1375,50 @@ ifndef(`distro_redhat',`
')
')
+########################################
+#
+# DEY custom rules
+#
+
+allow sysadm_t init_exec_t:file entrypoint;
+allow sysadm_t init_t:unix_stream_socket { ioctl read write };
+allow sysadm_t self:capability audit_write;
+allow sysadm_t self:system reload;
+allow sysadm_t user_runtime_root_t:blk_file create;
+allow sysadm_t user_runtime_root_t:chr_file create;
+allow sysadm_t usr_t:file execute;
+
+allow sysadm_t device_t:chr_file { create ioctl open read write };
+dev_read_write_framebuffer_dev(sysadm_t)
+allow sysadm_t initrc_t:unix_stream_socket connectto;
+pulseaudio_connectto(sysadm_t)
+
+#!!!! This avc can be allowed using the boolean 'allow_execmem'
+allow sysadm_t self:process execmem;
+allow sysadm_t usr_t:file execute_no_trans;
+
+allow sysadm_t user_tmpfs_t:file { execmod execute };
+
+dev_use_gpiochip(sysadm_t)
+allow sysadm_t kernel_t:system module_request;
+allow sysadm_t self:can_socket { bind create getopt read setopt write };
+dev_use_watchdog(sysadm_t)
+
+networkmanager_sendto_unix_dgram_socket(sysadm_t)
+allow sysadm_t initrc_t:fd use;
+xdg_dir_watch(sysadm_t)
+
+allow sysadm_t device_t:chr_file map;
+allow sysadm_t device_t:dir watch;
+allow sysadm_t framebuf_device_t:chr_file { ioctl open };
+apache_execute_runtime_files(sysadm_t)
+dev_handle_video_dev(sysadm_t)
+
+allow sysadm_t self:bluetooth_socket create;
+allow sysadm_t self:process execstack;
+
+allow sysadm_t self:bluetooth_socket ioctl;
+
+dev_manage_dri_dev(sysadm_t)
+allow sysadm_t self:netlink_route_socket nlmsg_write;
+allow sysadm_t semanage_t:process { noatsecure rlimitinh siginh };
diff --git a/policy/modules/services/acpi.if b/policy/modules/services/acpi.if
index e6805e1d3..849e3ea15 100644
--- a/policy/modules/services/acpi.if
+++ b/policy/modules/services/acpi.if
@@ -119,6 +119,14 @@ interface(`acpi_append_log',`
allow $1 acpid_log_t:file append_file_perms;
')
+interface(`acpi_write_lock',`
+ gen_require(`
+ type acpid_lock_t;
+ ')
+
+ allow $1 acpid_lock_t:file write;
+')
+
########################################
## <summary>
## Connect to apmd over an unix
diff --git a/policy/modules/services/acpi.te b/policy/modules/services/acpi.te
index 26d16a369..c54302289 100644
--- a/policy/modules/services/acpi.te
+++ b/policy/modules/services/acpi.te
@@ -235,3 +235,23 @@ optional_policy(`
optional_policy(`
xserver_domtrans(acpid_t)
')
+
+########################################
+#
+# DEY custom rules
+#
+
+bluetooth_manage_config(acpid_t)
+kernel_search_debugfs(acpid_t)
+init_read_utmp(acpid_t)
+allow acpid_t self:bluetooth_socket { bind create ioctl write };
+allow acpid_t self:capability { net_admin net_raw };
+allow acpid_t self:process { getsched setpgid };
+allow acpid_t var_log_t:file { open write };
+
+dev_use_gpiochip(acpid_t)
+allow acpid_t self:bluetooth_socket listen;
+
+#!!!! This avc can be allowed using the boolean 'allow_ypbind'
+allow acpid_t self:capability net_bind_service;
+dev_use_wireless(acpid_t)
diff --git a/policy/modules/services/apache.if b/policy/modules/services/apache.if
index 71696f051..366f5fdeb 100644
--- a/policy/modules/services/apache.if
+++ b/policy/modules/services/apache.if
@@ -1319,6 +1319,14 @@ interface(`apache_cgi_domain',`
allow httpd_t $1:process signal;
')
+interface(`apache_execute_runtime_files',`
+ gen_require(`
+ type httpd_runtime_t;
+ ')
+
+ allow $1 httpd_runtime_t:file execute;
+')
+
########################################
## <summary>
## All of the rules required to
diff --git a/policy/modules/services/bluetooth.if b/policy/modules/services/bluetooth.if
index e35e86312..1580a772c 100644
--- a/policy/modules/services/bluetooth.if
+++ b/policy/modules/services/bluetooth.if
@@ -107,6 +107,16 @@ interface(`bluetooth_read_config',`
allow $1 bluetooth_conf_t:file read_file_perms;
')
+interface(`bluetooth_manage_config',`
+ gen_require(`
+ type bluetooth_conf_t, bluetooth_t;
+ ')
+
+ allow $1 bluetooth_conf_t:dir search;
+ allow $1 bluetooth_conf_t:file { open read };
+ allow $1 bluetooth_t:process signal;
+')
+
########################################
## <summary>
## Send and receive messages from
diff --git a/policy/modules/services/bluetooth.te b/policy/modules/services/bluetooth.te
index 63e50aeda..ec822154f 100644
--- a/policy/modules/services/bluetooth.te
+++ b/policy/modules/services/bluetooth.te
@@ -223,3 +223,13 @@ optional_policy(`
optional_policy(`
xserver_user_x_domain_template(bluetooth_helper, bluetooth_helper_t, bluetooth_helper_tmpfs_t)
')
+
+########################################
+#
+# DEY custom rules
+#
+
+logging_allow_write_generic_logs(bluetooth_t)
+
+allow bluetooth_t self:alg_socket { bind create };
+allow bluetooth_t syslogd_runtime_t:sock_file write;
diff --git a/policy/modules/services/consolekit.te b/policy/modules/services/consolekit.te
index 105bd45c7..292fd5074 100644
--- a/policy/modules/services/consolekit.te
+++ b/policy/modules/services/consolekit.te
@@ -172,3 +172,10 @@ optional_policy(`
optional_policy(`
unconfined_stream_connect(consolekit_t)
')
+
+########################################
+#
+# DEY custom rules
+#
+
+allow consolekit_t var_log_t:dir create;
diff --git a/policy/modules/services/dbus.if b/policy/modules/services/dbus.if
index 146262d88..f59642950 100644
--- a/policy/modules/services/dbus.if
+++ b/policy/modules/services/dbus.if
@@ -165,6 +165,14 @@ interface(`dbus_connect_all_session_bus',`
allow $1 session_bus_type:dbus acquire_svc;
')
+interface(`dbus_write_sock_file',`
+ gen_require(`
+ type session_dbusd_runtime_t;
+ ')
+
+ allow $1 session_dbusd_runtime_t:sock_file write;
+')
+
#######################################
## <summary>
## Acquire service on specified
diff --git a/policy/modules/services/dbus.te b/policy/modules/services/dbus.te
index 8ae5c8d93..bcf8b9677 100644
--- a/policy/modules/services/dbus.te
+++ b/policy/modules/services/dbus.te
@@ -315,3 +315,10 @@ optional_policy(`
allow dbusd_unconfined { dbusd_session_bus_client dbusd_system_bus_client }:dbus send_msg;
allow dbusd_unconfined { system_dbusd_t session_bus_type }:dbus all_dbus_perms;
+
+########################################
+#
+# DEY custom rules
+#
+
+allow system_dbusd_t syslogd_runtime_t:sock_file write;
diff --git a/policy/modules/services/modemmanager.te b/policy/modules/services/modemmanager.te
index 784221a03..1f6f698c2 100644
--- a/policy/modules/services/modemmanager.te
+++ b/policy/modules/services/modemmanager.te
@@ -58,3 +58,13 @@ optional_policy(`
udev_read_db(modemmanager_t)
udev_manage_runtime_files(modemmanager_t)
')
+
+########################################
+#
+# DEY custom rules
+#
+
+allow modemmanager_t self:process setsched;
+allow modemmanager_t syslogd_runtime_t:sock_file write;
+
+allow modemmanager_t self:capability sys_nice;
diff --git a/policy/modules/services/networkmanager.if b/policy/modules/services/networkmanager.if
index ef738db1e..7e203a0d2 100644
--- a/policy/modules/services/networkmanager.if
+++ b/policy/modules/services/networkmanager.if
@@ -171,6 +171,14 @@ interface(`networkmanager_signal',`
allow $1 NetworkManager_t:process signal;
')
+interface(`networkmanager_sendto_unix_dgram_socket',`
+ gen_require(`
+ type NetworkManager_t;
+ ')
+
+ allow $1 NetworkManager_t:unix_dgram_socket sendto;
+')
+
########################################
## <summary>
## Watch networkmanager etc dirs.
diff --git a/policy/modules/services/networkmanager.te b/policy/modules/services/networkmanager.te
index ce48909dd..e5f9e5da0 100644
--- a/policy/modules/services/networkmanager.te
+++ b/policy/modules/services/networkmanager.te
@@ -397,3 +397,26 @@ init_use_script_ptys(wpa_cli_t)
miscfiles_read_localization(wpa_cli_t)
term_dontaudit_use_console(wpa_cli_t)
+
+########################################
+#
+# DEY custom rules
+#
+
+allow NetworkManager_t device_t:chr_file { ioctl open read write };
+libs_watch(NetworkManager_t)
+fs_read_nsfs_files(NetworkManager_t)
+systemd_watch_logind_runtime_files(NetworkManager_t)
+systemd_watch_machines(NetworkManager_t)
+systemd_watch_logind_sessions_files(NetworkManager_t)
+
+sysadm_sendto_unix_dgram_socket(NetworkManager_t)
+
+allow NetworkManager_t etc_t:dir watch;
+
+acpi_use_fds(NetworkManager_t)
+consolekit_watch_runtime_dir(NetworkManager_t)
+
+acpi_write_lock(NetworkManager_t)
+acpi_append_log(NetworkManager_t)
+dev_read_input_dev(NetworkManager_t)
diff --git a/policy/modules/system/init.te b/policy/modules/system/init.te
index 6b6b723b8..f43acf976 100644
--- a/policy/modules/system/init.te
+++ b/policy/modules/system/init.te
@@ -1486,3 +1486,10 @@ optional_policy(`
userdom_dontaudit_rw_all_users_stream_sockets(systemprocess)
userdom_dontaudit_write_user_tmp_files(systemprocess)
')
+
+########################################
+#
+# DEY custom rules
+#
+
+sysadm_transition(init_t)
diff --git a/policy/modules/system/libraries.if b/policy/modules/system/libraries.if
index d1379fbe6..dc25cb26f 100644
--- a/policy/modules/system/libraries.if
+++ b/policy/modules/system/libraries.if
@@ -251,6 +251,14 @@ interface(`libs_manage_lib_dirs',`
allow $1 lib_t:dir manage_dir_perms;
')
+interface(`libs_watch',`
+ gen_require(`
+ type lib_t;
+ ')
+
+ allow $1 lib_t:dir watch;
+')
+
########################################
## <summary>
## dontaudit attempts to setattr on library files
diff --git a/policy/modules/system/locallogin.te b/policy/modules/system/locallogin.te
index 971ca40e5..da4689d33 100644
--- a/policy/modules/system/locallogin.te
+++ b/policy/modules/system/locallogin.te
@@ -289,3 +289,12 @@ optional_policy(`
optional_policy(`
nscd_use(sulogin_t)
')
+
+########################################
+#
+# DEY custom rules
+#
+
+allow local_login_t init_runtime_t:sock_file write;
+allow local_login_t initrc_t:unix_stream_socket connectto;
+allow local_login_t syslogd_runtime_t:sock_file write;
diff --git a/policy/modules/system/logging.if b/policy/modules/system/logging.if
index e3cbe4f1a..81a512e7b 100644
--- a/policy/modules/system/logging.if
+++ b/policy/modules/system/logging.if
@@ -1261,6 +1261,14 @@ interface(`logging_dontaudit_write_generic_logs',`
dontaudit $1 var_log_t:file write;
')
+interface(`logging_allow_write_generic_logs',`
+ gen_require(`
+ type var_log_t;
+ ')
+
+ allow $1 var_log_t:file { getattr write };
+')
+
########################################
## <summary>
## Read and write generic log files.
diff --git a/policy/modules/system/logging.te b/policy/modules/system/logging.te
index c22613c0b..b332aeb21 100644
--- a/policy/modules/system/logging.te
+++ b/policy/modules/system/logging.te
@@ -627,3 +627,14 @@ optional_policy(`
# log to the xconsole
xserver_rw_console(syslogd_t)
')
+
+########################################
+#
+# DEY custom rules
+#
+
+allow klogd_t bin_t:file { execute map read };
+
+allow syslogd_t bin_t:file { execute map read };
+udevadm_signull(syslogd_t)
+userdom_manage_user_runtime_root_dirs(syslogd_t)
diff --git a/policy/modules/system/modutils.te b/policy/modules/system/modutils.te
index 8fd009742..8c9056ead 100644
--- a/policy/modules/system/modutils.te
+++ b/policy/modules/system/modutils.te
@@ -195,3 +195,11 @@ optional_policy(`
xserver_getattr_log(kmod_t)
')
+########################################
+#
+# DEY custom rules
+#
+
+acpi_write_lock(kmod_t)
+acpi_append_log(kmod_t)
+dev_read_input_dev(kmod_t)
diff --git a/policy/modules/system/mount.te b/policy/modules/system/mount.te
index 5bb4fe631..ddd6ce396 100644
--- a/policy/modules/system/mount.te
+++ b/policy/modules/system/mount.te
@@ -230,3 +230,10 @@ optional_policy(`
files_etc_filetrans_etc_runtime(unconfined_mount_t, file)
unconfined_domain(unconfined_mount_t)
')
+
+########################################
+#
+# DEY custom rules
+#
+
+userdom_append_getattr(mount_t)
diff --git a/policy/modules/system/selinuxutil.te b/policy/modules/system/selinuxutil.te
index 09fef149b..3fd8b81c5 100644
--- a/policy/modules/system/selinuxutil.te
+++ b/policy/modules/system/selinuxutil.te
@@ -691,3 +691,11 @@ optional_policy(`
optional_policy(`
hotplug_use_fds(setfiles_t)
')
+
+########################################
+#
+# DEY custom rules
+#
+
+allow semanage_t load_policy_t:process { noatsecure rlimitinh siginh };
+allow semanage_t setfiles_t:process { noatsecure rlimitinh siginh };
diff --git a/policy/modules/system/sysnetwork.te b/policy/modules/system/sysnetwork.te
index a77738924..28d7f42bb 100644
--- a/policy/modules/system/sysnetwork.te
+++ b/policy/modules/system/sysnetwork.te
@@ -424,3 +424,11 @@ optional_policy(`
xen_append_log(ifconfig_t)
xen_dontaudit_rw_unix_stream_sockets(ifconfig_t)
')
+
+########################################
+#
+# DEY custom rules
+#
+
+allow ifconfig_t bin_t:file { execute map read };
+userdom_append_getattr(ifconfig_t);
diff --git a/policy/modules/system/systemd.if b/policy/modules/system/systemd.if
index b81300835..622682107 100644
--- a/policy/modules/system/systemd.if
+++ b/policy/modules/system/systemd.if
@@ -234,6 +234,14 @@ interface(`systemd_read_logind_runtime_files',`
allow $1 systemd_logind_runtime_t:file read_file_perms;
')
+interface(`systemd_watch_logind_runtime_files',`
+ gen_require(`
+ type systemd_logind_runtime_t;
+ ')
+
+ allow $1 systemd_logind_runtime_t:dir watch;
+')
+
######################################
## <summary>
## Manage systemd-logind runtime pipes.
@@ -313,6 +321,14 @@ interface(`systemd_read_logind_sessions_files',`
read_files_pattern($1, systemd_sessions_runtime_t, systemd_sessions_runtime_t)
')
+interface(`systemd_watch_logind_sessions_files',`
+ gen_require(`
+ type systemd_sessions_runtime_t;
+ ')
+
+ allow $1 systemd_sessions_runtime_t:dir watch;
+')
+
######################################
## <summary>
## Write inherited logind sessions pipes.
@@ -445,6 +461,14 @@ interface(`systemd_read_machines',`
allow $1 systemd_machined_runtime_t:file read_file_perms;
')
+interface(`systemd_watch_machines',`
+ gen_require(`
+ type systemd_machined_runtime_t;
+ ')
+
+ allow $1 systemd_machined_runtime_t:dir watch;
+')
+
########################################
## <summary>
## Send and receive messages from
diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te
index 7e573645b..4efc91a9b 100644
--- a/policy/modules/system/systemd.te
+++ b/policy/modules/system/systemd.te
@@ -1420,3 +1420,25 @@ userdom_mounton_user_runtime_dirs(systemd_user_runtime_dir_t)
userdom_relabelto_user_runtime_dirs(systemd_user_runtime_dir_t)
dbus_system_bus_client(systemd_user_runtime_dir_t)
+
+########################################
+#
+# DEY custom rules
+#
+
+allow systemd_backlight_t sysctl_kernel_t:dir search;
+allow systemd_backlight_t sysctl_kernel_t:file { getattr ioctl open read };
+allow systemd_backlight_t sysctl_t:dir search;
+
+allow systemd_generator_t cgroup_t:filesystem getattr;
+allow systemd_generator_t removable_device_t:blk_file { getattr ioctl open read };
+allow systemd_generator_t self:capability dac_override;
+allow systemd_generator_t self:process setfscreate;
+allow systemd_generator_t tmpfs_t:filesystem getattr;
+
+allow systemd_logind_t initrc_runtime_t:file watch;
+allow systemd_logind_t initrc_t:unix_stream_socket connectto;
+
+allow systemd_resolved_t system_dbusd_runtime_t:dir read;
+allow systemd_resolved_t systemd_resolved_runtime_t:lnk_file { create rename };
+allow systemd_resolved_t system_dbusd_runtime_t:sock_file read;
diff --git a/policy/modules/system/udev.if b/policy/modules/system/udev.if
index bdfd373da..468f83d2e 100644
--- a/policy/modules/system/udev.if
+++ b/policy/modules/system/udev.if
@@ -597,3 +597,11 @@ interface(`udevadm_exec',`
can_exec($1, udevadm_exec_t)
')
+
+interface(`udevadm_signull',`
+ gen_require(`
+ type udevadm_t;
+ ')
+
+ allow $1 udevadm_t:process signull;
+')
diff --git a/policy/modules/system/udev.te b/policy/modules/system/udev.te
index e483d63d3..2bd2fcdc7 100644
--- a/policy/modules/system/udev.te
+++ b/policy/modules/system/udev.te
@@ -427,3 +427,10 @@ seutil_read_file_contexts(udevadm_t)
init_dontaudit_use_fds(udevadm_t)
term_dontaudit_use_console(udevadm_t)
+
+########################################
+#
+# DEY custom rules
+#
+
+allow udev_t init_t:system start;
diff --git a/policy/modules/system/userdomain.if b/policy/modules/system/userdomain.if
index 5aab9ada7..eb1d5ffbf 100644
--- a/policy/modules/system/userdomain.if
+++ b/policy/modules/system/userdomain.if
@@ -4361,6 +4361,14 @@ interface(`userdom_write_user_tmp_files',`
allow $1 user_tmp_t:file write_file_perms;
')
+interface(`userdom_append_getattr',`
+ gen_require(`
+ type user_tmp_t;
+ ')
+
+ allow $1 user_tmp_t:file { append getattr };
+')
+
########################################
## <summary>
## Do not audit attempts to write users
diff --git a/policy/modules/system/userdomain.te b/policy/modules/system/userdomain.te
index ce69ca10b..5cb2f75bc 100644
--- a/policy/modules/system/userdomain.te
+++ b/policy/modules/system/userdomain.te
@@ -130,3 +130,10 @@ files_poly_member(user_runtime_t)
files_poly_parent(user_runtime_t)
ubac_constrained(user_runtime_t)
userdom_user_runtime_content(user_runtime_t)
+
+########################################
+#
+# DEY custom rules
+#
+
+dev_associate(user_tmpfs_t)
diff --git a/policy/modules/system/xdg.if b/policy/modules/system/xdg.if
index 11fc43069..801c79d40 100644
--- a/policy/modules/system/xdg.if
+++ b/policy/modules/system/xdg.if
@@ -215,6 +215,14 @@ interface(`xdg_create_cache_dirs',`
allow $1 xdg_cache_t:dir create_dir_perms;
')
+interface(`xdg_dir_watch',`
+ gen_require(`
+ type xdg_cache_t;
+ ')
+
+ allow $1 xdg_cache_t:dir watch;
+')
+
########################################
## <summary>
## Manage the xdg cache home files
@@ -465,6 +473,14 @@ interface(`xdg_create_config_dirs',`
allow $1 xdg_config_t:dir create_dir_perms;
')
+interface(`xdg_config_dirs_search',`
+ gen_require(`
+ type xdg_config_t;
+ ')
+
+ allow $1 xdg_config_t:dir search;
+')
+
########################################
## <summary>
## Manage the xdg config home files

View File

@ -0,0 +1,86 @@
From: Gabriel Valcazar <gabriel.valcazar@digi.com>
Date: Fri, 20 Aug 2021 15:06:12 +0200
Subject: [PATCH 2/2] Make udevadm_t executables run in the udev_t realm
This prevents SELinux from denying udev activity in DEY. This is a partial port
of the following commit:
https://www.spinics.net/lists/selinux-refpolicy/msg00805.html
Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
---
policy/modules/system/udev.fc | 4 ++--
policy/modules/system/udev.if | 4 ++--
policy/modules/system/udev.te | 6 +++---
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/policy/modules/system/udev.fc b/policy/modules/system/udev.fc
index ceb5b70b3..36d91f3a2 100644
--- a/policy/modules/system/udev.fc
+++ b/policy/modules/system/udev.fc
@@ -10,7 +10,7 @@
/etc/udev/scripts/.+ -- gen_context(system_u:object_r:udev_helper_exec_t,s0)
/usr/bin/udev -- gen_context(system_u:object_r:udev_exec_t,s0)
-/usr/bin/udevadm -- gen_context(system_u:object_r:udevadm_exec_t,s0)
+/usr/bin/udevadm -- gen_context(system_u:object_r:udev_exec_t,s0)
/usr/bin/udevd -- gen_context(system_u:object_r:udev_exec_t,s0)
/usr/bin/udevinfo -- gen_context(system_u:object_r:udev_exec_t,s0)
/usr/bin/udevsend -- gen_context(system_u:object_r:udev_exec_t,s0)
@@ -22,7 +22,7 @@ ifdef(`distro_debian',`
')
/usr/sbin/udev -- gen_context(system_u:object_r:udev_exec_t,s0)
-/usr/sbin/udevadm -- gen_context(system_u:object_r:udevadm_exec_t,s0)
+/usr/sbin/udevadm -- gen_context(system_u:object_r:udev_exec_t,s0)
/usr/sbin/udevd -- gen_context(system_u:object_r:udev_exec_t,s0)
/usr/sbin/udevsend -- gen_context(system_u:object_r:udev_exec_t,s0)
/usr/sbin/udevstart -- gen_context(system_u:object_r:udev_exec_t,s0)
diff --git a/policy/modules/system/udev.if b/policy/modules/system/udev.if
index 468f83d2e..1b37166d2 100644
--- a/policy/modules/system/udev.if
+++ b/policy/modules/system/udev.if
@@ -548,10 +548,10 @@ interface(`udev_manage_runtime_files',`
#
interface(`udevadm_domtrans',`
gen_require(`
- type udevadm_t, udevadm_exec_t;
+ type udevadm_t, udev_exec_t;
')
- domtrans_pattern($1, udevadm_exec_t, udevadm_t)
+ domtrans_pattern($1, udev_exec_t, udevadm_t)
')
########################################
diff --git a/policy/modules/system/udev.te b/policy/modules/system/udev.te
index 2bd2fcdc7..3bfde5bef 100644
--- a/policy/modules/system/udev.te
+++ b/policy/modules/system/udev.te
@@ -8,6 +8,7 @@ attribute_role udevadm_roles;
type udev_t;
type udev_exec_t;
+typealias udev_exec_t alias udevadm_exec_t;
type udev_helper_exec_t;
kernel_domtrans_to(udev_t, udev_exec_t)
domain_obj_id_change_exemption(udev_t)
@@ -17,9 +18,7 @@ init_daemon_domain(udev_t, udev_exec_t)
init_named_socket_activation(udev_t, udev_runtime_t)
type udevadm_t;
-type udevadm_exec_t;
-init_system_domain(udevadm_t, udevadm_exec_t)
-application_domain(udevadm_t, udevadm_exec_t)
+application_domain(udevadm_t, udev_exec_t)
role udevadm_roles types udevadm_t;
type udev_etc_t alias etc_udev_t;
@@ -86,6 +85,7 @@ manage_files_pattern(udev_t, udev_runtime_t, udev_runtime_t)
manage_lnk_files_pattern(udev_t, udev_runtime_t, udev_runtime_t)
manage_sock_files_pattern(udev_t, udev_runtime_t, udev_runtime_t)
files_runtime_filetrans(udev_t, udev_runtime_t, dir, "udev")
+allow udev_t udev_runtime_t:dir watch;
kernel_load_module(udev_t)
kernel_read_system_state(udev_t)

View File

@ -0,0 +1 @@
include refpolicy_dey.inc

View File

@ -0,0 +1 @@
include refpolicy_dey.inc

View File

@ -0,0 +1 @@
include refpolicy_dey.inc

View File

@ -0,0 +1 @@
include refpolicy_dey.inc

View File

@ -0,0 +1 @@
include refpolicy_dey.inc

View File

@ -0,0 +1,8 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
DEY_POLICY_PATCHES = " \
file://0001-Apply-rules-for-DEY-prebuilt-images.patch \
file://0002-Make-udevadm_t-executables-run-in-the-udev_t-realm.patch \
"
SRC_URI += " ${@oe.utils.conditional('DEY_SELINUX_POLICY', '1', '${DEY_POLICY_PATCHES}', '', d)}"

View File

@ -1,4 +1,4 @@
# Copyright (C) 2015-2019 Digi International.
# Copyright (C) 2015-2021 Digi International.
SRC_URI += " \
file://bluetooth-init \
@ -27,7 +27,12 @@ QCA65XX_COMMON_PATCHES = " \
"
SRC_URI_append_ccimx6ul = " ${QCA65XX_COMMON_PATCHES}"
SRC_URI_append_ccimx6qpsbc = " ${QCA65XX_COMMON_PATCHES}"
SRC_URI_append_ccimx6 = " ${QCA65XX_COMMON_PATCHES}"
SRC_URI_append_ccimx6sbc = " \
file://bluetooth-init_atheros \
file://main.conf_atheros \
"
inherit update-rc.d
@ -47,10 +52,34 @@ do_install_append() {
fi
}
do_install_append_ccimx6sbc() {
install -m 0755 ${WORKDIR}/bluetooth-init_atheros ${D}${sysconfdir}/bluetooth-init_atheros
install -m 0644 ${WORKDIR}/main.conf_atheros ${D}${sysconfdir}/bluetooth/
sed -i -e "s,##BT_DEVICE_NAME##,${BT_DEVICE_NAME},g" \
${D}${sysconfdir}/bluetooth/main.conf_atheros
}
pkg_postinst_ontarget_${PN}_ccimx6sbc() {
# Only execute the script on wireless ccimx6 platforms
if [ -e "/proc/device-tree/bluetooth/mac-address" ]; then
for id in $(find /sys/devices -name modalias -print0 | xargs -0 sort -u -z | grep sdio); do
if [[ "$id" == "sdio:c00v0271d0301" ]] ; then
mv /etc/bluetooth-init_atheros /etc/bluetooth-init
mv /etc/bluetooth/main.conf_atheros /etc/bluetooth/main.conf
break
elif [[ "$id" == "sdio:c00v0271d050A" ]] ; then
rm /etc/bluetooth-init_atheros
rm /etc/bluetooth/main.conf_atheros
break
fi
done
fi
}
PACKAGES =+ "${PN}-init"
FILES_${PN} += " ${sysconfdir}/bluetooth/main.conf"
FILES_${PN}-init = " ${sysconfdir}/bluetooth-init \
FILES_${PN} += " ${sysconfdir}/bluetooth/main.conf*"
FILES_${PN}-init = " ${sysconfdir}/bluetooth-init* \
${sysconfdir}/init.d/bluetooth-init \
${systemd_unitdir}/system/bluetooth-init.service \
"

View File

@ -1,4 +1,4 @@
# Copyright (C) 2015-2020 Digi International.
# Copyright (C) 2015-2021 Digi International.
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:${THISDIR}/${BP}:"
@ -20,10 +20,15 @@ QCA65XX_COMMON_PATCHES = " \
"
SRC_URI_append_ccimx6ul = " ${QCA65XX_COMMON_PATCHES}"
SRC_URI_append_ccimx6qpsbc = " ${QCA65XX_COMMON_PATCHES}"
SRC_URI_append_ccimx6 = " ${QCA65XX_COMMON_PATCHES}"
SRC_URI_append_ccimx8x = " ${QCA65XX_COMMON_PATCHES}"
SRC_URI_append_ccimx8m = " ${QCA65XX_COMMON_PATCHES}"
SRC_URI_append_ccimx6sbc = " \
file://bluetooth-init_atheros \
file://main.conf_atheros \
"
inherit update-rc.d
do_install_append() {
@ -47,14 +52,38 @@ do_install_append() {
sed -i -e '/#include/{s,src/shared/,,g}' ${D}${includedir}/bluetooth-internal/att.h
}
do_install_append_ccimx6sbc() {
install -m 0755 ${WORKDIR}/bluetooth-init_atheros ${D}${sysconfdir}/bluetooth-init_atheros
install -m 0644 ${WORKDIR}/main.conf_atheros ${D}${sysconfdir}/bluetooth/
sed -i -e "s,##BT_DEVICE_NAME##,${BT_DEVICE_NAME},g" \
${D}${sysconfdir}/bluetooth/main.conf_atheros
}
pkg_postinst_ontarget_${PN}_ccimx6sbc() {
# Only execute the script on wireless ccimx6 platforms
if [ -e "/proc/device-tree/bluetooth/mac-address" ]; then
for id in $(find /sys/devices -name modalias -print0 | xargs -0 sort -u -z | grep sdio); do
if [[ "$id" == "sdio:c00v0271d0301" ]] ; then
mv /etc/bluetooth-init_atheros /etc/bluetooth-init
mv /etc/bluetooth/main.conf_atheros /etc/bluetooth/main.conf
break
elif [[ "$id" == "sdio:c00v0271d050A" ]] ; then
rm /etc/bluetooth-init_atheros
rm /etc/bluetooth/main.conf_atheros
break
fi
done
fi
}
PACKAGES =+ "${PN}-init"
PACKAGECONFIG_append = " health-profiles \
mesh \
btpclient \
"
FILES_${PN} += " ${sysconfdir}/bluetooth/main.conf"
FILES_${PN}-init = " ${sysconfdir}/bluetooth-init \
FILES_${PN} += " ${sysconfdir}/bluetooth/main.conf*"
FILES_${PN}-init = " ${sysconfdir}/bluetooth-init* \
${sysconfdir}/init.d/bluetooth-init \
${systemd_unitdir}/system/bluetooth-init.service \
"

View File

@ -1,4 +1,4 @@
# Copyright (C) 2016-2020 Digi International.
# Copyright (C) 2016-2021 Digi International.
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
@ -23,6 +23,12 @@ do_install_append() {
# Install custom hostapd_IFACE.conf file
install -m 0644 ${WORKDIR}/hostapd_wlan1.conf ${D}${sysconfdir}
fi
# Read-only rootfs: actions that substitute postinst script
# - append the ${DIGI_FAMILY} string to SSID
if [ -n "${@bb.utils.contains('IMAGE_FEATURES', 'read-only-rootfs', '1', '', d)}" ]; then
sed -i -e "s,##MAC##,${DIGI_FAMILY},g" ${D}${sysconfdir}/hostapd_wlan?.conf
fi
}
pkg_postinst_ontarget_${PN}() {
@ -46,3 +52,5 @@ pkg_postinst_ontarget_${PN}() {
update-rc.d -f ${INITSCRIPT_NAME} remove
fi
}
inherit ${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "remove-pkg-postinst-ontarget", "", d)}

View File

@ -16,4 +16,3 @@ RDEPENDS_${PN} = "\
"
RDEPENDS_${PN}_append_ccimx6sbc = " ath-prop-tools"
RDEPENDS_${PN}_remove_ccimx6sbc = "hostapd"

View File

@ -1,4 +1,4 @@
# Copyright (C) 2013-2020 Digi International.
# Copyright (C) 2013-2021 Digi International.
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
@ -11,6 +11,8 @@ SRC_URI += " \
file://wpa_supplicant_p2p.conf \
"
SRC_URI_append_ccimx6sbc = " file://wpa_supplicant_p2p.conf_atheros"
do_install_append() {
install -m 600 ${WORKDIR}/wpa_supplicant_p2p.conf ${D}${sysconfdir}/wpa_supplicant_p2p.conf
sed -i -e "s,##WLAN_P2P_DEVICE_NAME##,${WLAN_P2P_DEVICE_NAME},g" \
@ -18,8 +20,19 @@ do_install_append() {
}
do_install_append_ccimx6sbc() {
# Customize supplicant file
cat <<EOF >>${D}${sysconfdir}/wpa_supplicant.conf
# Install atheros variant of the p2p .conf file
install -m 600 ${WORKDIR}/wpa_supplicant_p2p.conf_atheros ${D}${sysconfdir}/wpa_supplicant_p2p.conf_atheros
sed -i -e "s,##WLAN_P2P_DEVICE_NAME##,${WLAN_P2P_DEVICE_NAME},g" \
${D}${sysconfdir}/wpa_supplicant_p2p.conf_atheros
}
pkg_postinst_ontarget_${PN}_ccimx6sbc() {
# Only execute the script on wireless ccimx6 platforms
if [ -e "/proc/device-tree/wireless/mac-address" ]; then
for id in $(find /sys/devices -name modalias -print0 | xargs -0 sort -u -z | grep sdio); do
if [[ "$id" == "sdio:c00v0271d0301" ]] ; then
# Customize supplicant file
cat <<EOF >>/etc/wpa_supplicant.conf
# -- SoftAP mode
# ap_scan=2
@ -34,6 +47,14 @@ do_install_append_ccimx6sbc() {
# }
EOF
mv /etc/wpa_supplicant_p2p.conf_atheros /etc/wpa_supplicant_p2p.conf
break
elif [[ "$id" == "sdio:c00v0271d050A" ]] ; then
rm /etc/wpa_supplicant_p2p.conf_atheros
break
fi
done
fi
}
PACKAGE_ARCH = "${MACHINE_ARCH}"

View File

@ -54,4 +54,6 @@ pkg_postinst_ontarget_${PN}() {
fi
}
inherit ${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", "remove-pkg-postinst-ontarget", "", d)}
CONFFILES_${PN} += "${sysconfdir}/sysctl.conf"

View File

@ -3,7 +3,7 @@
#
# standby
#
# Copyright (C) 2009-2019 by Digi International Inc.
# Copyright (C) 2009-2021 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
@ -40,7 +40,8 @@ suspend_interfaces() {
for i in $(sed -ne 's,^\(wlan[0-9]\)=.*,\1,g;T;p' /var/run/ifstate | sort -r); do
ifdown "${i}" && RESUME_IFACES="${RESUME_IFACES:+${RESUME_IFACES} }${i}"
done
grep -qs '^ath6kl_sdio' /proc/modules && rmmod ath6kl_sdio ath6kl_core
[ -e /sys/module/ath6kl_sdio ] && rmmod ath6kl_sdio ath6kl_core && wlan_device_id="301"
[ -e /sys/module/wlan ] && rmmod wlan && wlan_device_id="50A"
fi
# Suspend bluetooth interface
@ -55,7 +56,7 @@ resume_interfaces() {
# Resume wireless interfaces
if [ -d "/proc/device-tree/wireless" ]; then
# Trigger wireless module loading event, and wait until the interface exists
udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d0301"
udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d0${wlan_device_id}"
timeout 5 sh -c "while [ ! -d /sys/class/net/wlan0 ]; do sleep .2; done" 2>/dev/null
# Bring up the interfaces that were bring down on suspend

View File

@ -3,7 +3,7 @@
#
# standby-actions
#
# Copyright (C) 2019 by Digi International Inc.
# Copyright (C) 2019-2021 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
@ -27,7 +27,8 @@ if [ "${1}" == "pre" ]; then
done
echo ${RESUME_IFACES} > /tmp/suspend_wlan_ifaces
grep -qs '^ath6kl_sdio' /proc/modules && rmmod ath6kl_sdio ath6kl_core
[ -e /sys/module/ath6kl_sdio ] && rmmod ath6kl_sdio ath6kl_core && echo "301" > /tmp/suspend_wlan_device_id
[ -e /sys/module/wlan ] && rmmod wlan && echo "50A" > /tmp/suspend_wlan_device_id
fi
# Suspend bluetooth interface
@ -40,7 +41,8 @@ elif [ "${1}" == "post" ]; then
# Resume wireless interfaces
if [ -d "/proc/device-tree/wireless" ]; then
# Trigger wireless module loading event, and wait until the interface exists
udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d0301"
udevadm trigger --action=add --attr-match="modalias=sdio:c00v0271d0$(cat /tmp/suspend_wlan_device_id)"
rm -rf /tmp/suspend_wlan_driver
timeout 5 sh -c "while [ ! -d /sys/class/net/wlan0 ]; do sleep .2; done" 2>/dev/null
# Bring up the interfaces that were brought down on suspend

View File

@ -0,0 +1,50 @@
SUMMARY = "Cross locale generation tool for glibc"
HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
SECTION = "libs"
LICENSE = "LGPL-2.1"
LIC_FILES_CHKSUM = "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \
file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
require glibc-version.inc
# Tell autotools that we're working in the localedef directory
#
AUTOTOOLS_SCRIPT_PATH = "${S}/localedef"
inherit autotools
inherit native
FILESEXTRAPATHS =. "${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/glibc:"
SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
git://github.com/kraj/localedef;branch=master;name=localedef;destsuffix=git/localedef \
\
file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \
file://0002-localedef-fix-ups-hardlink-to-make-it-compile.patch \
\
file://0016-timezone-re-written-tzselect-as-posix-sh.patch \
file://0017-Remove-bash-dependency-for-nscd-init-script.patch \
file://0018-eglibc-Cross-building-and-testing-instructions.patch \
file://0019-eglibc-Help-bootstrap-cross-toolchain.patch \
file://0020-eglibc-Resolve-__fpscr_values-on-SH4.patch \
file://0021-eglibc-Forward-port-cross-locale-generation-support.patch \
file://0022-Define-DUMMY_LOCALE_T-if-not-defined.patch \
file://0023-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
"
# Makes for a rather long rev (22 characters), but...
#
SRCREV_FORMAT = "glibc_localedef"
S = "${WORKDIR}/git"
EXTRA_OECONF = "--with-glibc=${S}"
CFLAGS += "-fgnu89-inline -std=gnu99 -DIS_IN\(x\)='0'"
do_install() {
install -d ${D}${bindir}
install -m 0755 ${B}/localedef ${D}${bindir}/cross-localedef
install -m 0755 ${B}/cross-localedef-hardlink ${D}${bindir}/cross-localedef-hardlink
}

View File

@ -0,0 +1,12 @@
require glibc-common.inc
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6 \
file://${COMMON_LICENSE_DIR}/LGPL-2.1-only;md5=1a6d268fd218675ffea8be556788b780"
deltask do_fetch
deltask do_unpack
deltask do_patch
do_configure[noexec] = "1"
do_compile[noexec] = "1"
do_install[depends] += "virtual/${MLPREFIX}libc:do_stash_locale"

View File

@ -0,0 +1,25 @@
SUMMARY = "GLIBC (GNU C Library)"
DESCRIPTION = "The GNU C Library is used as the system C library in most systems with the Linux kernel."
HOMEPAGE = "http://www.gnu.org/software/libc/libc.html"
SECTION = "libs"
LICENSE = "GPLv2 & LGPLv2.1"
LIC_FILES_CHKSUM ?= "file://LICENSES;md5=1541fd8f5e8f1579512bf05f533371ba \
file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \
file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c"
CVE_PRODUCT = "glibc"
INHIBIT_DEFAULT_DEPS = "1"
ARM_INSTRUCTION_SET_armv4 = "arm"
ARM_INSTRUCTION_SET_armv5 = "arm"
ARM_INSTRUCTION_SET_armv6 = "arm"
#
# We will skip parsing glibc when target system C library selection is not glibc
# this helps in easing out parsing for non-glibc system libraries
#
COMPATIBLE_HOST_libc-musl_class-target = "null"
PV = "2.33"

View File

@ -0,0 +1,20 @@
inherit linuxloader
GLIBC_GETLOADER = "${@get_linuxloader(d)}"
def glibc_dl_info(d):
infos = {'ldconfig':set(), 'lddrewrite':set()}
loaders = all_multilib_tune_values(d, "GLIBC_GETLOADER").split()
for loader in loaders:
infos['ldconfig'].add('{"' + loader + '",' + "FLAG_ELF_LIBC6" + ' }')
infos['lddrewrite'].add(loader)
infos['ldconfig'] = ','.join(sorted(infos['ldconfig']))
infos['lddrewrite'] = ' '.join(sorted(infos['lddrewrite']))
return infos
EGLIBC_KNOWN_INTERPRETER_NAMES = "${@glibc_dl_info(d)['ldconfig']}"
RTLDLIST = "${@glibc_dl_info(d)['lddrewrite']}"
RTLDLIST_class-nativesdk = "${base_libdir}/${@bb.utils.contains('SDK_ARCH', 'x86_64', 'ld-linux-x86-64.so.2', 'ld-linux.so.2', d)}"
glibc_dl_info[vardepsexclude] = "OVERRIDES"

View File

@ -0,0 +1,103 @@
require glibc-collateral.inc
SUMMARY = "Locale data from glibc"
BPN = "glibc"
LOCALEBASEPN = "${MLPREFIX}glibc"
# glibc-collateral.inc inhibits all default deps, but do_package needs objcopy
# ERROR: objcopy failed with exit code 127 (cmd was 'i586-webos-linux-objcopy' --only-keep-debug 'glibc-locale/2.17-r0/package/usr/lib/gconv/IBM1166.so' 'glibc-locale/2.17-r0/package/usr/lib/gconv/.debug/IBM1166.so')
# ERROR: Function failed: split_and_strip_files
BINUTILSDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}binutils:do_populate_sysroot"
BINUTILSDEP_class-nativesdk = "virtual/${TARGET_PREFIX}binutils-crosssdk:do_populate_sysroot"
do_package[depends] += "${BINUTILSDEP}"
DEPENDS += "virtual/libc"
# Binary locales are generated at build time if ENABLE_BINARY_LOCALE_GENERATION
# is set. The idea is to avoid running localedef on the target (at first boot)
# to decrease initial boot time and avoid localedef being killed by the OOM
# killer which used to effectively break i18n on machines with < 128MB RAM.
# default to disabled
ENABLE_BINARY_LOCALE_GENERATION ?= "0"
ENABLE_BINARY_LOCALE_GENERATION_pn-nativesdk-glibc-locale = "1"
#enable locale generation on these arches
# BINARY_LOCALE_ARCHES is a space separated list of regular expressions
BINARY_LOCALE_ARCHES ?= "arc arm.* aarch64 i[3-6]86 x86_64 powerpc mips mips64 riscv32 riscv64"
# set "1" to use cross-localedef for locale generation
# set "0" for qemu emulation of native localedef for locale generation
LOCALE_GENERATION_WITH_CROSS-LOCALEDEF = "1"
PROVIDES = "virtual/libc-locale"
PACKAGES = "localedef ${PN}-dbg"
PACKAGES_DYNAMIC = "^locale-base-.* \
^glibc-gconv-.* ^glibc-charmap-.* ^glibc-localedata-.* ^glibc-binary-localedata-.* \
^${MLPREFIX}glibc-gconv$"
# Create a glibc-binaries package
ALLOW_EMPTY_${BPN}-binaries = "1"
PACKAGES += "${BPN}-binaries"
RRECOMMENDS_${BPN}-binaries = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-binary") != -1])}"
# Create a glibc-charmaps package
ALLOW_EMPTY_${BPN}-charmaps = "1"
PACKAGES += "${BPN}-charmaps"
RRECOMMENDS_${BPN}-charmaps = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-charmap") != -1])}"
# Create a glibc-gconvs package
ALLOW_EMPTY_${BPN}-gconvs = "1"
PACKAGES += "${BPN}-gconvs"
RRECOMMENDS_${BPN}-gconvs = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-gconv") != -1])}"
# Create a glibc-localedatas package
ALLOW_EMPTY_${BPN}-localedatas = "1"
PACKAGES += "${BPN}-localedatas"
RRECOMMENDS_${BPN}-localedatas = "${@" ".join([p for p in d.getVar('PACKAGES').split() if p.find("glibc-localedata") != -1])}"
DESCRIPTION_localedef = "glibc: compile locale definition files"
# glibc-gconv is dynamically added into PACKAGES, thus
# FILES_glibc-gconv will not be automatically extended in multilib.
# Explicitly add ${MLPREFIX} for FILES_glibc-gconv.
FILES_${MLPREFIX}glibc-gconv = "${libdir}/gconv/*"
FILES_localedef = "${bindir}/localedef"
LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
copy_locale_files() {
local dir=$1 mode=$2
[ -e "${LOCALETREESRC}$dir" ] || return 0
for d in . $(find "${LOCALETREESRC}$dir" -type d -printf '%P '); do
install -d ${D}$dir/$d
find "${LOCALETREESRC}$dir/$d" -maxdepth 1 -type f \
-exec install -m $mode -t "${D}$dir/$d" {} \;
done
}
do_install() {
copy_locale_files ${bindir} 0755
copy_locale_files ${localedir} 0644
if [ ${PACKAGE_NO_GCONV} -eq 0 ]; then
copy_locale_files ${libdir}/gconv 0755
copy_locale_files ${datadir}/i18n 0644
else
# Remove the libdir if it is empty when gconv is not copied
find ${D}${libdir} -type d -empty -delete
fi
copy_locale_files ${datadir}/locale 0644
install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
}
inherit libc-package
BBCLASSEXTEND = "nativesdk"
# Don't scan for CVEs as glibc will be scanned
CVE_PRODUCT = ""

View File

@ -0,0 +1 @@
require glibc-locale.inc

View File

@ -0,0 +1,16 @@
require glibc-collateral.inc
SUMMARY = "mtrace utility provided by glibc"
DESCRIPTION = "mtrace utility provided by glibc"
RDEPENDS_${PN} = "perl"
RPROVIDES_${PN} = "libc-mtrace"
SRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/scripts"
do_install() {
install -d -m 0755 ${D}${bindir}
install -m 0755 ${SRC}/mtrace ${D}${bindir}/
}
# Don't scan for CVEs as glibc will be scanned
CVE_PRODUCT = ""

View File

@ -0,0 +1 @@
require glibc-mtrace.inc

View File

@ -0,0 +1,286 @@
INHIBIT_SYSROOT_STRIP = "1"
PACKAGES = "${PN}-dbg catchsegv sln nscd ldconfig ldd tzcode glibc-thread-db ${PN}-pic libcidn libmemusage libnss-db libsegfault ${PN}-pcprofile libsotruss ${PN} ${PN}-utils glibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc"
# The ld.so in this glibc supports the GNU_HASH
RPROVIDES_${PN} = "eglibc rtld(GNU_HASH)"
RPROVIDES_${PN}-utils = "eglibc-utils"
RPROVIDES_${PN}-mtrace = "eglibc-mtrace libc-mtrace"
RPROVIDES_${PN}-pic = "eglibc-pic"
RPROVIDES_${PN}-dev = "eglibc-dev libc6-dev virtual-libc-dev"
RPROVIDES_${PN}-staticdev = "eglibc-staticdev"
RPROVIDES_${PN}-doc = "eglibc-doc"
RPROVIDES_glibc-extra-nss = "eglibc-extra-nss"
RPROVIDES_glibc-thread-db = "eglibc-thread-db"
RPROVIDES_${PN}-pcprofile = "eglibc-pcprofile"
RPROVIDES_${PN}-dbg = "eglibc-dbg"
libc_baselibs = "${base_libdir}/libc.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/libmvec-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so"
ARCH_DYNAMIC_LOADER = ""
# The aarch64 ABI says the dynamic linker -must- be
# /lib/ld-linux-aarch64{,_be}.so.1. With usrmerge, that may mean that
# we need to install it in /usr/lib.
ARCH_DYNAMIC_LOADER_aarch64 = "ld-linux-${TARGET_ARCH}.so.1"
libc_baselibs_append = " ${@oe.utils.conditional('ARCH_DYNAMIC_LOADER', '', '', '${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}', d)}"
INSANE_SKIP_${PN}_append_aarch64 = " libdir"
FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${sysconfdir}/ld.so.conf"
RRECOMMENDS_${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'ldconfig', '${MLPREFIX}ldconfig', '', d)}"
FILES_ldconfig = "${base_sbindir}/ldconfig"
FILES_ldd = "${bindir}/ldd"
FILES_libsegfault = "${base_libdir}/libSegFault*"
FILES_libcidn = "${base_libdir}/libcidn-*.so ${base_libdir}/libcidn.so.*"
FILES_libmemusage = "${base_libdir}/libmemusage.so"
FILES_libnss-db = "${base_libdir}/libnss_db.so.* ${base_libdir}/libnss_db-*.so ${localstatedir}/db/Makefile ${localstatedir}/db/makedbs.sh"
RDEPENDS_libnss-db = "${PN}-utils"
FILES_glibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*"
FILES_sln = "${base_sbindir}/sln"
FILES_${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o"
FILES_libsotruss = "${libdir}/audit/sotruss-lib.so"
FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}"
FILES_${PN}-dev += "${libdir}/*_nonshared.a ${base_libdir}/*_nonshared.a ${base_libdir}/*.o ${datadir}/aclocal"
RDEPENDS_${PN}-dev = "linux-libc-headers-dev"
FILES_${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a"
FILES_nscd = "${sbindir}/nscd* ${sysconfdir}/init.d/nscd ${systemd_unitdir}/system/nscd* ${sysconfdir}/tmpfiles.d/nscd.conf \
${sysconfdir}/nscd.conf ${sysconfdir}/default/volatiles/98_nscd ${localstatedir}/db/nscd"
FILES_${PN}-mtrace = "${bindir}/mtrace"
FILES_tzcode = "${bindir}/tzselect ${sbindir}/zic ${sbindir}/zdump"
FILES_${PN}-utils = "${bindir}/* ${sbindir}/*"
FILES_catchsegv = "${bindir}/catchsegv"
RDEPENDS_catchsegv = "libsegfault"
FILES_${PN}-pcprofile = "${base_libdir}/libpcprofile.so"
FILES_glibc-thread-db = "${base_libdir}/libthread_db.so.* ${base_libdir}/libthread_db-*.so"
RPROVIDES_${PN}-dev += "libc-dev"
RPROVIDES_${PN}-staticdev += "libc-staticdev"
SUMMARY_sln = "The static ln"
DESCRIPTION_sln = "Similar to the 'ln' utility, but statically linked. sln is useful to make symbolic links to dynamic libraries if the dynamic linking system, for some reason, is not functional."
SUMMARY_nscd = "Name service cache daemon"
DESCRIPTION_nscd = "nscd, name service cache daemon, caches name service lookups for the passwd, group and hosts information. It can damatically improvide performance with remote, such as NIS or NIS+, name services."
SUMMARY_glibc-extra-nss = "hesiod, NIS and NIS+ nss libraries"
DESCRIPTION_glibc-extra-nss = "glibc: nis, nisplus and hesiod search services."
SUMMARY_ldd = "print shared library dependencies"
DESCRIPTION_ldd = "${bindir}/ldd prints shared library dependencies for each program or shared library specified on the command line."
SUMMARY_${PN}-utils = "Miscellaneous utilities provided by glibc"
DESCRIPTION_${PN}-utils = "Miscellaneous utilities including getconf, iconv, locale, gencat, ..."
DESCRIPTION_libsotruss = "Library to support sotruss which traces calls through PLTs"
DESCRIPTION_tzcode = "tzcode, timezone zoneinfo utils -- zic, zdump, tzselect"
inherit multilib_header
do_install() {
oe_runmake install_root=${D} install
install -Dm 0644 ${WORKDIR}/etc/ld.so.conf ${D}/${sysconfdir}/ld.so.conf
install -d ${D}${localedir}
make -f ${WORKDIR}/generate-supported.mk IN="${S}/localedata/SUPPORTED" OUT="${WORKDIR}/SUPPORTED"
# get rid of some broken files...
for i in ${GLIBC_BROKEN_LOCALES}; do
sed -i "/$i/d" ${WORKDIR}/SUPPORTED
done
rm -f ${D}${sysconfdir}/rpc
rm -rf ${D}${datadir}/zoneinfo
rm -rf ${D}${libexecdir}/getconf
rm -f ${D}${sysconfdir}/localtime
# remove empty glibc dir
if [ -d ${D}${libexecdir} ]; then
rmdir --ignore-fail-on-non-empty ${D}${libexecdir}
fi
oe_multilib_header bits/syscall.h bits/long-double.h bits/floatn.h bits/endianness.h bits/struct_rwlock.h
if [ -f ${D}${bindir}/mtrace ]; then
sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' -e '2s,exec.*perl,exec ${USRBINPATH}/env perl,' ${D}${bindir}/mtrace
fi
# Info dir listing isn't interesting at this point so remove it if it exists.
if [ -e "${D}${infodir}/dir" ]; then
rm -f ${D}${infodir}/dir
fi
install -d ${D}${sysconfdir}/init.d
install -d ${D}${localstatedir}/db/nscd
install -m 0755 ${S}/nscd/nscd.init ${D}${sysconfdir}/init.d/nscd
install -m 0755 ${S}/nscd/nscd.conf ${D}${sysconfdir}/nscd.conf
install -m 0755 ${WORKDIR}/makedbs.sh ${D}${localstatedir}/db
sed -i "s%daemon%start-stop-daemon --start --exec%g" ${D}${sysconfdir}/init.d/nscd
sed -i "s|\(enable-cache\t\+netgroup\t\+\)yes|\1no|" ${D}${sysconfdir}/nscd.conf
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${S}/nscd/nscd.service ${D}${systemd_unitdir}/system/
# The dynamic loader will have been installed into
# ${base_libdir}. However, if that isn't going to end up being
# available in the ABI-mandated location, then a symlink must
# be created.
if [ -n "${ARCH_DYNAMIC_LOADER}" -a ! -e "${D}${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then
install -d ${D}${root_prefix}/lib
ln -s ${@oe.path.relative('${root_prefix}/lib', '${base_libdir}')}/${ARCH_DYNAMIC_LOADER} \
${D}${root_prefix}/lib/${ARCH_DYNAMIC_LOADER}
fi
}
def get_libc_fpu_setting(bb, d):
if d.getVar('TARGET_FPU') in [ 'soft', 'ppc-efd' ]:
return "--without-fp"
return ""
do_install_append_class-target() {
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
install -d ${D}${sysconfdir}/tmpfiles.d
echo "d /run/nscd 755 root root -" \
> ${D}${sysconfdir}/tmpfiles.d/nscd.conf
fi
if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
install -d ${D}${sysconfdir}/default/volatiles
echo "d root root 0755 /var/run/nscd none" \
> ${D}${sysconfdir}/default/volatiles/98_nscd
fi
}
do_install_append_aarch64 () {
do_install_armmultilib
}
do_install_append_arm () {
do_install_armmultilib
}
do_install_append_armeb () {
do_install_armmultilib
}
do_install_armmultilib () {
oe_multilib_header bits/endian.h bits/fcntl.h bits/fenv.h bits/fp-fast.h bits/hwcap.h bits/ipc.h bits/link.h
oe_multilib_header bits/local_lim.h bits/mman.h bits/msq.h bits/pthreadtypes.h bits/pthreadtypes-arch.h bits/sem.h bits/semaphore.h bits/setjmp.h
oe_multilib_header bits/shm.h bits/sigstack.h bits/stat.h bits/statfs.h bits/typesizes.h
oe_multilib_header bits/procfs-id.h bits/procfs.h bits/shmlba.h
oe_multilib_header bits/struct_stat.h
oe_multilib_header fpu_control.h gnu/lib-names.h gnu/stubs.h ieee754.h
oe_multilib_header sys/elf.h sys/procfs.h sys/ptrace.h sys/ucontext.h sys/user.h
}
LOCALESTASH = "${WORKDIR}/stashed-locale"
bashscripts = "mtrace sotruss xtrace"
do_stash_locale () {
dest=${LOCALESTASH}
install -d $dest${base_libdir} $dest${bindir} $dest${libdir} $dest${datadir}
# Hide away the locale data from the deployment
if [ -e ${D}${bindir}/localedef ]; then
cp -a ${D}${bindir}/localedef $dest${bindir}
fi
if [ -e ${D}${libdir}/gconv ]; then
cp -a ${D}${libdir}/gconv $dest${libdir}
fi
if [ -e ${D}${datadir}/i18n ]; then
cp -a ${D}${datadir}/i18n $dest${datadir}
fi
# Make a copy of all the libraries into the locale stash
cp -fpPR ${D}${libdir}/* $dest${libdir}
if [ "${base_libdir}" != "${libdir}" ]; then
cp -fpPR ${D}${base_libdir}/* $dest${base_libdir}
fi
if [ -e ${D}${exec_prefix}/lib ]; then
if [ ${exec_prefix}/lib != ${base_libdir} ] && [ ${exec_prefix}/lib != ${libdir} ]; then
cp -fpPR ${D}${exec_prefix}/lib $dest${exec_prefix}
fi
fi
cp -fpPR ${D}${datadir}/* $dest${datadir}
cp -fpPR ${WORKDIR}/SUPPORTED $dest
target=$dest/scripts
mkdir -p $target
for i in ${bashscripts}; do
if [ -f ${D}${bindir}/$i ]; then
cp ${D}${bindir}/$i $target/
fi
done
}
addtask do_stash_locale after do_install before do_populate_sysroot do_package
do_stash_locale[dirs] = "${B}"
do_stash_locale[cleandirs] = "${LOCALESTASH}"
SSTATETASKS += "do_stash_locale"
do_stash_locale[sstate-inputdirs] = "${LOCALESTASH}"
do_stash_locale[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
do_stash_locale[sstate-fixmedir] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
python do_stash_locale_setscene () {
sstate_setscene(d)
}
addtask do_stash_locale_setscene
PACKAGE_PREPROCESS_FUNCS += "stash_locale_package_cleanup"
SYSROOT_PREPROCESS_FUNCS += "stash_locale_sysroot_cleanup"
stash_locale_cleanup () {
cleanupdir=$1
# Remove all files which do_stash_locale() copies
for i in ${bashscripts}; do
rm -f $cleanupdir${bindir}/$i
done
rm -f $cleanupdir${bindir}/localedef
rm -rf $cleanupdir${datadir}/i18n
rm -rf $cleanupdir${libdir}/gconv
rm -rf $cleanupdir${localedir}
rm -rf $cleanupdir${datadir}/locale
rmdir --ignore-fail-on-non-empty $cleanupdir${datadir}
if [ "${libdir}" != "${exec_prefix}/lib" ] && [ "${root_prefix}/lib" != "${exec_prefix}/lib" ]; then
if [ -d "$cleanupdir${exec_prefix}/lib" ]; then
if [ -z "${ARCH_DYNAMIC_LOADER}" -o \
! -e "$cleanupdir${exec_prefix}/lib/${ARCH_DYNAMIC_LOADER}" ]; then
# error out if directory isn't empty
# this dir should only contain locale dir
# which has been deleted in the previous step
rmdir $cleanupdir${exec_prefix}/lib
fi
fi
fi
}
stash_locale_sysroot_cleanup() {
stash_locale_cleanup ${SYSROOT_DESTDIR}
}
stash_locale_package_cleanup() {
stash_locale_cleanup ${PKGD}
}
python populate_packages_prepend () {
if d.getVar('DEBIAN_NAMES'):
pkgs = d.getVar('PACKAGES').split()
bpn = d.getVar('BPN')
prefix = d.getVar('MLPREFIX') or ""
# Set the base package...
d.setVar('PKG_' + prefix + bpn, prefix + 'libc6')
libcprefix = prefix + bpn + '-'
for p in pkgs:
# And all the subpackages.
if p.startswith(libcprefix):
renamed = p.replace(bpn, 'libc6', 1)
d.setVar('PKG_' + p, renamed)
# For backward compatibility with old -dbg package
d.appendVar('RPROVIDES_' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg')
d.appendVar('RCONFLICTS_' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg')
d.appendVar('RREPLACES_' + libcprefix + 'dbg', ' ' + prefix + 'libc-dbg')
}
pkg_postinst_nscd () {
if [ -z "$D" ]; then
if command -v systemd-tmpfiles >/dev/null; then
systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/nscd.conf
elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
${sysconfdir}/init.d/populate-volatile.sh update
fi
fi
}
CONFFILES_nscd="${sysconfdir}/nscd.conf"
SYSTEMD_PACKAGES = "nscd"
SYSTEMD_SERVICE_nscd = "nscd.service"

View File

@ -0,0 +1,23 @@
require glibc-collateral.inc
SUMMARY = "utility scripts provided by glibc"
DESCRIPTION = "utility scripts provided by glibc"
RDEPENDS_${PN} = "bash glibc-mtrace"
SRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale/scripts"
bashscripts = "sotruss xtrace"
do_install() {
install -d -m 0755 ${D}${bindir}
for i in ${bashscripts}; do
install -m 0755 ${SRC}/$i ${D}${bindir}/
done
}
# sotruss script requires sotruss-lib.so (given by libsotruss package),
# to produce trace of the library calls.
RDEPENDS_${PN} += "libsotruss"
# Don't scan for CVEs as glibc will be scanned
CVE_PRODUCT = ""

View File

@ -0,0 +1 @@
require glibc-scripts.inc

View File

@ -0,0 +1,63 @@
require glibc_${PV}.bb
EXCLUDE_FROM_WORLD = "1"
# handle PN differences
FILESEXTRAPATHS_prepend := "${THISDIR}/glibc:"
# strip provides
PROVIDES = ""
# setup depends
INHIBIT_DEFAULT_DEPS = ""
python () {
libc = d.getVar("PREFERRED_PROVIDER_virtual/libc")
libclocale = d.getVar("PREFERRED_PROVIDER_virtual/libc-locale")
if libc != "glibc" or libclocale != "glibc-locale":
raise bb.parse.SkipRecipe("glibc-testsuite requires that virtual/libc is glibc")
}
DEPENDS += "glibc-locale libgcc gcc-runtime"
# remove the initial depends
DEPENDS_remove = "libgcc-initial"
inherit qemu
SRC_URI += "file://check-test-wrapper"
DEPENDS += "${@'qemu-native' if d.getVar('TOOLCHAIN_TEST_TARGET') == 'user' else ''}"
TOOLCHAIN_TEST_TARGET ??= "user"
TOOLCHAIN_TEST_HOST ??= "localhost"
TOOLCHAIN_TEST_HOST_USER ??= "root"
TOOLCHAIN_TEST_HOST_PORT ??= "2222"
do_check[dirs] += "${B}"
do_check[nostamp] = "1"
do_check () {
chmod 0755 ${WORKDIR}/check-test-wrapper
# clean out previous test results
oe_runmake tests-clean
# makefiles don't clean entirely (and also sometimes fails due to too many args)
find ${B} -type f -name "*.out" -delete
find ${B} -type f -name "*.test-result" -delete
find ${B}/catgets -name "*.cat" -delete
find ${B}/conform -name "symlist-*" -delete
[ ! -e ${B}/timezone/testdata ] || rm -rf ${B}/timezone/testdata
oe_runmake -i \
QEMU_SYSROOT="${RECIPE_SYSROOT}" \
QEMU_OPTIONS="${@qemu_target_binary(d)} ${QEMU_OPTIONS}" \
SSH_HOST="${TOOLCHAIN_TEST_HOST}" \
SSH_HOST_USER="${TOOLCHAIN_TEST_HOST_USER}" \
SSH_HOST_PORT="${TOOLCHAIN_TEST_HOST_PORT}" \
test-wrapper="${WORKDIR}/check-test-wrapper ${TOOLCHAIN_TEST_TARGET}" \
check
}
addtask do_check after do_compile
inherit nopackages
deltask do_stash_locale
deltask do_install

View File

@ -0,0 +1,8 @@
SRCBRANCH ?= "release/2.33/master"
PV = "2.33"
SRCREV_glibc ?= "9826b03b747b841f5fc6de2054bf1ef3f5c4bdf3"
SRCREV_localedef ?= "bd644c9e6f3e20c5504da1488448173c69c56c28"
GLIBC_GIT_URI ?= "git://sourceware.org/git/glibc.git"
UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+\.\d+(\.(?!90)\d+)*)"

View File

@ -0,0 +1,52 @@
require glibc-common.inc
require glibc-ld.inc
DEPENDS = "virtual/${TARGET_PREFIX}gcc libgcc-initial linux-libc-headers"
PROVIDES = "virtual/libc"
PROVIDES += "virtual/libintl virtual/libiconv"
inherit autotools texinfo systemd
LEAD_SONAME = "libc.so"
# msgfmt could come from gettext-native but we don't depend on that and
# disable for reproducibility
CACHED_CONFIGUREVARS += " \
ac_cv_path_BASH_SHELL=${base_bindir}/bash \
ac_cv_prog_MSGFMT= \
libc_cv_slibdir=${base_libdir} \
libc_cv_rootsbindir=${base_sbindir} \
libc_cv_localedir=${localedir} \
libc_cv_ssp_strong=no \
libc_cv_ssp_all=no \
libc_cv_ssp=no \
libc_cv_include_x86_isa_level=no \
"
# ifunc doesn't appear to work on mips, casuses libbfd assertion failures
CACHED_CONFIGUREVARS_append_mipsarch = " libc_cv_ld_gnu_indirect_function=no"
GLIBC_EXTRA_OECONF ?= ""
GLIBC_EXTRA_OECONF_class-nativesdk = ""
# glibc uses PARALLELMFLAGS variable to pass parallel build info so transfer
# PARALLEL_MAKE into PARALLELMFLAGS and empty out PARALLEL_MAKE
EGLIBCPARALLELISM := "PARALLELMFLAGS="${PARALLEL_MAKE}""
EXTRA_OEMAKE[vardepsexclude] += "EGLIBCPARALLELISM"
EXTRA_OEMAKE += "${EGLIBCPARALLELISM}"
PARALLEL_MAKE = ""
# glibc make-syscalls.sh has a number of issues with /bin/dash and
# it's output which make calls via the SHELL also has issues, so
# ensure make uses /bin/bash
EXTRA_OEMAKE += "SHELL=/bin/bash"
do_configure_prepend() {
sed -e "s#@BASH@#/bin/sh#" -i ${S}/elf/ldd.bash.in
}
# Enable backtrace from abort()
do_configure_append_arm () {
echo "CFLAGS-abort.c = -fasynchronous-unwind-tables" >> ${B}/configparms
echo "CFLAGS-raise.c = -fasynchronous-unwind-tables" >> ${B}/configparms
}

View File

@ -0,0 +1,49 @@
From c4ad832276f4dadfa40904109b26a521468f66bc Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Thu, 4 Feb 2021 15:00:20 +0100
Subject: [PATCH] nptl: Remove private futex optimization [BZ #27304]
It is effectively used, unexcept for pthread_cond_destroy, where we do
not want it; see bug 27304. The internal locks do not support a
process-shared mode.
This fixes commit dc6cfdc934db9997c33728082d63552b9eee4563 ("nptl:
Move pthread_cond_destroy implementation into libc").
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Upstream-Status: Backport [https://sourceware.org/bugzilla/show_bug.cgi?id=27304]
Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
---
sysdeps/nptl/lowlevellock-futex.h | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/sysdeps/nptl/lowlevellock-futex.h b/sysdeps/nptl/lowlevellock-futex.h
index ecb729da6b..ca96397a4a 100644
--- a/sysdeps/nptl/lowlevellock-futex.h
+++ b/sysdeps/nptl/lowlevellock-futex.h
@@ -50,20 +50,8 @@
#define LLL_SHARED FUTEX_PRIVATE_FLAG
#ifndef __ASSEMBLER__
-
-# if IS_IN (libc) || IS_IN (rtld)
-/* In libc.so or ld.so all futexes are private. */
-# define __lll_private_flag(fl, private) \
- ({ \
- /* Prevent warnings in callers of this macro. */ \
- int __lll_private_flag_priv __attribute__ ((unused)); \
- __lll_private_flag_priv = (private); \
- ((fl) | FUTEX_PRIVATE_FLAG); \
- })
-# else
-# define __lll_private_flag(fl, private) \
+# define __lll_private_flag(fl, private) \
(((fl) | FUTEX_PRIVATE_FLAG) ^ (private))
-# endif
# define lll_futex_syscall(nargs, futexp, op, ...) \
({ \
--
2.27.0

View File

@ -0,0 +1,238 @@
From 14d256e2db009f8bac9a265e8393d7ed25050df9 Mon Sep 17 00:00:00 2001
From: Jason Wessel <jason.wessel@windriver.com>
Date: Sat, 7 Dec 2019 10:01:37 -0800
Subject: [PATCH] localedef: fix-ups hardlink to make it compile
Upstream-Status: Pending
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
locale/programs/c.h | 2 +-
locale/programs/cross-localedef-hardlink.c | 79 +++++++++++-----------
2 files changed, 39 insertions(+), 42 deletions(-)
diff --git a/locale/programs/c.h b/locale/programs/c.h
index d0a402e90e..1804d31c73 100644
--- a/locale/programs/c.h
+++ b/locale/programs/c.h
@@ -240,7 +240,7 @@ errmsg(char doexit, int excode, char adderr, const char *fmt, ...)
/* Don't use inline function to avoid '#include "nls.h"' in c.h
*/
#define errtryhelp(eval) __extension__ ({ \
- fprintf(stderr, _("Try '%s --help' for more information.\n"), \
+ fprintf(stderr, ("Try '%s --help' for more information.\n"), \
program_invocation_short_name); \
exit(eval); \
})
diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c
index 63615896b0..726e6dd948 100644
--- a/locale/programs/cross-localedef-hardlink.c
+++ b/locale/programs/cross-localedef-hardlink.c
@@ -20,6 +20,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+
+#undef HAVE_PCRE
#include <sys/types.h>
#include <stdlib.h>
#include <getopt.h>
@@ -38,8 +40,8 @@
#include "c.h"
#include "xalloc.h"
-#include "nls.h"
-#include "closestream.h"
+//#include "nls.h"
+//#include "closestream.h"
#define NHASH (1<<17) /* Must be a power of 2! */
#define NBUF 64
@@ -124,33 +126,33 @@ static void print_summary(void)
if (ctl->verbose > 1 && ctl->nlinks)
fputc('\n', stdout);
- printf(_("Directories: %9lld\n"), ctl->ndirs);
- printf(_("Objects: %9lld\n"), ctl->nobjects);
- printf(_("Regular files: %9lld\n"), ctl->nregfiles);
- printf(_("Comparisons: %9lld\n"), ctl->ncomp);
+ printf(("Directories: %9lld\n"), ctl->ndirs);
+ printf(("Objects: %9lld\n"), ctl->nobjects);
+ printf(("Regular files: %9lld\n"), ctl->nregfiles);
+ printf(("Comparisons: %9lld\n"), ctl->ncomp);
printf( "%s%9lld\n", (ctl->no_link ?
- _("Would link: ") :
- _("Linked: ")), ctl->nlinks);
+ ("Would link: ") :
+ ("Linked: ")), ctl->nlinks);
printf( "%s %9lld\n", (ctl->no_link ?
- _("Would save: ") :
- _("Saved: ")), ctl->nsaved);
+ ("Would save: ") :
+ ("Saved: ")), ctl->nsaved);
}
static void __attribute__((__noreturn__)) usage(void)
{
fputs(USAGE_HEADER, stdout);
- printf(_(" %s [options] directory...\n"), program_invocation_short_name);
+ printf((" %s [options] directory...\n"), program_invocation_short_name);
fputs(USAGE_SEPARATOR, stdout);
- puts(_("Consolidate duplicate files using hardlinks."));
+ puts(("Consolidate duplicate files using hardlinks."));
fputs(USAGE_OPTIONS, stdout);
- puts(_(" -c, --content compare only contents, ignore permission, etc."));
- puts(_(" -n, --dry-run don't actually link anything"));
- puts(_(" -v, --verbose print summary after hardlinking"));
- puts(_(" -vv print every hardlinked file and summary"));
- puts(_(" -f, --force force hardlinking across filesystems"));
- puts(_(" -x, --exclude <regex> exclude files matching pattern"));
+ puts((" -c, --content compare only contents, ignore permission, etc."));
+ puts((" -n, --dry-run don't actually link anything"));
+ puts((" -v, --verbose print summary after hardlinking"));
+ puts((" -vv print every hardlinked file and summary"));
+ puts((" -f, --force force hardlinking across filesystems"));
+ puts((" -x, --exclude <regex> exclude files matching pattern"));
fputs(USAGE_SEPARATOR, stdout);
printf(USAGE_HELP_OPTIONS(16)); /* char offset to align option descriptions */
@@ -164,7 +166,7 @@ static inline size_t add2(size_t a, size_t b)
size_t sum = a + b;
if (sum < a)
- errx(EXIT_FAILURE, _("integer overflow"));
+ errx(EXIT_FAILURE, ("integer overflow"));
return sum;
}
@@ -193,7 +195,7 @@ static void process_path(struct hardlink_ctl *ctl, const char *name)
if (st.st_dev != ctl->dev && !ctl->force) {
if (ctl->dev)
errx(EXIT_FAILURE,
- _("%s is on different filesystem than the rest "
+ ("%s is on different filesystem than the rest "
"(use -f option to override)."), name);
ctl->dev = st.st_dev;
}
@@ -287,9 +289,9 @@ static void process_path(struct hardlink_ctl *ctl, const char *name)
(ssize_t) sizeof(ctl->iobuf1) : fsize;
if ((xsz = read(fd, ctl->iobuf1, rsize)) != rsize)
- warn(_("cannot read %s"), name);
+ warn(("cannot read %s"), name);
else if ((xsz = read(fd2, ctl->iobuf2, rsize)) != rsize)
- warn(_("cannot read %s"), fp2->name);
+ warn(("cannot read %s"), fp2->name);
if (xsz != rsize) {
close(fd);
@@ -303,13 +305,13 @@ static void process_path(struct hardlink_ctl *ctl, const char *name)
if (fsize > 0)
continue;
if (lstat(name, &st3)) {
- warn(_("cannot stat %s"), name);
+ warn(("cannot stat %s"), name);
close(fd);
return;
}
st3.st_atime = st.st_atime;
if (stcmp(&st, &st3, 0)) {
- warnx(_("file %s changed underneath us"), name);
+ warnx(("file %s changed underneath us"), name);
close(fd);
return;
}
@@ -329,18 +331,18 @@ static void process_path(struct hardlink_ctl *ctl, const char *name)
suffixlen + 1);
/* First create a temporary link to n1 under a new name */
if (link(n1, nam2.buf)) {
- warn(_("failed to hardlink %s to %s (create temporary link as %s failed)"),
+ warn(("failed to hardlink %s to %s (create temporary link as %s failed)"),
n1, n2, nam2.buf);
free(nam2.buf);
continue;
}
/* Then rename into place over the existing n2 */
if (rename(nam2.buf, n2)) {
- warn(_("failed to hardlink %s to %s (rename temporary link to %s failed)"),
+ warn(("failed to hardlink %s to %s (rename temporary link to %s failed)"),
n1, n2, n2);
/* Something went wrong, try to remove the now redundant temporary link */
if (unlink(nam2.buf))
- warn(_("failed to remove temporary link %s"), nam2.buf);
+ warn(("failed to remove temporary link %s"), nam2.buf);
free(nam2.buf);
continue;
}
@@ -351,16 +353,16 @@ static void process_path(struct hardlink_ctl *ctl, const char *name)
/* We actually did not save anything this time, since the link second argument
had some other links as well. */
if (ctl->verbose > 1)
- printf(_(" %s %s to %s\n"),
- (ctl->no_link ? _("Would link") : _("Linked")),
+ printf((" %s %s to %s\n"),
+ (ctl->no_link ? ("Would link") : ("Linked")),
n1, n2);
} else {
ctl->nsaved += ((st.st_size + 4095) / 4096) * 4096;
if (ctl->verbose > 1)
- printf(_(" %s %s to %s, %s %jd\n"),
- (ctl->no_link ? _("Would link") : _("Linked")),
+ printf((" %s %s to %s, %s %jd\n"),
+ (ctl->no_link ? ("Would link") : ("Linked")),
n1, n2,
- (ctl->no_link ? _("would save") : _("saved")),
+ (ctl->no_link ? ("would save") : ("saved")),
(intmax_t)st.st_size);
}
close(fd);
@@ -410,11 +412,6 @@ int main(int argc, char **argv)
{ NULL, 0, NULL, 0 },
};
- setlocale(LC_ALL, "");
- bindtextdomain(PACKAGE, LOCALEDIR);
- textdomain(PACKAGE);
- close_stdout_atexit();
-
while ((ch = getopt_long(argc, argv, "cnvfx:Vh", longopts, NULL)) != -1) {
switch (ch) {
case 'n':
@@ -434,7 +431,7 @@ int main(int argc, char **argv)
exclude_pattern = (PCRE2_SPTR) optarg;
#else
errx(EXIT_FAILURE,
- _("option --exclude not supported (built without pcre2)"));
+ ("option --exclude not supported (built without pcre2)"));
#endif
break;
case 'V':
@@ -447,7 +444,7 @@ int main(int argc, char **argv)
}
if (optind == argc) {
- warnx(_("no directory specified"));
+ warnx(("no directory specified"));
errtryhelp(EXIT_FAILURE);
}
@@ -461,7 +458,7 @@ int main(int argc, char **argv)
PCRE2_UCHAR buffer[256];
pcre2_get_error_message(errornumber, buffer,
sizeof(buffer));
- errx(EXIT_FAILURE, _("pattern error at offset %d: %s"),
+ errx(EXIT_FAILURE, ("pattern error at offset %d: %s"),
(int)erroroffset, buffer);
}
match_data = pcre2_match_data_create_from_pattern(re, NULL);
@@ -506,7 +503,7 @@ int main(int argc, char **argv)
>=0) {
if (ctl->verbose) {
nam1.buf[nam1baselen] = 0;
- printf(_("Skipping %s%s\n"), nam1.buf, di->d_name);
+ printf(("Skipping %s%s\n"), nam1.buf, di->d_name);
}
continue;
}

View File

@ -0,0 +1,65 @@
From 32a4b8ae046fe4bb1b19f61378d079d44deaede7 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 01:48:24 +0000
Subject: [PATCH] nativesdk-glibc: Look for host system ld.so.cache as well
Upstream-Status: Inappropriate [embedded specific]
The default lib search path order is:
1) LD_LIBRARY_PATH
2) RPATH from the binary
3) ld.so.cache
4) default search paths embedded in the linker
For nativesdk binaries which are being used alongside binaries on a host system, we
need the search paths to firstly search the shipped nativesdk libs but then also
cover the host system. For example we want the host system's libGL and this may be
in a non-standard location like /usr/lib/mesa. The only place the location is know
about is in the ld.so.cache of the host system.
Since nativesdk has a simple structure and doesn't need to use a cache itself, we
repurpose the cache for use as a last resort in finding host system binaries. This
means we need to switch the order of 3 and 4 above to make this work effectively.
RP 14/10/2010
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
elf/dl-load.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 9e2089cfaa..ad01674027 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -2175,6 +2175,14 @@ _dl_map_object (struct link_map *loader, const char *name,
}
}
+ /* try the default path. */
+ if (fd == -1
+ && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
+ || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1))
+ && __rtld_search_dirs.dirs != (void *) -1)
+ fd = open_path (name, namelen, mode & __RTLD_SECURE, &__rtld_search_dirs,
+ &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
+ /* Finally try ld.so.cache */
#ifdef USE_LDCONFIG
if (fd == -1
&& (__glibc_likely ((mode & __RTLD_SECURE) == 0)
@@ -2233,14 +2241,6 @@ _dl_map_object (struct link_map *loader, const char *name,
}
#endif
- /* Finally, try the default path. */
- if (fd == -1
- && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL
- || __glibc_likely (!(l->l_flags_1 & DF_1_NODEFLIB)))
- && __rtld_search_dirs.dirs != (void *) -1)
- fd = open_path (name, namelen, mode, &__rtld_search_dirs,
- &realname, &fb, l, LA_SER_DEFAULT, &found_other_class);
-
/* Add another newline when we are tracing the library loading. */
if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS))
_dl_debug_printf ("\n");

View File

@ -0,0 +1,46 @@
From aa8393bff257e4badfd208b88473ead175c69362 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 01:50:00 +0000
Subject: [PATCH] nativesdk-glibc: Fix buffer overrun with a relocated SDK
When ld-linux-*.so.2 is relocated to a path that is longer than the
original fixed location, the dynamic loader will crash in open_path
because it implicitly assumes that max_dirnamelen is a fixed size that
never changes.
The allocated buffer will not be large enough to contain the directory
path string which is larger than the fixed location provided at build
time.
Upstream-Status: Inappropriate [OE SDK specific]
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
elf/dl-load.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index ad01674027..f455207e79 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1871,7 +1871,19 @@ open_path (const char *name, size_t namelen, int mode,
given on the command line when rtld is run directly. */
return -1;
+ do
+ {
+ struct r_search_path_elem *this_dir = *dirs;
+ if (this_dir->dirnamelen > max_dirnamelen)
+ {
+ max_dirnamelen = this_dir->dirnamelen;
+ }
+ }
+ while (*++dirs != NULL);
+
buf = alloca (max_dirnamelen + max_capstrlen + namelen);
+
+ dirs = sps->dirs;
do
{
struct r_search_path_elem *this_dir = *dirs;

View File

@ -0,0 +1,153 @@
From 3ea08e491a8494ff03e598b5e0fc2d8131e75da9 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 18 Mar 2015 01:51:38 +0000
Subject: [PATCH] nativesdk-glibc: Raise the size of arrays containing dl paths
This patch puts the dynamic loader path in the binaries, SYSTEM_DIRS strings
and lengths as well as ld.so.cache path in the dynamic loader to specific
sections in memory. The sections that contain paths have been allocated a 4096
byte section, which is the maximum path length in linux. This will allow the
relocating script to parse the ELF binary, detect the section and easily replace
the strings in a certain path.
Upstream-Status: Inappropriate [SDK specific]
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
elf/dl-cache.c | 4 ++++
elf/dl-load.c | 4 ++--
elf/dl-usage.c | 6 ++++--
elf/interp.c | 2 +-
elf/ldconfig.c | 3 +++
elf/rtld.c | 1 +
iconv/gconv_conf.c | 2 +-
sysdeps/generic/dl-cache.h | 4 ----
8 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index 32f3bef5ea..71f3a82dc0 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -359,6 +359,10 @@ search_cache (const char *string_table, uint32_t string_table_size,
return best;
}
+const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))) =
+ SYSCONFDIR "/ld.so.cache";
+
+
int
_dl_cache_libcmp (const char *p1, const char *p2)
{
diff --git a/elf/dl-load.c b/elf/dl-load.c
index f455207e79..a144e24fcf 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -115,8 +115,8 @@ enum { ncapstr = 1, max_capstrlen = 0 };
gen-trusted-dirs.awk. */
#include "trusted-dirs.h"
-static const char system_dirs[] = SYSTEM_DIRS;
-static const size_t system_dirs_len[] =
+static const char system_dirs[4096] __attribute__ ((section (".sysdirs"))) = SYSTEM_DIRS;
+volatile static const size_t system_dirs_len[] __attribute__ ((section (".sysdirslen"))) =
{
SYSTEM_DIRS_LEN
};
diff --git a/elf/dl-usage.c b/elf/dl-usage.c
index 6e26818bd7..f09e8b93e5 100644
--- a/elf/dl-usage.c
+++ b/elf/dl-usage.c
@@ -25,6 +25,8 @@
#include <dl-procinfo.h>
#include <dl-hwcaps.h>
+extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache")));
+
void
_dl_usage (const char *argv0, const char *wrong_option)
{
@@ -244,7 +246,7 @@ setting environment variables (which would be inherited by subprocesses).\n\
--list list all dependencies and how they are resolved\n\
--verify verify that given object really is a dynamically linked\n\
object we can handle\n\
- --inhibit-cache Do not use " LD_SO_CACHE "\n\
+ --inhibit-cache Do not use %s\n\
--library-path PATH use given PATH instead of content of the environment\n\
variable LD_LIBRARY_PATH\n\
--glibc-hwcaps-prepend LIST\n\
@@ -266,7 +268,7 @@ setting environment variables (which would be inherited by subprocesses).\n\
\n\
This program interpreter self-identifies as: " RTLD "\n\
",
- argv0);
+ argv0, LD_SO_CACHE);
print_search_path_for_help (state);
print_hwcaps_subdirectories (state);
print_legacy_hwcap_directories ();
diff --git a/elf/interp.c b/elf/interp.c
index 91966702ca..dc86c20e83 100644
--- a/elf/interp.c
+++ b/elf/interp.c
@@ -18,5 +18,5 @@
#include <runtime-linker.h>
-const char __invoke_dynamic_linker__[] __attribute__ ((section (".interp")))
+const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp")))
= RUNTIME_LINKER;
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 28ed637a29..5d38a60c5d 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -176,6 +176,9 @@ static struct argp argp =
options, parse_opt, NULL, doc, NULL, more_help, NULL
};
+
+extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache")));
+
/* Check if string corresponds to an important hardware capability or
a platform. */
static int
diff --git a/elf/rtld.c b/elf/rtld.c
index 596b6ac3d9..1ccd33f668 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -185,6 +185,7 @@ dso_name_valid_for_suid (const char *p)
}
return *p != '\0';
}
+extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache")));
static void
audit_list_init (struct audit_list *list)
diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
index 682f949834..7eed87bc9d 100644
--- a/iconv/gconv_conf.c
+++ b/iconv/gconv_conf.c
@@ -36,7 +36,7 @@
/* This is the default path where we look for module lists. */
-static const char default_gconv_path[] = GCONV_PATH;
+static char default_gconv_path[4096] __attribute__ ((section (".gccrelocprefix"))) = GCONV_PATH;
/* Type to represent search path. */
struct path_elem
diff --git a/sysdeps/generic/dl-cache.h b/sysdeps/generic/dl-cache.h
index 964d50a486..94bf68ca9d 100644
--- a/sysdeps/generic/dl-cache.h
+++ b/sysdeps/generic/dl-cache.h
@@ -34,10 +34,6 @@
((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID)
#endif
-#ifndef LD_SO_CACHE
-# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
-#endif
-
#ifndef add_system_dir
# define add_system_dir(dir) add_dir (dir)
#endif

View File

@ -0,0 +1,39 @@
From 19e3e45eb1838ee80af13c3d27fcff446773211e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 31 Dec 2015 14:35:35 -0800
Subject: [PATCH] nativesdk-glibc: Allow 64 bit atomics for x86
The fix consist of allowing 64bit atomic ops for x86.
This should be safe for i586 and newer CPUs.
It also makes the synchronization more efficient.
Upstream-Status: Inappropriate [OE-Specific]
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
sysdeps/x86/atomic-machine.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h
index 695222e4fa..9d39bfdbd5 100644
--- a/sysdeps/x86/atomic-machine.h
+++ b/sysdeps/x86/atomic-machine.h
@@ -52,15 +52,14 @@ typedef uintmax_t uatomic_max_t;
#define LOCK_PREFIX "lock;"
#define USE_ATOMIC_COMPILER_BUILTINS 1
+# define __HAVE_64B_ATOMICS 1
#ifdef __x86_64__
-# define __HAVE_64B_ATOMICS 1
# define SP_REG "rsp"
# define SEG_REG "fs"
# define BR_CONSTRAINT "q"
# define IBR_CONSTRAINT "iq"
#else
-# define __HAVE_64B_ATOMICS 0
# define SP_REG "esp"
# define SEG_REG "gs"
# define BR_CONSTRAINT "r"

Some files were not shown because too many files have changed in this diff Show More