Fixed foreign architecture package support to linux kernel flavours

Before Stretch there was an special amd64 kernel in the i386 arch repo.
So if you wanted to install an amd64 kernel alongside an i386 system
you did not need an additional arch repo.

Debian added multiarch support. That way you can install library packages
from multiple architectures on the same machine.

So there is no longer a need for having an amd64 kernel in i386 arch repo.
You can add an amd64 arch repo to an i386 arch system and fetch the amd64
kernel from the am64 arch repo.

live-build can be setup to use several linux kernel flavours in a single
image.

So in the days previous to this patch you could issue:
lb config --linux-flavours "486 amd64"
to use both 486 and amd64 kernel flavours.

Adding additional arch support to linux flavours poses two problems:

* Packages need to have its arch suffix (e.g. amd64:amd64).
If the suffix is not there apt-get insists on search amd64 kernel
package on i386 arch repo and, of course, fails to find it.

* The rest of the code which handles labels (bootloader config files)
or installed filenames (kernel images themselves) do not use the arch suffix.

This patch adds foreign architecture package support to
linux kernel flavours having taken those problems into account.

Practical example usage: i386 system and extra amd64 kernel.

First add amd64 foreign architecture in your i386 system
thanks to:

dpkg --add-architecture amd64
apt-get update

.

Finally enable amd64 kernel from amd64 arch alongside the
i386 system's 686 kernel thanks to:

lb config --architectures i386 --linux-flavours "686 amd64:amd64"
This commit is contained in:
Adrian Gibanel Lopez 2017-12-15 17:22:57 +00:00 committed by adrian15
parent a410b8345d
commit 80aa5ab611
4 changed files with 28 additions and 12 deletions

View File

@ -407,27 +407,27 @@ Set_defaults ()
# Setting linux flavour string
case "${LB_ARCHITECTURES}" in
arm64)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-arm64}"
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH:-arm64}"
;;
armel)
# armel will have special images: one rootfs image and many additional kernel images.
# therefore we default to all available armel flavours
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-marvell}"
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH:-marvell}"
;;
armhf)
# armhf will have special images: one rootfs image and many additional kernel images.
# therefore we default to all available armhf flavours
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-armmp armmp-lpae}"
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH:-armmp armmp-lpae}"
;;
amd64)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-amd64}"
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH:-amd64}"
;;
i386)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-686-pae}"
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH:-686-pae}"
;;
ia64)
@ -438,7 +438,7 @@ Set_defaults ()
;;
*)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-itanium}"
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH:-itanium}"
;;
esac
;;
@ -451,7 +451,7 @@ Set_defaults ()
;;
*)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-powerpc64 powerpc}"
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH:-powerpc64 powerpc}"
;;
esac
;;
@ -464,7 +464,7 @@ Set_defaults ()
;;
*)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS:-s390x}"
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH:-s390x}"
;;
esac
;;
@ -475,6 +475,14 @@ Set_defaults ()
;;
esac
LB_LINUX_FLAVOURS=""
for FLAVOUR in ${LB_LINUX_FLAVOURS_WITH_ARCH}
do
ARCH_FILTERED_FLAVOUR="$(echo ${FLAVOUR} | awk -F':' '{print $1}')"
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS} ${ARCH_FILTERED_FLAVOUR}"
done
# Set linux packages
LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES:-linux-image}"

View File

@ -360,7 +360,7 @@ sets the eraseblock size for a JFFS2 (Second Journaling Flash File System) files
.IP "\fB\-\-keyring\-packages\fR \fIPACKAGE\fI|""\fIPACKAGES\fR""" 4
sets the keyring package or additional keyring packages. By default this is set to debian\-archive\-keyring.
.IP "\-k|\fB\-\-linux\-flavours\fR \fIFLAVOUR\fR|""\fIFLAVOURS\fR""" 4
sets the kernel flavours to be installed. Note that in case you specify more than that the first will be configured the default kernel that gets booted.
sets the kernel flavours to be installed. Note that in case you specify more than that the first will be configured the default kernel that gets booted. Optionally you can use an architecture qualifier, e.g. amd64:amd64. Given an i386 system you can enable amd64 foreign architecture thanks to the commands: "dpkg \-\-add\-architecture amd64 ; apt\-get update". This enables you to use "686 amd64:amd64" as a linux flavour. The amd64 kernel will be installed alongside the i386's 686 kernel.
.IP "\fB\-\-linux\-packages\fR ""\fIPACKAGES\fR""" 4
sets the internal name of the kernel packages naming scheme. If you use debian kernel packages, you will not have to adjust it. If you decide to use custom kernel packages that do not follow the debian naming scheme, remember to set this option to the stub of the packages only (for debian this is linux\-image\-2.6), so that \fISTUB\fR-\fIFLAVOUR\fR results in a valid package name (for debian e.g. linux\-image\-686\-pae). Preferably you use the meta package name, if any, for the stub, so that your configuration is ABI independent. Also don't forget that you have to include stubs of the binary modules packages for unionfs or aufs, and squashfs if you built them out-of-tree.
.IP "\fB\-\-losetup\fR losetup|losetup.orig" 4

View File

@ -48,7 +48,7 @@ Create_lockfile .lock
# ;;
#esac
for FLAVOUR in ${LB_LINUX_FLAVOURS}
for FLAVOUR in ${LB_LINUX_FLAVOURS_WITH_ARCH}
do
for PACKAGE in ${LB_LINUX_PACKAGES}
do

View File

@ -453,7 +453,7 @@ Local_arguments ()
;;
-k|--linux-flavours)
LB_LINUX_FLAVOURS="${2}"
LB_LINUX_FLAVOURS_WITH_ARCH="${2}"
shift 2
;;
@ -1132,8 +1132,16 @@ LB_INTERACTIVE="${LB_INTERACTIVE}"
LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES}"
# \$LB_LINUX_FLAVOURS: set kernel flavour to use
# This is kept for backwards compatibility
# (Default: autodetected)
LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS}"
if [ -n "${LB_LINUX_FLAVOURS}" ]
then
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS}"
fi
# \$LB_LINUX_FLAVOURS_WITH_ARCH: set kernel flavour to use (with arch)
# (Default: autodetected)
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH}"
# \$LB_LINUX_PACKAGES: set kernel packages to use
# (Default: autodetected)