* Update buildroot-patches for 2020.11-rc1 buildroot * Update buildroot to 2020.11-rc1 Signed-off-by: Stefan Agner <stefan@agner.ch> * Don't rely on sfdisk --list-free output The --list-free (-F) argument does not allow machine readable mode. And it seems that the output format changes over time (different spacing, using size postfixes instead of raw blocks). Use sfdisk json output and calculate free partition space ourselfs. This works for 2.35 and 2.36 and is more robust since we rely on output which is meant for scripts to parse. * Migrate defconfigs for Buildroot 2020.11-rc1 In particular, rename BR2_TARGET_UBOOT_BOOT_SCRIPT(_SOURCE) to BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT(_SOURCE). * Rebase/remove systemd patches for systemd 246 * Drop apparmor/libapparmor from buildroot-external * hassos-persists: use /run as directory for lockfiles The U-Boot tools use /var/lock by default which is not created any more by systemd by default (it is under tmpfiles legacy.conf, which we no longer install). * Disable systemd-update-done.service The service is not suited for pure read-only systems. In particular the service needs to be able to write a file in /etc and /var. Remove the service. Note: This is a static service and cannot be removed using systemd-preset. * Disable apparmor.service for now The service loads all default profiles. Some might actually cause problems. E.g. the profile for ping seems not to match our setup for /etc/resolv.conf: [85503.634653] audit: type=1400 audit(1605286002.684:236): apparmor="DENIED" operation="open" profile="ping" name="/run/resolv.conf" pid=27585 comm="ping" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
108 lines
2.9 KiB
Bash
Executable File
108 lines
2.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
#
|
|
# dtb_list extracts the list of DTB files from BR2_LINUX_KERNEL_INTREE_DTS_NAME
|
|
# in ${BR_CONFIG}, then prints the corresponding list of file names for the
|
|
# genimage configuration file
|
|
#
|
|
dtb_list()
|
|
{
|
|
local DTB_LIST="$(sed -n 's/^BR2_LINUX_KERNEL_INTREE_DTS_NAME="\([\/a-z0-9 \-]*\)"$/\1/p' ${BR2_CONFIG})"
|
|
|
|
for dt in $DTB_LIST; do
|
|
echo -n "\"`basename $dt`.dtb\", "
|
|
done
|
|
}
|
|
|
|
#
|
|
# linux_image extracts the Linux image format from BR2_LINUX_KERNEL_UIMAGE in
|
|
# ${BR_CONFIG}, then prints the corresponding file name for the genimage
|
|
# configuration file
|
|
#
|
|
linux_image()
|
|
{
|
|
if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then
|
|
echo "\"uImage\""
|
|
elif grep -Eq "^BR2_LINUX_KERNEL_IMAGE=y$" ${BR2_CONFIG}; then
|
|
echo "\"Image\""
|
|
else
|
|
echo "\"zImage\""
|
|
fi
|
|
}
|
|
|
|
genimage_type()
|
|
{
|
|
if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8=y$" ${BR2_CONFIG}; then
|
|
echo "genimage.cfg.template_imx8"
|
|
elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y$" ${BR2_CONFIG}; then
|
|
echo "genimage.cfg.template_imx8"
|
|
elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=y$" ${BR2_CONFIG}; then
|
|
echo "genimage.cfg.template_imx8"
|
|
elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MN=y$" ${BR2_CONFIG}; then
|
|
echo "genimage.cfg.template_imx8"
|
|
elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8X=y$" ${BR2_CONFIG}; then
|
|
echo "genimage.cfg.template_imx8"
|
|
elif grep -Eq "^BR2_LINUX_KERNEL_INSTALL_TARGET=y$" ${BR2_CONFIG}; then
|
|
if grep -Eq "^BR2_TARGET_UBOOT_SPL=y$" ${BR2_CONFIG}; then
|
|
echo "genimage.cfg.template_no_boot_part_spl"
|
|
fi
|
|
elif grep -Eq "^BR2_TARGET_UBOOT_SPL=y$" ${BR2_CONFIG}; then
|
|
echo "genimage.cfg.template_spl"
|
|
else
|
|
echo "genimage.cfg.template"
|
|
fi
|
|
}
|
|
|
|
imx_offset()
|
|
{
|
|
if grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8M=y$" ${BR2_CONFIG}; then
|
|
echo "33K"
|
|
elif grep -Eq "^BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX8MM=y$" ${BR2_CONFIG}; then
|
|
echo "33K"
|
|
else
|
|
echo "32K"
|
|
fi
|
|
}
|
|
|
|
uboot_image()
|
|
{
|
|
if grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMX=y$" ${BR2_CONFIG}; then
|
|
echo "u-boot-dtb.imx"
|
|
elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMX=y$" ${BR2_CONFIG}; then
|
|
echo "u-boot.imx"
|
|
elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_DTB_IMG=y$" ${BR2_CONFIG}; then
|
|
echo "u-boot-dtb.img"
|
|
elif grep -Eq "^BR2_TARGET_UBOOT_FORMAT_IMG=y$" ${BR2_CONFIG}; then
|
|
echo "u-boot.img"
|
|
fi
|
|
}
|
|
|
|
main()
|
|
{
|
|
local FILES="$(dtb_list) $(linux_image)"
|
|
local IMXOFFSET="$(imx_offset)"
|
|
local UBOOTBIN="$(uboot_image)"
|
|
local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)"
|
|
local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
|
|
|
|
sed -e "s/%FILES%/${FILES}/" \
|
|
-e "s/%IMXOFFSET%/${IMXOFFSET}/" \
|
|
-e "s/%UBOOTBIN%/${UBOOTBIN}/" \
|
|
board/freescale/common/imx/$(genimage_type) > ${GENIMAGE_CFG}
|
|
|
|
rm -rf "${GENIMAGE_TMP}"
|
|
|
|
genimage \
|
|
--rootpath "${TARGET_DIR}" \
|
|
--tmppath "${GENIMAGE_TMP}" \
|
|
--inputpath "${BINARIES_DIR}" \
|
|
--outputpath "${BINARIES_DIR}" \
|
|
--config "${GENIMAGE_CFG}"
|
|
|
|
rm -f ${GENIMAGE_CFG}
|
|
|
|
exit $?
|
|
}
|
|
|
|
main $@
|