mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 04:33:00 +02:00
board/common: Consolidate aux.ext4 generation
Add a generic image target to build aux.ext4, which can be used both when creating target-specific SD-card images, and when creating regular disk images. While we're here, make sure that we don't need a RAUC bundle in order to generate aux.ext4 (which mkrauc-status.sh did). This saves us time on _every_ incremental build.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
menu "Images"
|
||||
|
||||
source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-rootfs/Config.in"
|
||||
source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-aux/Config.in"
|
||||
source "$BR2_EXTERNAL_INFIX_PATH/board/common/image/image-itb-rauc/Config.in"
|
||||
|
||||
endmenu
|
||||
@@ -144,9 +145,3 @@ config FIT_KERNEL_LOAD_ADDR
|
||||
string "Kernel load address"
|
||||
depends on FIT_IMAGE
|
||||
|
||||
config SDCARD_AUX
|
||||
bool "Create SD-card aux partition"
|
||||
help
|
||||
Create and populate aux.ext4 with rootfs.itbh and rauc.status
|
||||
For use with a static genimage.cfg for, e.g., SD-cards.
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
config IMAGE_ITB_AUX
|
||||
bool "aux partition"
|
||||
depends on IMAGE_ITB_ROOTFS
|
||||
select BR2_PACKAGE_HOST_UBOOT_TOOLS
|
||||
select BR2_PACKAGE_HOST_GENIMAGE
|
||||
help
|
||||
Create and populate auxiliary partition, aux.ext4, with
|
||||
metadata needed by U-Boot and RAUC to operate properly on
|
||||
systems using ITB images. This may then be included as a
|
||||
partition in a larger disk image.
|
||||
Executable
+85
@@ -0,0 +1,85 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
boot="${1}"
|
||||
squash="${BINARIES_DIR}"/rootfs.squashfs
|
||||
itbh="${BINARIES_DIR}"/rootfs.itbh
|
||||
aux="${BINARIES_DIR}"/aux.ext4
|
||||
|
||||
mkdir -p "${WORKDIR}"/aux
|
||||
rm -rf "${WORKDIR}"/tmp
|
||||
mkdir -p "${WORKDIR}"/tmp
|
||||
|
||||
cp -f "${itbh}" "${WORKDIR}"/aux/primary.itbh
|
||||
cp -f "${itbh}" "${WORKDIR}"/aux/secondary.itbh
|
||||
|
||||
tstamp=$(date -u +%FT%TZ)
|
||||
rootsha=$(sha256sum "${squash}" | cut -d" " -f1)
|
||||
rootsize=$(stat -c %s "${squash}")
|
||||
cat <<EOF >"${WORKDIR}"/aux/rauc.status
|
||||
[slot.rootfs.0]
|
||||
bundle.compatible=${COMPATIBLE}
|
||||
bundle.version=${VERSION}
|
||||
status=ok
|
||||
sha256=${rootsha}
|
||||
size=${rootsize}
|
||||
installed.timestamp=$tstamp
|
||||
installed.count=1
|
||||
activated.timestamp=$tstamp
|
||||
activated.count=1
|
||||
|
||||
[slot.rootfs.1]
|
||||
bundle.compatible=${COMPATIBLE}
|
||||
bundle.version=${VERSION}
|
||||
status=ok
|
||||
sha256=${rootsha}
|
||||
size=${rootsize}
|
||||
installed.timestamp=$tstamp
|
||||
installed.count=1
|
||||
activated.timestamp=$tstamp
|
||||
activated.count=1
|
||||
EOF
|
||||
|
||||
case "${boot}" in
|
||||
uboot)
|
||||
cat <<EOF | mkenvimage -s 0x4000 -o "${WORKDIR}"/aux/uboot.env -
|
||||
BOOT_ORDER=primary secondary net
|
||||
BOOT_primary_LEFT=1
|
||||
BOOT_secondary_LEFT=1
|
||||
BOOT_net_LEFT=1
|
||||
EOF
|
||||
;;
|
||||
grub)
|
||||
mkdir -p "${WORKDIR}"/aux/grub
|
||||
cp -f "${PKGDIR}"/grub.cfg "${PKGDIR}"/grubenv "${WORKDIR}"/aux/grub
|
||||
;;
|
||||
*)
|
||||
echo "UNSUPPORTED BOOTLOADER ${boot}" >&2
|
||||
exit 1
|
||||
esac
|
||||
|
||||
cat <<EOF >"${WORKDIR}"/genimage.cfg
|
||||
image $(basename ${aux}) {
|
||||
mountpoint = "/"
|
||||
size = 8M
|
||||
|
||||
ext4 {
|
||||
label = "aux"
|
||||
use-mke2fs = true
|
||||
features = "^metadata_csum,^metadata_csum_seed,uninit_bg"
|
||||
extraargs = "-m 0 -i 4096"
|
||||
}
|
||||
}
|
||||
|
||||
# Silence genimage warnings
|
||||
config {}
|
||||
EOF
|
||||
|
||||
genimage \
|
||||
--loglevel 1 \
|
||||
--tmppath "${WORKDIR}"/tmp \
|
||||
--rootpath "${WORKDIR}"/aux \
|
||||
--inputpath "${WORKDIR}" \
|
||||
--outputpath "$(dirname ${aux})" \
|
||||
--config "${WORKDIR}"/genimage.cfg
|
||||
@@ -0,0 +1,80 @@
|
||||
set timeout="1"
|
||||
|
||||
load_env ORDER DEBUG
|
||||
|
||||
if [ -z "$ORDER" ]; then
|
||||
set ORDER="primary secondary"
|
||||
fi
|
||||
|
||||
set ORDER="$ORDER reboot"
|
||||
|
||||
for slot in $ORDER; do
|
||||
if [ -z "$default" ]; then
|
||||
set default="$slot"
|
||||
else
|
||||
# Contrary to what the documentation says, GRUB (2.06) does
|
||||
# not support using titles or IDs in the fallback variable, so
|
||||
# we translate to indices.
|
||||
if [ "$slot" = "primary" ]; then
|
||||
set fallback="$fallback 0"
|
||||
elif [ "$slot" = "secondary" ]; then
|
||||
set fallback="$fallback 1"
|
||||
elif [ "$slot" = "net" ]; then
|
||||
set fallback="$fallback 2"
|
||||
elif [ "$slot" = "reboot" ]; then
|
||||
set fallback="$fallback 3"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$DEBUG" ]; then
|
||||
set log="debug"
|
||||
else
|
||||
set log="loglevel=4"
|
||||
fi
|
||||
|
||||
# From board/common/rootfs/etc/partition-uuid
|
||||
search -p 107ae911-a97b-4380-975c-7ce1a2dde1e0 --set primary
|
||||
search -p 352bd9b2-2ca9-44e2-bdc7-edbc87ba1e02 --set secondary
|
||||
|
||||
export primary
|
||||
export secondary
|
||||
|
||||
submenu "primary" "$log" {
|
||||
set slot="$1"
|
||||
set append="console=ttyS0 console=hvc0 usbcore.authorized_default=2 root=PARTLABEL=$slot $2"
|
||||
set root="($primary)"
|
||||
source /boot/grub/grub.cfg
|
||||
}
|
||||
|
||||
submenu "secondary" "$log" {
|
||||
set slot="$1"
|
||||
set append="console=ttyS0 console=hvc0 usbcore.authorized_default=2 root=PARTLABEL=$slot $2"
|
||||
set root="($secondary)"
|
||||
source /boot/grub/grub.cfg
|
||||
}
|
||||
|
||||
submenu "net" "$log" {
|
||||
net_dhcp
|
||||
|
||||
if [ "$net_efinet0_dhcp_next_server" -a "$net_efinet0_dhcp_boot_file" ]; then
|
||||
set initrd=(tftp,$net_efinet0_dhcp_next_server)/$net_efinet0_dhcp_boot_file
|
||||
loopback initrd $initrd
|
||||
set root=(initrd)
|
||||
|
||||
set slot="$1"
|
||||
set append="console=ttyS0 console=hvc0 usbcore.authorized_default=2 qroot=/dev/ram0 ramdisk_size=65536 $2"
|
||||
source /boot/grub/grub.cfg
|
||||
else
|
||||
if [ -z "$net_efinet0_dhcp_next_server" ]; then
|
||||
echo "No TFTP server supplied in DHCP response"
|
||||
fi
|
||||
if [ -z "$net_efinet0_dhcp_boot_file" ]; then
|
||||
echo "No bootfile supplied in DHCP response"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
submenu "reboot" {
|
||||
reboot
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
# GRUB Environment Block
|
||||
# WARNING: Do not edit this file by tools other than grub-editenv!!!
|
||||
ORDER=primary secondary net
|
||||
primary_OK=1
|
||||
secondary_OK=1
|
||||
net_OK=1
|
||||
primary_TRY=0
|
||||
secondary_TRY=0
|
||||
net_TRY=0
|
||||
#########################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################
|
||||
@@ -0,0 +1,10 @@
|
||||
################################################################################
|
||||
#
|
||||
# image-itb-aux
|
||||
#
|
||||
################################################################################
|
||||
|
||||
IMAGE_ITB_AUX_DEPENDENCIES := host-uboot-tools host-genimage image-itb-rootfs
|
||||
IMAGE_ITB_AUX_OPTS := $(if $(BR2_TARGET_GRUB2),grub,uboot)
|
||||
|
||||
$(eval $(ix-image))
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
rootdir=$BUILD_DIR/genimage.root
|
||||
tempdir=$BUILD_DIR/genimage.tmp
|
||||
|
||||
cat <<EOF > /tmp/mkaux.cfg
|
||||
image aux.ext4 {
|
||||
mountpoint = "/aux"
|
||||
size = 16M
|
||||
|
||||
ext4 {
|
||||
label = "aux"
|
||||
use-mke2fs = true
|
||||
features = "^metadata_csum,^metadata_csum_seed,uninit_bg"
|
||||
extraargs = "-m 0 -i 4096"
|
||||
}
|
||||
}
|
||||
|
||||
# Silence genimage warnings
|
||||
config {}
|
||||
EOF
|
||||
|
||||
rm -rf "$rootdir/aux"
|
||||
mkdir -p "$rootdir/aux"
|
||||
cp -f "$BINARIES_DIR/rootfs.itbh" "$rootdir/aux/primary.itbh"
|
||||
cp -f "$BINARIES_DIR/rootfs.itbh" "$rootdir/aux/secondary.itbh"
|
||||
cp -f "$BINARIES_DIR/rauc.status" "$rootdir/aux/rauc.status"
|
||||
|
||||
mkenvimage -s 0x4000 -o "$rootdir/aux/uboot.env" \
|
||||
"$BR2_EXTERNAL_INFIX_PATH/board/common/uboot/aux-env.txt"
|
||||
|
||||
rm -rf "$BINARIES_DIR/aux.ext4"
|
||||
rm -rf "$tempdir"
|
||||
|
||||
genimage \
|
||||
--rootpath "$rootdir" \
|
||||
--tmppath "$tempdir" \
|
||||
--inputpath "$BINARIES_DIR" \
|
||||
--outputpath "$BINARIES_DIR" \
|
||||
--config "/tmp/mkaux.cfg"
|
||||
@@ -54,14 +54,6 @@ if [ "$DISK_IMAGE" = "y" ]; then
|
||||
$common/mkdisk.sh -a $BR2_ARCH -n $diskimg -s $DISK_IMAGE_SIZE $bootcfg
|
||||
fi
|
||||
|
||||
load_cfg SDCARD_AUX
|
||||
if [ "$SDCARD_AUX" = "y" ]; then
|
||||
ixmsg "Creating initial rauc.status"
|
||||
$common/mkrauc-status.sh "$BINARIES_DIR/${NAME}.pkg" >"$BINARIES_DIR/rauc.status"
|
||||
ixmsg "Creating aux.ext4 for sdcard.img"
|
||||
$common/mkaux.sh
|
||||
fi
|
||||
|
||||
load_cfg GNS3_APPLIANCE
|
||||
if [ "$GNS3_APPLIANCE" = "y" ]; then
|
||||
ixmsg "Creating GNS3 Appliance, $GNS3_APPLIANCE_RAM MiB with $GNS3_APPLIANCE_IFNUM ports"
|
||||
|
||||
@@ -204,7 +204,7 @@ BR2_PACKAGE_TETRIS=y
|
||||
BR2_PACKAGE_ROUSETTE=y
|
||||
BR2_PACKAGE_RAUC_INSTALLATION_STATUS=y
|
||||
BR2_PACKAGE_HOST_PYTHON_YANGDOC=y
|
||||
IMAGE_ITB_AUX=y
|
||||
TRUSTED_KEYS=y
|
||||
TRUSTED_KEYS_DEVELOPMENT=y
|
||||
# GNS3_APPLIANCE is not set
|
||||
SDCARD_AUX=y
|
||||
|
||||
Reference in New Issue
Block a user