Compare commits

..

No commits in common. "1f606f913da4285d5049535c6fc7eeb4dffc076f" and "e07818d2d677370c8e910cad85d0e493033913ea" have entirely different histories.

View file

@ -44,9 +44,6 @@ opt_boot() {
opt_architecture() { opt_architecture() {
ARCHITECTURE="$1" ARCHITECTURE="$1"
} }
opt_arch() {
ARCHITECTURE="$1"
}
opt_apt_proxy() { opt_apt_proxy() {
# consumed by setup-testbed # consumed by setup-testbed
export AUTOPKGTEST_APT_PROXY="$1" export AUTOPKGTEST_APT_PROXY="$1"
@ -65,7 +62,6 @@ opt_mirror() {
export MIRROR="$1" export MIRROR="$1"
} }
opt_script() { opt_script() {
test -f "$1" || die "passed script '$1' does not refer to a file"
SCRIPT="$1" SCRIPT="$1"
} }
opt_size() { opt_size() {
@ -90,14 +86,14 @@ positional_7() {
while test "$#" -gt 0; do while test "$#" -gt 0; do
case "$1" in case "$1" in
--architecture=*|--arch=*|--boot=*|--keyring=*|--mirror=*|--script=*|--size=*) --architecture=*|--boot=*|--keyring=*|--mirror=*|--script=*|--size=*)
optname="${1%%=*}" optname="${1%%=*}"
"opt_${optname#--}" "${1#*=}" "opt_${optname#--}" "${1#*=}"
;; ;;
--apt-proxy=*) --apt-proxy=*)
opt_apt_proxy "${1#*=}" opt_apt_proxy "${1#*=}"
;; ;;
--architecture|--arch|--boot|--keyring|--mirror|--script|--size) --architecture|--boot|--keyring|--mirror|--script|--size)
test "$#" -ge 2 || usage_error "missing argument for $1" test "$#" -ge 2 || usage_error "missing argument for $1"
"opt_${1#--}" "$2" "opt_${1#--}" "$2"
shift shift
@ -146,16 +142,8 @@ case "$ARCHITECTURE" in
;; ;;
esac esac
if test "$(dpkg-query -f '${db:Status-Status}' -W binutils-multiarch)" = installed; then
GNU_PREFIX=
else
GNU_ARCHITECTURE="$(dpkg-architecture "-a$ARCHITECTURE" -qDEB_HOST_GNU_TYPE)" GNU_ARCHITECTURE="$(dpkg-architecture "-a$ARCHITECTURE" -qDEB_HOST_GNU_TYPE)"
GNU_PREFIX="$GNU_ARCHITECTURE-" for pkg in autopkgtest "binutils-$(echo "$GNU_ARCHITECTURE" | tr _ -)" dosfstools e2fsprogs fdisk mount mtools passwd "systemd-boot-efi:$ARCHITECTURE" uidmap; do
GNU_SUFFIX="-$(echo "$GNU_ARCHITECTURE" | tr _ -)"
test "$(dpkg-query -f '${db:Status-Status}' -W "binutils$GNU_SUFFIX")" = installed ||
die "please install binutils$GNU_SUFFIX or binutils-multiarch"
fi
for pkg in autopkgtest dosfstools e2fsprogs fdisk mount mtools passwd "systemd-boot-efi:$ARCHITECTURE" uidmap; do
test "$(dpkg-query -f '${db:Status-Status}' -W "$pkg")" = installed || test "$(dpkg-query -f '${db:Status-Status}' -W "$pkg")" = installed ||
die "please install $pkg" die "please install $pkg"
done done
@ -200,12 +188,7 @@ set -- "$@" \
'--customize-hook=passwd --root "$1" --delete user' \ '--customize-hook=passwd --root "$1" --delete user' \
'--customize-hook=/usr/share/autopkgtest/setup-commands/setup-testbed' '--customize-hook=/usr/share/autopkgtest/setup-commands/setup-testbed'
if test -n "$SCRIPT"; then test -n "$SCRIPT" && set -- "$@" "--customize-hook=$SCRIPT"
set -- "$@" \
"--customize-hook=upload '$SCRIPT' /userscript" \
"--chrooted-customize-hook=sh /userscript" \
'--customize-hook=rm -f "$1/userscript"'
fi
EXT4_OFFSET_BYTES=$(( (FAT_OFFSET_SECTORS + FAT_SIZE_SECTORS) * 512)) EXT4_OFFSET_BYTES=$(( (FAT_OFFSET_SECTORS + FAT_SIZE_SECTORS) * 512))
EXT4_OPTIONS="offset=$EXT4_OFFSET_BYTES,assume_storage_prezeroed=1" EXT4_OPTIONS="offset=$EXT4_OFFSET_BYTES,assume_storage_prezeroed=1"
@ -234,7 +217,7 @@ align_size() {
echo "$(( ($1) + ($2) - 1 - (($1) + ($2) - 1) % ($2) ))" echo "$(( ($1) + ($2) - 1 - (($1) + ($2) - 1) % ($2) ))"
} }
alignment=$("${GNU_PREFIX}objdump" -p "$BOOTSTUB" | sed 's/^SectionAlignment\s\+\([0-9]\)/0x/;t;d') alignment=$("$GNU_ARCHITECTURE-objdump" -p "$BOOTSTUB" | sed 's/^SectionAlignment\s\+\([0-9]\)/0x/;t;d')
test -z "$alignment" && die "failed to discover the alignment of the efi stub" test -z "$alignment" && die "failed to discover the alignment of the efi stub"
echo "determined efi vma alignment as $alignment" echo "determined efi vma alignment as $alignment"
test "$RELEASE" = jessie -a "$((alignment))" -lt "$((1024*1024))" && { test "$RELEASE" = jessie -a "$((alignment))" -lt "$((1024*1024))" && {
@ -243,7 +226,7 @@ test "$RELEASE" = jessie -a "$((alignment))" -lt "$((1024*1024))" && {
} }
lastoffset=0 lastoffset=0
# shellcheck disable=SC2034 # unused variables serve documentation # shellcheck disable=SC2034 # unused variables serve documentation
lastoffset="$("${GNU_PREFIX}objdump" -h "$BOOTSTUB" | lastoffset="$("$GNU_ARCHITECTURE-objdump" -h "$BOOTSTUB" |
while read -r idx name size vma lma fileoff algn behind; do while read -r idx name size vma lma fileoff algn behind; do
test -z "$behind" -a "${algn#"2**"}" != "$algn" || continue test -z "$behind" -a "${algn#"2**"}" != "$algn" || continue
offset=$(( 0x$vma + 0x$size )) offset=$(( 0x$vma + 0x$size ))
@ -263,7 +246,7 @@ linux_offset=$((cmdline_offset + cmdline_size))
initrd_offset=$((linux_offset + linux_size)) initrd_offset=$((linux_offset + linux_size))
SOURCE_DATE_EPOCH=0 \ SOURCE_DATE_EPOCH=0 \
"${GNU_PREFIX}objcopy" \ "$GNU_ARCHITECTURE-objcopy" \
--enable-deterministic-archives \ --enable-deterministic-archives \
--add-section .cmdline="$WORKDIR/cmdline" \ --add-section .cmdline="$WORKDIR/cmdline" \
--change-section-vma .cmdline="$(printf 0x%x "$cmdline_offset")" \ --change-section-vma .cmdline="$(printf 0x%x "$cmdline_offset")" \