Compare commits
2 commits
e07818d2d6
...
1f606f913d
Author | SHA1 | Date | |
---|---|---|---|
1f606f913d | |||
be3cd00243 |
1 changed files with 25 additions and 8 deletions
|
@ -44,6 +44,9 @@ opt_boot() {
|
|||
opt_architecture() {
|
||||
ARCHITECTURE="$1"
|
||||
}
|
||||
opt_arch() {
|
||||
ARCHITECTURE="$1"
|
||||
}
|
||||
opt_apt_proxy() {
|
||||
# consumed by setup-testbed
|
||||
export AUTOPKGTEST_APT_PROXY="$1"
|
||||
|
@ -62,6 +65,7 @@ opt_mirror() {
|
|||
export MIRROR="$1"
|
||||
}
|
||||
opt_script() {
|
||||
test -f "$1" || die "passed script '$1' does not refer to a file"
|
||||
SCRIPT="$1"
|
||||
}
|
||||
opt_size() {
|
||||
|
@ -86,14 +90,14 @@ positional_7() {
|
|||
|
||||
while test "$#" -gt 0; do
|
||||
case "$1" in
|
||||
--architecture=*|--boot=*|--keyring=*|--mirror=*|--script=*|--size=*)
|
||||
--architecture=*|--arch=*|--boot=*|--keyring=*|--mirror=*|--script=*|--size=*)
|
||||
optname="${1%%=*}"
|
||||
"opt_${optname#--}" "${1#*=}"
|
||||
;;
|
||||
--apt-proxy=*)
|
||||
opt_apt_proxy "${1#*=}"
|
||||
;;
|
||||
--architecture|--boot|--keyring|--mirror|--script|--size)
|
||||
--architecture|--arch|--boot|--keyring|--mirror|--script|--size)
|
||||
test "$#" -ge 2 || usage_error "missing argument for $1"
|
||||
"opt_${1#--}" "$2"
|
||||
shift
|
||||
|
@ -142,8 +146,16 @@ case "$ARCHITECTURE" in
|
|||
;;
|
||||
esac
|
||||
|
||||
GNU_ARCHITECTURE="$(dpkg-architecture "-a$ARCHITECTURE" -qDEB_HOST_GNU_TYPE)"
|
||||
for pkg in autopkgtest "binutils-$(echo "$GNU_ARCHITECTURE" | tr _ -)" dosfstools e2fsprogs fdisk mount mtools passwd "systemd-boot-efi:$ARCHITECTURE" uidmap; do
|
||||
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_PREFIX="$GNU_ARCHITECTURE-"
|
||||
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 ||
|
||||
die "please install $pkg"
|
||||
done
|
||||
|
@ -188,7 +200,12 @@ set -- "$@" \
|
|||
'--customize-hook=passwd --root "$1" --delete user' \
|
||||
'--customize-hook=/usr/share/autopkgtest/setup-commands/setup-testbed'
|
||||
|
||||
test -n "$SCRIPT" && set -- "$@" "--customize-hook=$SCRIPT"
|
||||
if test -n "$SCRIPT"; then
|
||||
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_OPTIONS="offset=$EXT4_OFFSET_BYTES,assume_storage_prezeroed=1"
|
||||
|
@ -217,7 +234,7 @@ align_size() {
|
|||
echo "$(( ($1) + ($2) - 1 - (($1) + ($2) - 1) % ($2) ))"
|
||||
}
|
||||
|
||||
alignment=$("$GNU_ARCHITECTURE-objdump" -p "$BOOTSTUB" | sed 's/^SectionAlignment\s\+\([0-9]\)/0x/;t;d')
|
||||
alignment=$("${GNU_PREFIX}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"
|
||||
echo "determined efi vma alignment as $alignment"
|
||||
test "$RELEASE" = jessie -a "$((alignment))" -lt "$((1024*1024))" && {
|
||||
|
@ -226,7 +243,7 @@ test "$RELEASE" = jessie -a "$((alignment))" -lt "$((1024*1024))" && {
|
|||
}
|
||||
lastoffset=0
|
||||
# shellcheck disable=SC2034 # unused variables serve documentation
|
||||
lastoffset="$("$GNU_ARCHITECTURE-objdump" -h "$BOOTSTUB" |
|
||||
lastoffset="$("${GNU_PREFIX}objdump" -h "$BOOTSTUB" |
|
||||
while read -r idx name size vma lma fileoff algn behind; do
|
||||
test -z "$behind" -a "${algn#"2**"}" != "$algn" || continue
|
||||
offset=$(( 0x$vma + 0x$size ))
|
||||
|
@ -246,7 +263,7 @@ linux_offset=$((cmdline_offset + cmdline_size))
|
|||
initrd_offset=$((linux_offset + linux_size))
|
||||
|
||||
SOURCE_DATE_EPOCH=0 \
|
||||
"$GNU_ARCHITECTURE-objcopy" \
|
||||
"${GNU_PREFIX}objcopy" \
|
||||
--enable-deterministic-archives \
|
||||
--add-section .cmdline="$WORKDIR/cmdline" \
|
||||
--change-section-vma .cmdline="$(printf 0x%x "$cmdline_offset")" \
|
||||
|
|
Loading…
Reference in a new issue