Yocto Bug #6945
v2 cover Yocto Bug #6945
From: He Zhe <[email protected]>
v1 to v2:
- Change KERNEL_OUTPUT to KERNEL_OUTPUT_DIR and update comments
- Update related doc files
- Replace all KERNEL_ALT_IMAGETYPEs with KERNEL_IMAGETYPES
- Link built vmlinuz to boot directory for reference
The following changes since commit ed20c6ca446a8788615e497bd4452195537deab5:
epiphany: Add libxml2-native to DEPENDS (2016-02-19 01:01:26 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib zhe/yocto-bug-6945
http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=zhe/yocto-bug-6945
for you to fetch changes up to 5ddb8ef58e1cd3c4b95de6439894510641f2e70a:
kernel: Make symbol link to vmlinuz in boot directory (2016-02-19 04:23:28 -0500)
----------------------------------------------------------------
He Zhe (2):
kernel: Add KERNEL_IMAGETYPES to build multi types kernel at one time
kernel: Make symbol link to vmlinuz in boot directory
documentation/ref-manual/ref-tasks.xml | 8 +- documentation/ref-manual/ref-variables.xml | 10 +- meta-yocto-bsp/conf/machine/edgerouter.conf | 2 +- meta/classes/kernel-fitimage.bbclass | 20 ++- meta/classes/kernel-grub.bbclass | 44 +++-- meta/classes/kernel-uimage.bbclass | 22 +-- meta/classes/kernel.bbclass | 184 ++++++++++++++------- meta/conf/documentation.conf | 3 +- meta/conf/machine/qemumips.conf | 2 +- meta/conf/machine/qemumips64.conf | 2 +- meta/recipes-kernel/linux/linux-dtb.inc | 49 +++--- meta/recipes-kernel/linux/linux-yocto.inc | 2 +- .../target/arch/mips/conf/machine/machine.conf | 2 +- .../target/arch/mips64/conf/machine/machine.conf | 2 +- .../target/arch/qemu/conf/machine/machine.conf | 2 +- 15 files changed, 228 insertions(+), 126 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/2 kernel: Add KERNEL_IMAGETYPES to build multi types kernel at one time
From: He Zhe <[email protected]>
Add KERNEL_IMAGETYPES to support building packaging and installing multi types of kernel images, such as zImage uImage, at one time.
KERNEL_IMAGETYPE works as before. All KERNEL_ALT_IMAGETYPEs are replaced by KERNEL_IMAGETYPES.
Fixes [YOCTO #6945].
--- documentation/ref-manual/ref-variables.xml | 10 +- meta-yocto-bsp/conf/machine/edgerouter.conf | 2 +- meta/classes/kernel-fitimage.bbclass | 20 +-- meta/classes/kernel-grub.bbclass | 44 ++++-- meta/classes/kernel-uimage.bbclass | 22 +-- meta/classes/kernel.bbclass | 171 +++++++++++++++------ meta/conf/documentation.conf | 1 + meta/conf/machine/qemumips.conf | 2 +- meta/conf/machine/qemumips64.conf | 2 +- meta/recipes-kernel/linux/linux-dtb.inc | 49 +++--- .../target/arch/mips/conf/machine/machine.conf | 2 +- .../target/arch/mips64/conf/machine/machine.conf | 2 +- .../target/arch/qemu/conf/machine/machine.conf | 2 +- 13 files changed, 214 insertions(+), 115 deletions(-)
documentation/ref-manual/ref-variables.xml +5 -5
@@ -6417,14 +6417,14 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" </glossdef> </glossentry> - <glossentry id='var-KERNEL_ALT_IMAGETYPE'><glossterm>KERNEL_ALT_IMAGETYPE</glossterm> + <glossentry id='var-KERNEL_IMAGETYPES'><glossterm>KERNEL_IMAGETYPES</glossterm> <info> - KERNEL_ALT_IMAGETYPE[doc] = "Specifies an alternate kernel image type for creation." + KERNEL_IMAGETYPES[doc] = "Specifies alternate kernel image types for creation." </info> <glossdef> <para role="glossdeffirst"> <!-- <para role="glossdeffirst"><imagedata fileref="figures/define-generic.png" /> --> - Specifies an alternate kernel image type for creation in + Specifies alternate kernel image types for creation in addition to the kernel image type specified using the <link linkend='var-KERNEL_IMAGETYPE'><filename>KERNEL_IMAGETYPE</filename></link> variable.
@@ -6612,8 +6612,8 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3" </para> <para> - If you want to build an alternate kernel image type, use the - <link linkend='var-KERNEL_ALT_IMAGETYPE'><filename>KERNEL_ALT_IMAGETYPE</filename></link> + If you want to build alternate kernel image types, use the + <link linkend='var-KERNEL_IMAGETYPES'><filename>KERNEL_IMAGETYPES</filename></link> variable. </para> </glossdef>
meta-yocto-bsp/conf/machine/edgerouter.conf +1 -1
@@ -7,7 +7,7 @@ require conf/machine/include/tune-mips64.inc MACHINE_FEATURES = "pci ext2 ext3 serial" KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" KERNEL_IMAGE_STRIP_EXTRA_SECTIONS = ".comment" PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
meta/classes/kernel-fitimage.bbclass +11 -9
@@ -1,8 +1,8 @@ inherit kernel-uboot python __anonymous () { - kerneltype = d.getVar('KERNEL_IMAGETYPE', True) - if kerneltype == 'fitImage': + kerneltypes = d.getVar('KERNEL_IMAGETYPES', True) or "" + if 'fitImage' in kerneltypes.split(): depends = d.getVar("DEPENDS", True) depends = "%s u-boot-mkimage-native dtc-native" % depends d.setVar("DEPENDS", depends)
@@ -10,7 +10,9 @@ python __anonymous () { # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal # to kernel.bbclass . We have to override it, since we pack zImage # (at least for now) into the fitImage . - d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "zImage") + typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or "" + if 'fitImage' in typeformake.split(): + d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', 'zImage')) image = d.getVar('INITRAMFS_IMAGE', True) if image:
@@ -154,7 +156,7 @@ EOF } do_assemble_fitimage() { - if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then + if echo ${KERNEL_IMAGETYPES} | grep -Pq "\bfitImage\b"; then kernelcount=1 dtbcount="" rm -f fit-image.its
@@ -217,14 +219,14 @@ addtask assemble_fitimage before do_install after do_compile kernel_do_deploy_append() { # Update deploy directory - if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then + if echo ${KERNEL_IMAGETYPES} | grep -Pq "\bfitImage\b"; then cd ${B} echo "Copying fit-image.its source file..." - its_base_name="${KERNEL_IMAGETYPE}-its-${PV}-${PR}-${MACHINE}-${DATETIME}" - its_symlink_name=${KERNEL_IMAGETYPE}-its-${MACHINE} + its_base_name="fitImage-its-${PV}-${PR}-${MACHINE}-${DATETIME}" + its_symlink_name=fitImage-its-${MACHINE} install -m 0644 fit-image.its ${DEPLOYDIR}/${its_base_name}.its - linux_bin_base_name="${KERNEL_IMAGETYPE}-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}" - linux_bin_symlink_name=${KERNEL_IMAGETYPE}-linux.bin-${MACHINE} + linux_bin_base_name="fitImage-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}" + linux_bin_symlink_name=fitImage-linux.bin-${MACHINE} install -m 0644 linux.bin ${DEPLOYDIR}/${linux_bin_base_name}.bin cd ${DEPLOYDIR}
meta/classes/kernel-grub.bbclass +29 -15
82 lines not on this page · raw message
meta/classes/kernel-uimage.bbclass +12 -10
@@ -1,23 +1,25 @@ inherit kernel-uboot python __anonymous () { - kerneltype = d.getVar('KERNEL_IMAGETYPE', True) - if kerneltype == 'uImage': + if "uImage" in (d.getVar('KERNEL_IMAGETYPES', True) or "").split(): depends = d.getVar("DEPENDS", True) depends = "%s u-boot-mkimage-native" % depends d.setVar("DEPENDS", depends) - # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal - # to kernel.bbclass . We override the variable here, since we need - # to build uImage using the kernel build system if and only if - # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into - # the uImage . - if d.getVar("KEEPUIMAGE", True) != 'yes': - d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "zImage") + # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal + # to kernel.bbclass . We override the variable here, since we need + # to build uImage using the kernel build system if and only if + # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into + # the uImage . + if d.getVar("KEEPUIMAGE", True) != 'yes': + typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or "" + if "uImage" in typeformake.split(): + typeformake.replace('uImage', 'zImage') + d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake) } do_uboot_mkimage() { - if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then + if echo "${KERNEL_IMAGETYPES}" | grep -Pq "\buImage\b"; then if test "x${KEEPUIMAGE}" != "xyes" ; then uboot_prep_kimage
meta/classes/kernel.bbclass +120 -51
282 lines not on this page · raw message
meta/conf/documentation.conf +1 -0
@@ -246,6 +246,7 @@ KERNEL_CLASSES[doc] = "A list of classes defining kernel image types that kernel KERNEL_EXTRA_ARGS[doc] = "Specifies additional make command-line arguments the OpenEmbedded build system passes on when compiling the kernel." KERNEL_FEATURES[doc] = "Includes additional metadata from the Yocto Project kernel Git repository. The metadata you add through this variable includes config fragments and features descriptions." KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device, usually set by the machine configuration files and defaults to 'zImage'." +KERNEL_IMAGETYPES[doc] = "The list of types of kernel to build for a device, usually set by the machine configuration files and defaults to KERNEL_IMAGETYPE." KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be auto-loaded during boot" KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build system expects to find module_conf_* values that specify configuration for each of the modules" KERNEL_PATH[doc] = "The location of the kernel sources. This variable is set to the value of the STAGING_KERNEL_DIR within the module class (module.bbclass)."
meta/conf/machine/qemumips.conf +1 -1
@@ -6,7 +6,7 @@ require conf/machine/include/qemu.inc require conf/machine/include/tune-mips32r2.inc KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS1"
meta/conf/machine/qemumips64.conf +1 -1
@@ -6,7 +6,7 @@ require conf/machine/include/qemu.inc require conf/machine/include/tune-mips64.inc KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS1"
meta/recipes-kernel/linux/linux-dtb.inc +30 -19
70 lines not on this page · raw message
scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.conf +1 -1
@@ -9,7 +9,7 @@ require conf/machine/include/tune-mips32.inc MACHINE_FEATURES = "screen keyboard pci usbhost ext2 ext3 serial" KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" KERNEL_IMAGE_STRIP_EXTRA_SECTIONS = ".comment" {{ if kernel_choice == "custom": preferred_kernel = "linux-yocto-custom" }}
scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.conf +1 -1
@@ -9,7 +9,7 @@ require conf/machine/include/tune-mips64.inc MACHINE_FEATURES = "pci ext2 ext3 serial" KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" KERNEL_IMAGE_STRIP_EXTRA_SECTIONS = ".comment" {{ if kernel_choice == "custom": preferred_kernel = "linux-yocto-custom" }}
scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.conf +1 -1
@@ -69,6 +69,6 @@ SERIAL_CONSOLE = "115200 ttyS0" {{ if qemuarch == "mips" or qemuarch == "mips64": }} KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" SERIAL_CONSOLE = "115200 ttyS0" MACHINE_EXTRA_RRECOMMENDS = " kernel-modules"
Signature · 1 line
1.9.1
Re: [PATCH v2 1/2] kernel: Add KERNEL_IMAGETYPES to build multi types kernel at one time
Quoted 8 lines · On Fri, Feb 19, 2016 at 4:56 AM, <[email protected]> wrote:
From: He Zhe <[email protected]>
Add
KERNEL_IMAGETYPESto support building packaging and installing multi types of kernel images, such as zImage uImage, at one time.
KERNEL_IMAGETYPEworks as before. AllKERNEL_ALT_IMAGETYPEsare replaced byKERNEL_IMAGETYPES.
I see that you have updated layers/configs with the new variable, but obviously you can't see all the
layers that may be using that old variable.
Isn't it possible to have a python routine that detects the old ALT_IMAGETYPE variable and
assigns it to the new one (if it isn't already set) ? Sort of like how distro features/features backfill
work ?
Quoted 73 lines
Fixes [YOCTO #6945].
Signed-off-by He Zhe <[email protected]>--- documentation/ref-manual/ref-variables.xml | 10 +- meta-yocto-bsp/conf/machine/edgerouter.conf | 2 +- meta/classes/kernel-fitimage.bbclass | 20 +-- meta/classes/kernel-grub.bbclass | 44 ++++-- meta/classes/kernel-uimage.bbclass | 22 +-- meta/classes/kernel.bbclass | 171 +++++++++++++++------ meta/conf/documentation.conf | 1 + meta/conf/machine/qemumips.conf | 2 +- meta/conf/machine/qemumips64.conf | 2 +- meta/recipes-kernel/linux/linux-dtb.inc | 49 +++--- .../target/arch/mips/conf/machine/machine.conf | 2 +- .../target/arch/mips64/conf/machine/machine.conf | 2 +- .../target/arch/qemu/conf/machine/machine.conf | 2 +- 13 files changed, 214 insertions(+), 115 deletions(-)documentation/ref-manual/ref-variables.xml +0
-0@@ -6417,14 +6417,14 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR= "${INC_PR}.3"
</glossdef> </glossentry>- <glossentry
id='var-KERNEL_ALT_IMAGETYPE'><glossterm>KERNEL_ALT_IMAGETYPE</glossterm>
+ <glossentry
id='var-KERNEL_IMAGETYPES'><glossterm>KERNEL_IMAGETYPES</glossterm><info>- KERNEL_ALT_IMAGETYPE[doc] = "Specifies an alternate
kernel image type for creation."
+ KERNEL_IMAGETYPES[doc] = "Specifies alternate kernel
image types for creation."</info> <glossdef> <para role="glossdeffirst"><!-- <para role="glossdeffirst"><imagedata
fileref="figures/define-generic.png" /> -->
- Specifies an alternate kernel image type for creation
in
+ Specifies alternate kernel image types for creation in
addition to the kernel image type specified using the <link
linkend='var-KERNEL_IMAGETYPE'><filename>KERNEL_IMAGETYPE</filename></link>
variable.documentation/ref-manual/ref-variables.xml +0
-0@@ -6612,8 +6612,8 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR ="${INC_PR}.3"
</para> <para>- If you want to build an alternate kernel image type,
use the
- <link
linkend='var-KERNEL_ALT_IMAGETYPE'><filename>KERNEL_ALT_IMAGETYPE</filename></link>
+ If you want to build alternate kernel image types,
use the
+ <link
linkend='var-KERNEL_IMAGETYPES'><filename>KERNEL_IMAGETYPES</filename></link>variable. </para> </glossdef>meta-yocto-bsp/conf/machine/edgerouter.conf +0
-0
meta-yocto-bsp/conf/machine/edgerouter.conf require conf/machine/include/tune-mips64.inc · line 11
Quoted 6 lines
meta-yocto-bsp/conf/machine/edgerouter.conf +1
-1@@ -7,7 +7,7 @@ require conf/machine/include/tune-mips64.inc MACHINE_FEATURES = "pci ext2 ext3 serial" KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin"
This now reads a bit ... odd (for back of a better description). I'm concerned that it will cause
confusion, there are two variables:
KERNEL_IMAGETYPE and KERNEL_IMAGETYPES ..
They are very close in name, and just reading the variable doesn't really tell us why
we'd set one and not the other. The old "ALT" made it more obvious.
But from the patch, KERNEL_IMAGETYPE isn't used, so does it have to be set at
all in these .conf files ? .. or maybe I missed where it is still used other than for
compatibility.
Quoted 32 lines
meta-yocto-bsp/conf/machine/edgerouter.conf +0
-0KERNEL_IMAGE_STRIP_EXTRA_SECTIONS = ".comment"PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
meta/classes/kernel-fitimage.bbclass +5
-3@@ -1,8 +1,8 @@ inherit kernel-uboot python __anonymous () { - kerneltype = d.getVar('KERNEL_IMAGETYPE', True) - if kerneltype == 'fitImage': + kerneltypes = d.getVar('KERNEL_IMAGETYPES', True) or "" + if 'fitImage' in kerneltypes.split(): depends = d.getVar("DEPENDS", True) depends = "%s u-boot-mkimage-native dtc-native" % depends d.setVar("DEPENDS", depends)@@ -10,7 +10,9 @@ python __anonymous () { # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal # to kernel.bbclass . We have to override it, since we pack zImage # (at least for now) into the fitImage . - d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "zImage") + typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or "" + if 'fitImage' in typeformake.split(): + d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', 'zImage')) image = d.getVar('INITRAMFS_IMAGE', True)if image:
meta/classes/kernel-fitimage.bbclass EOF · line 160
Quoted 6 lines
meta/classes/kernel-fitimage.bbclass +1
-1@@ -154,7 +156,7 @@ EOF } do_assemble_fitimage() { - if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then + if echo ${KERNEL_IMAGETYPES} | grep -Pq "\bfitImage\b"; then
Not that it really matters, but grep -w would work here as well, and might read bit simpler.
Quoted 37 lines
meta/classes/kernel-fitimage.bbclass +0
-0kernelcount=1 dtbcount=""rm -f fit-image.its
meta/classes/kernel-fitimage.bbclass +0
-0@@ -217,14 +219,14 @@ addtask assemble_fitimage before do_install after
do_compile
kernel_do_deploy_append(){
# Update deploy directorymeta/classes/kernel-fitimage.bbclass +3
-3- if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then + if echo ${KERNEL_IMAGETYPES} | grep -Pq "\bfitImage\b"; then cd ${B} echo "Copying fit-image.its source file..." - its_base_name="${KERNEL_IMAGETYPE}-its-${PV}-${PR}-${MACHINE}-${DATETIME}" - its_symlink_name=${KERNEL_IMAGETYPE}-its-${MACHINE} + its_base_name="fitImage-its-${PV}-${PR}-${MACHINE}-${DATETIME}" + its_symlink_name=fitImage-its-${MACHINE} install -m 0644 fit-image.its${DEPLOYDIR}/${its_base_name}.its
meta/classes/kernel-fitimage.bbclass +2
-2- linux_bin_base_name="${KERNEL_IMAGETYPE}-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}" - linux_bin_symlink_name=${KERNEL_IMAGETYPE}-linux.bin-${MACHINE} + linux_bin_base_name="fitImage-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}" + linux_bin_symlink_name=fitImage-linux.bin-${MACHINE} install -m 0644 linux.bin${DEPLOYDIR}/${linux_bin_base_name}.bin
cd ${DEPLOYDIR}meta/classes/kernel-grub.bbclass +0
-0
meta/classes/kernel-grub.bbclass line 14
Quoted 6 lines
meta/classes/kernel-grub.bbclass +1
-1@@ -10,41 +10,44 @@ # updates the new kernel as the boot priority. # -pkg_preinst_kernel-image_append () { +python __anonymous () {
Maybe it is just the patch context making me misread this, but can you elaborate on
what is changing here ?
Is it the old preinst is being replaced by anonymous python that generates the preinst as
a string, and that this injected into the package via the python ? Are we guaranteed
to run the anonymous python at the right time ? .. I've been burned by that before, so
I wanted to check that it has been considered.
Quoted 12 lines
meta/classes/kernel-grub.bbclass +3
-0+ import re + + preinst = ''' # Parsing confliction [ -f "$D/boot/grub/menu.list" ] && grubcfg="$D/boot/grub/menu.list" [ -f "$D/boot/grub/grub.cfg" ] && grubcfg="$D/boot/grub/grub.cfg" if [ -n "$grubcfg" ]; then # Dereference symlink to avoid confliction with new kernelname.
meta/classes/kernel-grub.bbclass +0
-3- if grep -q "/${KERNEL_IMAGETYPE} \+root=" $grubcfg; then - if [ -L "$D/boot/${KERNEL_IMAGETYPE}" ]; then - kimage=`realpath
Quoted 3 lines
$D/boot/${KERNEL_IMAGETYPE} 2>/dev/null`
+ if grep -q "/KERNEL_IMAGETYPE \+root=" $grubcfg; then
It's lines like these that made me ask my question above. This looks like its checking the
grubcfg on disk. Is that same grep going to work in this anonymous python .. or maybe this
isn't being run now, and only when the package is being installed ? I'm most likely missing
something.
Quoted 150 lines
meta/classes/kernel-grub.bbclass +2
-0+ if [ -L "$D/boot/KERNEL_IMAGETYPE" ]; then + kimage=`realpath $D/boot/KERNEL_IMAGETYPE2>/dev/null`
if [ -f "$D$kimage" ]; then- sed -i "s:${KERNEL_IMAGETYPE}
\+root=:${kimage##*/} root=:" $grubcfg
+ sed -i "s:KERNEL_IMAGETYPE
\+root=:${kimage##*/} root=:" $grubcfg
fi
fi
fi# Rename old kernel if it conflicts with new kernel name.
- if grep -q "/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
\+root=" $grubcfg; then
- if [ -f
"$D/boot/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}" ]; then
+ if grep -q "/KERNEL_IMAGETYPE-${KERNEL_VERSION} \+root="
$grubcfg; then
+ if [ -f
"$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}" ]; then
timestamp=date +%smeta/classes/kernel-grub.bbclass +0
-2- kimage="$D/boot/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}-$timestamp-back" - sed -i"s:${KERNEL_IMAGETYPE}-${KERNEL_VERSION} \+root=:${kimage##*/} root=:" $grubcfg
- mv
"$D/boot/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}" "$kimage"meta/classes/kernel-grub.bbclass +2
-0+ kimage="$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}-$timestamp-back" + sed -i"s:KERNEL_IMAGETYPE-${KERNEL_VERSION} \+root=:${kimage##*/} root=:" $grubcfg
+ mv
"$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}" "$kimage"
fi
fi
fimeta/classes/kernel-grub.bbclass +3
-5-} +''' -pkg_postinst_kernel-image_prepend () { + postinst = ''' get_new_grub_cfg() { grubcfg="$1" old_image="$2" - title="Update ${KERNEL_IMAGETYPE}-${KERNEL_VERSION}-${PV}" + title="Update KERNEL_IMAGETYPE-${KERNEL_VERSION}-${PV}" if [ "${grubcfg##*/}" = "grub.cfg" ]; then rootfs=`grep " *linux \+[^ ]\+ \+root=" $grubcfg -m 1 | \ - sed"s#${old_image}#${old_image%/*}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}#"`
+ sed
"s#${old_image}#${old_image%/*}/KERNEL_IMAGETYPE-${KERNEL_VERSION}#"`echo "menuentry \"$title\" {" echo " set root=(hd0,1)"meta/classes/kernel-grub.bbclass +0
-1@@ -52,7 +55,7 @@ pkg_postinst_kernel-image_prepend () { echo "}" elif [ "${grubcfg##*/}" = "menu.list" ]; then rootfs=`grep "kernel \+[^ ]\+ \+root=" $grubcfg -m 1 | \ - sed"s#${old_image}#${old_image%/*}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}#"`
+ sed
"s#${old_image}#${old_image%/*}/KERNEL_IMAGETYPE-${KERNEL_VERSION}#"`echo "default 0"
echo "timeout 30"meta/classes/kernel-grub.bbclass +11
-0@@ -87,5 +90,16 @@ pkg_postinst_kernel-image_prepend () { mv $grubcfgtmp $grubcfg echo "Caution! Update kernel may affect kernel-module!" fi +''' + + imagetypes = d.getVar('KERNEL_IMAGETYPES', True) + imagetypes = re.sub(r'\.gz$', '', imagetypes) + + for type in imagetypes.split(): + typelower = type.lower() + preinst_append = preinst.replace('KERNEL_IMAGETYPE', type) + postinst_prepend = postinst.replace('KERNEL_IMAGETYPE', type) + d.setVar('pkg_preinst_kernel-image-' + typelower + '_append', preinst_append) + d.setVar('pkg_postinst_kernel-image-' + typelower + '_prepend', postinst_prepend)}
meta/classes/kernel-uimage.bbclass +8
-9@@ -1,23 +1,25 @@ inherit kernel-uboot python __anonymous () { - kerneltype = d.getVar('KERNEL_IMAGETYPE', True) - if kerneltype == 'uImage': + if "uImage" in (d.getVar('KERNEL_IMAGETYPES', True) or "").split(): depends = d.getVar("DEPENDS", True) depends = "%s u-boot-mkimage-native" % depends d.setVar("DEPENDS", depends) - # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal - # to kernel.bbclass . We override the variable here, since we need - # to build uImage using the kernel build system if and only if - # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into - # the uImage . - if d.getVar("KEEPUIMAGE", True) != 'yes': - d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "zImage") + # Override KERNEL_IMAGETYPE_FOR_MAKE variable, which is internal + # to kernel.bbclass . We override the variable here, since we need + # to build uImage using the kernel build system if and only if + # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into + # the uImage . + if d.getVar("KEEPUIMAGE", True) != 'yes': + typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True) or""
meta/classes/kernel-uimage.bbclass +4
-1+ if "uImage" in typeformake.split(): + typeformake.replace('uImage', 'zImage') + d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake) } do_uboot_mkimage() { - if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then + if echo "${KERNEL_IMAGETYPES}" | grep -Pq "\buImage\b"; then if test "x${KEEPUIMAGE}" != "xyes" ; then uboot_prep_kimagemeta/classes/kernel.bbclass +9
-0@@ -16,12 +16,48 @@ INITRAMFS_IMAGE ?= "" INITRAMFS_TASK ?= "" INITRAMFS_IMAGE_BUNDLE ?= "" +# KERNEL_VERSION is extracted from source code. It is evaluated as +# None for the first parsing, since the code has not been fetched. +# After the code is fetched, it will be evaluated as real version +# number and cause kernel to be rebuilt. To avoid this, make +# KERNEL_VERSION_NAME and KERNEL_VERSION_PKG_NAME depend on +# LINUX_VERSION which is a constant. +KERNEL_VERSION_NAME = "${@d.getVar('KERNEL_VERSION', True) or ""}" +KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}" +KERNEL_VERSION_PKG_NAME ="${@legitimize_package_name(d.getVar('KERNEL_VERSION', True))}"
meta/classes/kernel.bbclass INITRAMFS_IMAGE ?= "" · line 33
Quoted 7 lines
meta/classes/kernel.bbclass +3
-1+KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}" + python __anonymous () { import re - kerneltype = d.getVar('KERNEL_IMAGETYPE', True) + type = d.getVar('KERNEL_IMAGETYPE', True) or ""
Aha. Here is that use of KERNEL_IMAGETYPE. Like I mentioned for the alt image type, can't
this existing variable be checked, and then added to KERNEL_IMAGE_TYPES in some
python code ? That would simplify the code here, and also not require the two variables to
be kept around.
Quoted 64 lines
meta/classes/kernel.bbclass +15
-0+ types = d.getVar('KERNEL_IMAGETYPES', True) or "" + if type not in types.split(): + types = (type + ' ' + types).strip() + d.setVar('KERNEL_IMAGETYPES', types) + typeformake = re.sub(r'\.gz', '', types) + d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake) + + for type in typeformake.split(): + typelower = type.lower() + + d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower) + + d.setVar('FILES_kernel-image-' + typelower, '/boot/' + type + '*') + + d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' +typelower)
meta/classes/kernel.bbclass +2
-0+ + d.setVar('PKG_kernel-image-' + typelower, 'kernel-image-' +typelower + '-${KERNEL_VERSION_PKG_NAME}')
meta/classes/kernel.bbclass +2
-1+ + d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1') - d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", re.sub(r'\.gz$', '',kerneltype))
meta/classes/kernel.bbclass +3
-0+ imagedest = d.getVar('KERNEL_IMAGEDEST', True) + priority = d.getVar('KERNEL_PRIORITY', True) + postinst = '#!/bin/sh\n' + 'update-alternatives --install /' +imagedest + '/' + type + ' ' + type + ' ' + '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
meta/classes/kernel.bbclass +3
-0+ d.setVar('pkg_postinst_kernel-image-' + typelower, postinst) + + postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' +type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
meta/classes/kernel.bbclass +1
-0+ d.setVar('pkg_postrm_kernel-image-' + typelower, postrm) image = d.getVar('INITRAMFS_IMAGE', True) if image:@@ -92,8 +128,8 @@ KERNEL_PRIORITY ?="${@int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.
KERNEL_RELEASE?= "${KERNEL_VERSION}"meta/classes/kernel.bbclass +2
-4-# Where built kernel lies in the kernel tree -KERNEL_OUTPUT ?= "arch/${ARCH}/boot/${KERNEL_IMAGETYPE}" +# The directory where built kernel lies in the kernel tree +KERNEL_OUTPUT_DIR ?= "arch/${ARCH}/boot" KERNEL_IMAGEDEST = "boot" #@@ -119,8 +155,6 @@ KERNEL_EXTRA_ARGS ?= "" # We don't want to override kernel Makefile variables from the environment EXTRA_OEMAKE = "" -KERNEL_ALT_IMAGETYPE ??= "" - # Define where the kernel headers are installed on the target as well aswhere
# they are staged. KERNEL_SRC_PATH = "/usr/src/kernel"meta/classes/kernel.bbclass +0
-1@@ -166,23 +200,48 @@ copy_initramfs() { echo "Finished copy of initramfs into ./usr" } -INITRAMFS_BASE_NAME =
Quoted 2 lines
"${KERNEL_IMAGETYPE}-initramfs-${PV}-${PR}-${MACHINE}-${DATETIME}" +INITRAMFS_BASE_NAME = "initramfs-${PV}-${PR}-${MACHINE}-${DATETIME}"
INITRAMFS_BASE_NAME[vardepsexclude] = "DATETIME"
Quoted 11 lines
do_bundle_initramfs () { if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" =x1 ]; then
echo "Creating a kernel image with a bundled initramfs..."copy_initramfsmeta/classes/kernel.bbclass +1
-3- if [ -e ${KERNEL_OUTPUT} ] ; then - mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.bak - fi + # Backuping kernel image relies on its type(regular fileor symbolic link)
s/Backuping/Backing up/
Quoted 69 lines
meta/classes/kernel.bbclass +4
-0+ tmp_path="" + for type in ${KERNEL_IMAGETYPES} ; do + if [ -h ${KERNEL_OUTPUT_DIR}/$type ] ; then + linkpath=`readlink -n${KERNEL_OUTPUT_DIR}/$type`
+ realpath=`readlink -fn
${KERNEL_OUTPUT_DIR}/$type`meta/classes/kernel.bbclass +2
-0+ mv -f $realpath $realpath.bak + tmp_path=$tmp_path""$type"#"$linkpath"#"$realpath
meta/classes/kernel.bbclass +2
-0+ elif [ -f ${KERNEL_OUTPUT_DIR}/$type ]; then + mv -f ${KERNEL_OUTPUT_DIR}/$type${KERNEL_OUTPUT_DIR}/$type.bak
meta/classes/kernel.bbclass +3
-0+ tmp_path=$tmp_path" "$type"##" + fi + doneuse_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
kernel_do_compilemeta/classes/kernel.bbclass +12
-2- mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.initramfs - mv -f ${KERNEL_OUTPUT}.bak ${KERNEL_OUTPUT} + # Restoring kernel image + for tp in $tmp_path ; do + type=`echo $tp|cut -d "#" -f 1` + linkpath=`echo $tp|cut -d "#" -f 2` + realpath=`echo $tp|cut -d "#" -f 3` + if [ -n "$realpath" ]; then + mv -f $realpath $realpath.initramfs + mv -f $realpath.bak $realpath + cd ${B}/${KERNEL_OUTPUT_DIR} + ln -sf $linkpath.initramfs + else + mv -f ${KERNEL_OUTPUT_DIR}/$type${KERNEL_OUTPUT_DIR}/$type.initramfs
+ mv -f ${KERNEL_OUTPUT_DIR}/$type.bak
${KERNEL_OUTPUT_DIR}/$typemeta/classes/kernel.bbclass +2
-1+ fi + done # Update install area - echo "There is kernel image bundled with initramfs:${B}/${KERNEL_OUTPUT}.initramfs"
- install -m 0644 ${B}/${KERNEL_OUTPUT}.initramfs
${D}/boot/${KERNEL_IMAGETYPE}-initramfs-${MACHINE}.binmeta/classes/kernel.bbclass +2
-1- echo "${B}/${KERNEL_OUTPUT}.initramfs" + for type in ${KERNEL_IMAGETYPES} ; do + echo "There is kernel image bundled withinitramfs: ${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs"
+ install -m 0644
${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs ${D}/boot/$type-initramfs-${MACHINE}.binmeta/classes/kernel.bbclass +2
-0+ echo "${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs" + done fi }@@ -207,10 +266,15 @@ kernel_do_compile() { copy_initramfsuse_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
fi
-oe_runmake${KERNEL_IMAGETYPE_FOR_MAKE} ${KERNEL_ALT_IMAGETYPE}
CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
- if test "${KERNEL_IMAGETYPE_FOR_MAKE}.gz" = "${KERNEL_IMAGETYPE}";
then
- gzip -9c < "${KERNEL_IMAGETYPE_FOR_MAKE}" >
"${KERNEL_OUTPUT}"meta/classes/kernel.bbclass +1
-1- fi + oe_runmake ${KERNEL_IMAGETYPE_FOR_MAKE} CC="${KERNEL_CC}"
Quoted 2 lines
LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
This is probably something that is worth mentioning in the top of the commit message. You are
building multiple kernel image types, but they are all currently using the same configuration.
If the make invokations were split into separate calls per image type, we could conceivably
extend this to generate and use a separate config int he future.
Quoted 69 lines
meta/classes/kernel.bbclass +4
-0+ for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do + for type in ${KERNEL_IMAGETYPES} ; do + if test "${typeformake}.gz" = "${type}"; then + gzip -9c < "${typeformake}" >"${KERNEL_OUTPUT_DIR}/${type}"
meta/classes/kernel.bbclass +7
-1+ break; + fi + done + done } do_compile_kernelmodules() {@@ -251,7 +315,9 @@ kernel_do_install() { # install -d ${D}/${KERNEL_IMAGEDEST} install -d ${D}/boot - install -m 0644 ${KERNEL_OUTPUT} ${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} + for type in ${KERNEL_IMAGETYPES} ; do + install -m 0644 ${KERNEL_OUTPUT_DIR}/${type} ${D}/${KERNEL_IMAGEDEST}/${type}-${KERNEL_VERSION} + done install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION} install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION}meta/classes/kernel.bbclass +0
-0@@ -365,12 +431,12 @@ EXPORT_FUNCTIONS do_compile do_install do_configure PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-devkernel-modules"
FILES_${PN} = ""
FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order/lib/modules/${KERNEL_VERSION}/modules.builtin"meta/classes/kernel.bbclass +1
-1-FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*" +FILES_kernel-image = "" FILES_kernel-dev = "/boot/System.map* /boot/Module.symvers* /boot/config*${KERNEL_SRC_PATH}
/lib/modules/${KERNEL_VERSION}/build"
FILES_kernel-vmlinux = "/boot/vmlinux*" FILES_kernel-modules = ""
RDEPENDS_kernel= "kernel-base"meta/classes/kernel.bbclass +1
-1-# Allow machines to override this dependency if kernel image files are +# Allow machines to override this dependency if kernel image files are # not wanted in images as standard RDEPENDS_kernel-base ?= "kernel-image" PKG_kernel-image ="kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
meta/classes/kernel.bbclass +0
-2@@ -394,14 +460,6 @@ pkg_postinst_kernel-base () { fi } -pkg_postinst_kernel-image () { - update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}${KERNEL_PRIORITY} || true
meta/classes/kernel.bbclass +0
-4-} - -pkg_postrm_kernel-image () { - update-alternatives --remove ${KERNEL_IMAGETYPE}${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
meta/classes/kernel.bbclass +0
-4-} - PACKAGESPLITFUNCS_prepend = "split_kernel_packages " python split_kernel_packages () {@@ -422,13 +480,13 @@ do_kernel_link_vmlinux() { do_strip() { if [ -n "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}" ]; then - if [ "${KERNEL_IMAGETYPE}" != "vmlinux" ]; then - bbwarn "image type will not be stripped (not
Quoted 4 lines
supported): ${KERNEL_IMAGETYPE}"
+ if ! (echo "${KERNEL_IMAGETYPES}" | grep -q "vmlinux");
then
You had used the \bfitImage\b, but here you don't .. grep -w could work for them all.
Quoted 3 lines
+ bbwarn "image type(s) will not be stripped (not
supported): ${KERNEL_IMAGETYPES}"
But on another note. Is it really right to say that none of the images will be stripped if you
find vmlinux anywhere in the image type list ?
Quoted 37 lines
return fi cd ${B}meta/classes/kernel.bbclass +1
-1- headers=`"$CROSS_COMPILE"readelf -S ${KERNEL_OUTPUT} | \ + headers=`"$CROSS_COMPILE"readelf -S${KERNEL_OUTPUT_DIR}/vmlinux | \ grep "^ \{1,\}\[[0-9 ]\{1,\}\] [^ ]" | \ sed "s/^ \{1,\}\[[0-9 ]\{1,\}\] //" | \ gawk '{print $1}'`meta/classes/kernel.bbclass +1
-1@@ -438,7 +496,7 @@ do_strip() { bbwarn "Section not found: $str"; fi - "$CROSS_COMPILE"strip -s -R $str ${KERNEL_OUTPUT} + "$CROSS_COMPILE"strip -s -R $str${KERNEL_OUTPUT_DIR}/vmlinux
}; donebbnote "
KERNEL_IMAGE_STRIP_EXTRA_SECTIONSis set,
stripping sections:" \meta/classes/kernel.bbclass +0
-0@@ -457,20 +515,22 @@ do_sizecheck() { if [ -n "$invalid" ]; then die "Invalid KERNEL_IMAGE_MAXSIZE:${KERNEL_IMAGE_MAXSIZE}, should be an integerx (The unit is Kbytes)"
fimeta/classes/kernel.bbclass +0
-3- size=`du -ks ${B}/${KERNEL_OUTPUT} | awk '{ print $1}'` - if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then - die "This kernel (size=$size(K) >${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device. Please reduce the size of the kernel by making more of it modular."
meta/classes/kernel.bbclass +2
-1- fi + for type in ${KERNEL_IMAGETYPES} ; do + size=`du -ks ${B}/${KERNEL_OUTPUT_DIR}/$type | awk'{print $1}'`
meta/classes/kernel.bbclass +2
-0+ if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then + die "This kernel $type (size=$size(K) >
Quoted 3 lines
${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device. Please reduce the size of the kernel by making more of it modular."
Hmm. Again here. Multiple image types are being built. If one of them is too large for the device,
who's to say that that's the one that is going to be used ? Maybe this should be a warn, instead
of a die ?
Quoted 153 lines
meta/classes/kernel.bbclass +2
-1+ fi + done fi } do_sizecheck[dirs] = "${B}" addtask sizecheck before do_install after do_strip -KERNEL_IMAGE_BASE_NAME ?="${KERNEL_IMAGETYPE}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
meta/classes/kernel.bbclass +2
-1+KERNEL_IMAGE_BASE_NAME ?= "${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}" # Don't include the DATETIME variable in the sstate package signatures KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME" -KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}" +KERNEL_IMAGE_SYMLINK_NAME ?= "${MACHINE}" MODULE_IMAGE_BASE_NAME ?="modules-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
MODULE_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"MODULE_TARBALL_BASE_NAME?= "${MODULE_IMAGE_BASE_NAME}.tgz"meta/classes/kernel.bbclass +0
-0@@ -479,28 +539,37 @@ MODULE_TARBALL_SYMLINK_NAME ?="modules-${MACHINE}.tgz"
MODULE_TARBALL_DEPLOY?= "1"
kernel_do_deploy(){
- install -m 0644 ${KERNEL_OUTPUT}
${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.binmeta/classes/kernel.bbclass +3
-0+ for type in ${KERNEL_IMAGETYPES} ; do + base_name=${type}-${KERNEL_IMAGE_BASE_NAME} + install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}${DEPLOYDIR}/${base_name}.bin
+ doneif [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then mkdir -p ${D}/lib tar -cvzf ${DEPLOYDIR}/${MODULE_TARBALL_BASE_NAME} -C ${D} lib ln -sf ${MODULE_TARBALL_BASE_NAME}${DEPLOYDIR}/${MODULE_TARBALL_SYMLINK_NAME}
fi- ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin
${DEPLOYDIR}/${KERNEL_IMAGE_SYMLINK_NAME}.bin
- ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin
${DEPLOYDIR}/${KERNEL_IMAGETYPE}meta/classes/kernel.bbclass +6
-0+ for type in ${KERNEL_IMAGETYPES} ; do + base_name=${type}-${KERNEL_IMAGE_BASE_NAME} + symlink_name=${type}-${KERNEL_IMAGE_SYMLINK_NAME} + ln -sf ${base_name}.bin ${DEPLOYDIR}/${symlink_name}.bin + ln -sf ${base_name}.bin ${DEPLOYDIR}/${type} + done cp ${COREBASE}/meta/files/deploydir_readme.txt
${DEPLOYDIR}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txtcd ${B}
# Update deploy directorymeta/classes/kernel.bbclass +0
-2- if [ -e "${KERNEL_OUTPUT}.initramfs" ]; then - echo "Copying deploy kernel-initramfs image and setting uplinks..."
meta/classes/kernel.bbclass +0
-3- initramfs_base_name=${INITRAMFS_BASE_NAME} - initramfs_symlink_name=${KERNEL_IMAGETYPE}-initramfs-${MACHINE} - install -m 0644 ${KERNEL_OUTPUT}.initramfs${DEPLOYDIR}/${initramfs_base_name}.bin
meta/classes/kernel.bbclass +0
-2- cd ${DEPLOYDIR} - ln -sf ${initramfs_base_name}.bin${initramfs_symlink_name}.bin
meta/classes/kernel.bbclass +3
-1- fi + for type in ${KERNEL_IMAGETYPES} ; do + if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then + echo "Copying deploy ${type} kernel-initramfsimage and setting up links..."
meta/classes/kernel.bbclass +3
-0+ initramfs_base_name=${type}-${INITRAMFS_BASE_NAME} + initramfs_symlink_name=${type}-initramfs-${MACHINE} + install -m 0644${KERNEL_OUTPUT_DIR}/${type}.initramfs
${DEPLOYDIR}/${initramfs_base_name}.binmeta/classes/kernel.bbclass +2
-0+ cd ${DEPLOYDIR} + ln -sf ${initramfs_base_name}.bin${initramfs_symlink_name}.bin
meta/classes/kernel.bbclass +2
-0+ fi + done } do_deploy[cleandirs] = "${DEPLOYDIR}" do_deploy[dirs] = "${DEPLOYDIR} ${B}"meta/conf/documentation.conf +0
-0@@ -246,6 +246,7 @@ KERNEL_CLASSES[doc] = "A list of classes definingkernel image types that kernel
KERNEL_EXTRA_ARGS[doc] = "Specifies additional make command-line
arguments the OpenEmbedded build system passes on when compiling the kernel."
KERNEL_FEATURES[doc] = "Includes additional metadata from the Yocto
Project kernel Git repository. The metadata you add through this variable includes config fragments and features descriptions."
KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device,
usually set by the machine configuration files and defaults to 'zImage'." +KERNEL_IMAGETYPES[doc] = "The list of types of kernel to build for a device, usually set by the machine configuration files and defaults toKERNEL_IMAGETYPE."
KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be
auto-loaded during boot"
KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build
system expects to find module_conf_* values that specify configuration for each of the modules"
KERNEL_PATH[doc] = "The location of the kernel sources. This variable is
set to the value of theSTAGING_KERNEL_DIRwithin the module class (module.bbclass)."meta/conf/machine/qemumips.conf +1
-1@@ -6,7 +6,7 @@ require conf/machine/include/qemu.inc require conf/machine/include/tune-mips32r2.inc KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS1"meta/conf/machine/qemumips64.conf +1
-1@@ -6,7 +6,7 @@ require conf/machine/include/qemu.inc require conf/machine/include/tune-mips64.inc KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS1"meta/recipes-kernel/linux/linux-dtb.inc +0
-1@@ -34,9 +34,12 @@ do_install_append() { for DTB in ${KERNEL_DEVICETREE}; do DTB=`normalize_dtb "${DTB}"` DTB_BASE_NAME=`basename ${DTB} .dtb` - DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed"s/${MACHINE}/${DTB_BASE_NAME}/g"`
meta/recipes-kernel/linux/linux-dtb.inc +0
-2- DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"` - install -m 0644 ${DTB_PATH}${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
meta/recipes-kernel/linux/linux-dtb.inc
Quoted 2 lines
meta/recipes-kernel/linux/linux-dtb.inc +2
-0+ for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do + symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
If there are multiple image types being built, is this valid for them all ?
Quoted 108 lines
+ DTB_SYMLINK_NAME=`echo ${symlink_name} | sed
"s/${MACHINE}/${DTB_BASE_NAME}/g"`meta/recipes-kernel/linux/linux-dtb.inc +2
-0+ DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"` + install -m 0644 ${DTB_PATH}${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
meta/recipes-kernel/linux/linux-dtb.inc +1
-1+ done done }@@ -44,31 +47,39 @@ do_deploy_append() { for DTB in ${KERNEL_DEVICETREE}; do DTB=`normalize_dtb "${DTB}"` DTB_BASE_NAME=`basename ${DTB} .dtb` - DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed"s/${MACHINE}/${DTB_BASE_NAME}/g"`
- DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed
"s/${MACHINE}/${DTB_BASE_NAME}/g"`meta/recipes-kernel/linux/linux-dtb.inc +4
-4- DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"` - install -d ${DEPLOYDIR} - install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.dtb - ln -sf ${DTB_NAME}.dtb ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.dtb + for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do + base_name=${type}"-"${KERNEL_IMAGE_BASE_NAME} + symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME} + DTB_NAME=`echo ${base_name} | sed"s/${MACHINE}/${DTB_BASE_NAME}/g"`
+ DTB_SYMLINK_NAME=`echo ${symlink_name} | sed
"s/${MACHINE}/${DTB_BASE_NAME}/g"`meta/recipes-kernel/linux/linux-dtb.inc +3
-0+ DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"` + install -d ${DEPLOYDIR} + install -m 0644 ${DTB_PATH}${DEPLOYDIR}/${DTB_NAME}.dtb
+ ln -sf ${DTB_NAME}.dtb
${DEPLOYDIR}/${DTB_SYMLINK_NAME}.dtbmeta/recipes-kernel/linux/linux-dtb.inc +1
-4+ done done } pkg_postinst_kernel-devicetree () { cd /${KERNEL_IMAGEDEST} - for DTB in ${KERNEL_DEVICETREE} - do - DTB_BASE_NAME=`basename ${DTB} | awk -F "." '{print $1}'` - DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed"s/${MACHINE}/${DTB_BASE_NAME}/g"`
- update-alternatives --install
/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb/boot/devicetree-${DTB_SYMLINK_NAME}.dtb${KERNEL_PRIORITY} || truemeta/recipes-kernel/linux/linux-dtb.inc +4
-0+ for DTB in ${KERNEL_DEVICETREE}; do + for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do + symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME} + DTB_BASE_NAME=`basename ${DTB} | awk -F "."'{print $1}'`
+ DTB_SYMLINK_NAME=`echo ${symlink_name} | sed
"s/${MACHINE}/${DTB_BASE_NAME}/g"`
+ update-alternatives --install
/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb/boot/devicetree-${DTB_SYMLINK_NAME}.dtb${KERNEL_PRIORITY} || truemeta/recipes-kernel/linux/linux-dtb.inc +1
-4+ done done } pkg_postrm_kernel-devicetree () { cd /${KERNEL_IMAGEDEST} - for DTB in ${KERNEL_DEVICETREE} - do - DTB_BASE_NAME=`basename ${DTB} | awk -F "." '{print $1}'` - DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed"s/${MACHINE}/${DTB_BASE_NAME}/g"`
- update-alternatives --remove ${DTB_BASE_NAME}.dtb/boot/devicetree-${DTB_SYMLINK_NAME}.dtb${KERNEL_PRIORITY} || truemeta/recipes-kernel/linux/linux-dtb.inc +4
-0+ for DTB in ${KERNEL_DEVICETREE}; do + for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do + symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME} + DTB_BASE_NAME=`basename ${DTB} | awk -F "."'{print $1}'`
+ DTB_SYMLINK_NAME=`echo ${symlink_name} | sed
"s/${MACHINE}/${DTB_BASE_NAME}/g"`
+ update-alternatives --remove ${DTB_BASE_NAME}.dtb/boot/devicetree-${DTB_SYMLINK_NAME}.dtb${KERNEL_PRIORITY} || true
+ done
done
}
diff --gita/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.confb/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.confindex b319d62..e4a6f30 100644scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.conf +1
-1@@ -9,7 +9,7 @@ require conf/machine/include/tune-mips32.inc MACHINE_FEATURES = "screen keyboard pci usbhost ext2 ext3 serial" KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" KERNEL_IMAGE_STRIP_EXTRA_SECTIONS = ".comment" {{ if kernel_choice == "custom": preferred_kernel = "linux-yocto-custom"}}
diff --gita/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.confb/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.confindex 3afc5e0..2c2d8af 100644
---a/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.conf
+++b/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.conf
scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.conf require conf/machine/include/tune-mips64.inc · line 13
Quoted 6 lines
scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.conf +1
-1@@ -9,7 +9,7 @@ require conf/machine/include/tune-mips64.inc MACHINE_FEATURES = "pci ext2 ext3 serial" KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin"
Again, why can't vmlinux just bein in KERNEL_IMAGETYPES ?
Bruce
Quoted 27 lines
scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.conf +0
-0KERNEL_IMAGE_STRIP_EXTRA_SECTIONS = ".comment"{{ if
kernel_choice== "custom":preferred_kernel= "linux-yocto-custom"
}}
diff --gita/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.confb/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.confindex 67e1cbd..7a0a4d3 100644scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.conf +1
-2@@ -69,6 +69,6 @@ SERIAL_CONSOLE = "115200 ttyS0" {{ if qemuarch == "mips" or qemuarch == "mips64": }} KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" SERIAL_CONSOLE = "115200 ttyS0" MACHINE_EXTRA_RRECOMMENDS = " kernel-modules" --1.9.1
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
Re: [PATCH v2 1/2] kernel: Add KERNEL_IMAGETYPES to build multi types kernel at one time
Quoted 14 lines · Bruce Ashfield
On Fri, Feb 19, 2016 at 4:56 AM, <[email protected] <mailto:[email protected]>>wrote:
From: He Zhe <[email protected] <mailto:[email protected]>>
Add
KERNEL_IMAGETYPESto support building packaging and installing multi types of kernel images, such as zImage uImage, at one time.
KERNEL_IMAGETYPEworks as before. AllKERNEL_ALT_IMAGETYPEsare replaced byKERNEL_IMAGETYPES.
Quoted 7 lines
I see that you have updated layers/configs with the new variable, but obviously you can't see all the layers that may be using that old variable.
Isn't it possible to have a python routine that detects the old
ALT_IMAGETYPEvariable and assigns it to the new one (if it isn't already set) ? Sort of like how distro features/features backfill work ?
Thanks for careful review.
OK. I'll try to add such function.
Quoted 65 lines
Fixes [YOCTO #6945].
Signed-off-by He Zhe <[email protected] <mailto:[email protected]>>---
documentation/ref-manual/ref-variables.xml| 10 +-
meta-yocto-bsp/conf/machine/edgerouter.conf| 2 +-
meta/classes/kernel-fitimage.bbclass | 20 +--
meta/classes/kernel-grub.bbclass | 44 ++++--
meta/classes/kernel-uimage.bbclass | 22 +--
meta/classes/kernel.bbclass | 171 +++++++++++++++------
meta/conf/documentation.conf| 1 +
meta/conf/machine/qemumips.conf| 2 +-
meta/conf/machine/qemumips64.conf| 2 +-
meta/recipes-kernel/linux/linux-dtb.inc | 49 +++---
.../target/arch/mips/conf/machine/machine.conf| 2 +-
.../target/arch/mips64/conf/machine/machine.conf| 2 +-
.../target/arch/qemu/conf/machine/machine.conf| 2 +-
13 files changed, 214 insertions(+), 115 deletions(-)diff --git
a/documentation/ref-manual/ref-variables.xmlb/documentation/ref-manual/ref-variables.xmlindex a76a8c2..a8e4fd8 100644
---a/documentation/ref-manual/ref-variables.xml
+++b/documentation/ref-manual/ref-variables.xml
@@ -6417,14 +6417,14 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3"
</glossdef>
</glossentry>- <glossentry id='var-KERNEL_ALT_IMAGETYPE'><glossterm>KERNEL_ALT_IMAGETYPE</glossterm>
+ <glossentry id='var-KERNEL_IMAGETYPES'><glossterm>KERNEL_IMAGETYPES</glossterm>
<info>
- KERNEL_ALT_IMAGETYPE[doc] = "Specifies an alternate kernel image type for creation."
+ KERNEL_IMAGETYPES[doc] = "Specifies alternate kernel image types for creation."
</info>
<glossdef>
<para role="glossdeffirst">
<!-- <para role="glossdeffirst"><imagedata fileref="figures/define-generic.png" /> -->
- Specifies an alternate kernel image type for creation in
+ Specifies alternate kernel image types for creation in
addition to the kernel image type specified using the
<link linkend='var-KERNEL_IMAGETYPE'><filename>KERNEL_IMAGETYPE</filename></link> variable.
@@ -6612,8 +6612,8 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3"
</para><para>
- If you want to build an alternate kernel image type, use the
- <link linkend='var-KERNEL_ALT_IMAGETYPE'><filename>KERNEL_ALT_IMAGETYPE</filename></link>
+ If you want to build alternate kernel image types, use the
+ <link linkend='var-KERNEL_IMAGETYPES'><filename>KERNEL_IMAGETYPES</filename></link>
variable.
</para>
</glossdef>
diff --gita/meta-yocto-bsp/conf/machine/edgerouter.confb/meta-yocto-bsp/conf/machine/edgerouter.confindex 476e690..affd568 100644
---a/meta-yocto-bsp/conf/machine/edgerouter.conf
+++b/meta-yocto-bsp/conf/machine/edgerouter.conf
@@ -7,7 +7,7 @@ require conf/machine/include/tune-mips64.inc
MACHINE_FEATURES= "pci ext2 ext3 serial"
KERNEL_IMAGETYPE= "vmlinux"
-KERNEL_ALT_IMAGETYPE = "vmlinux.bin"
+KERNEL_IMAGETYPES = "vmlinux.bin"
Quoted 8 lines
This now reads a bit ... odd (for back of a better description). I'm concerned that it will cause confusion, there are two variables:
KERNEL_IMAGETYPEandKERNEL_IMAGETYPES..They are very close in name, and just reading the variable doesn't really tell us why we'd set one and not the other. The old "ALT" made it more obvious.
But changing original KERNEL_ALT_IMAGETYPE to a list or using KERNEL_ALT_IMAGETYPES in addition to KERNEL_ALT_IMAGETYPE also seems not very clear. Below is the previous talk with Richard Purdie and Christopher Larson.
Quoted 16 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Question, why not add
KERNEL_IMAGETYPES, and makeKERNEL_IMAGETYPEequal to your new KERNEL_IMAGETYPE_0?(Christopher)Adding a new
KERNEL_IMAGETYPESwill also work. But it should be better(me) not to change the name ofKERNEL_IMAGETYPE, so that those who have used it don't have to change their code.Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Thank you for reviewing.
I have to agree with Chris here, keeping
KERNEL_IMAGETYPEas used today(Richard) and equivalent toKERNEL_IMAGETYPE_0and addingKERNEL_IMAGETYPESdoes seem like a cleaner way to implement this.But it might mean we are going to check both
KERNEL_IMAGETYPEandKERNEL_IMAGETYPES(me)to generate final image type list. Is that OK?Well, in some places you will use one and in some places you'll use the(Richard) other, that is unavoidable.
Quoted 9 lines
I much prefer "
KERNEL_IMAGETYPEandKERNEL_IMAGETYPES" to "KERNEL_IMAGETYPE_0andKERNEL_IMAGETYPE" as variable names though.Cheers,
But from the patch,
KERNEL_IMAGETYPEisn't used, so does it have to be set at all in these .conf files ? .. or maybe I missed where it is still used other than for compatibility.
Not every KERNEL_IMAGETYPE should be replaced by KERNEL_IMAGETYPES. Only one type of kernel image is necessary for below cases.Right?
Yes, more explanations should be added to commit message and code comments.
1) boot fs image
meta/classes/bootimg.bbclass:50:KERNEL_IMAGETYPE ??= "bzImage"
meta/classes/bootimg.bbclass:72: install -m 0644 ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ${DEST}/vmlinuz
meta/classes/image_types.bbclass:109:ELF_KERNEL ?= "${STAGING_DIR_HOST}/usr/src/kernel/${KERNEL_IMAGETYPE}"
2) test fs imagemeta/lib/oeqa/controllers/masterimage.py:55: self.kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("KERNEL_IMAGETYPE", False) + '-' + d.getVar('MACHINE', False) + '.bin')meta/lib/oeqa/targetcontrol.py:126: self.kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("KERNEL_IMAGETYPE", False) + '-' + d.getVar('MACHINE', False) + '.bin')
Quoted 32 lines
KERNEL_IMAGE_STRIP_EXTRA_SECTIONS= ".comment"PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
diff --git a/meta/classes/kernel-fitimage.bbclass b/meta/classes/kernel-fitimage.bbclass index f1b409c..51df19d 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -1,8 +1,8 @@
inherit kernel-ubootpython
__anonymous() {
- kerneltype =d.getVar('KERNEL_IMAGETYPE', True)
- if kerneltype == 'fitImage':
+ kerneltypes =d.getVar('KERNEL_IMAGETYPES', True)or ""
+ if 'fitImage' inkerneltypes.split():
depends =d.getVar("DEPENDS", True)
depends = "%s u-boot-mkimage-native dtc-native" % dependsd.setVar("DEPENDS", depends)
@@ -10,7 +10,9 @@ python__anonymous() {
# OverrideKERNEL_IMAGETYPE_FOR_MAKEvariable, which is internal # to kernel.bbclass . We have to override it, since we pack zImage # (at least for now) into the fitImage .
-d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "zImage")
+ typeformake =d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True)or ""
+ if 'fitImage' intypeformake.split():
+d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake.replace('fitImage', 'zImage'))image =
d.getVar('INITRAMFS_IMAGE', True)if image:
@@ -154,7 +156,7 @@ EOF
}
Quoted 6 lines
do_assemble_fitimage(){
- if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then
+ if echo ${KERNEL_IMAGETYPES} | grep -Pq "\bfitImage\b"; thenNot that it really matters, but grep -w would work here as well, and might read bit simpler.
OK. I'll replace it with "-w"
Quoted 33 lines
kernelcount=1
dtbcount=""
rm -f fit-image.its
@@ -217,14 +219,14 @@ addtaskassemble_fitimagebeforedo_installafterdo_compile
kernel_do_deploy_append(){
# Update deploy directory
- if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then
+ if echo ${KERNEL_IMAGETYPES} | grep -Pq "\bfitImage\b"; then
cd ${B}
echo "Copying fit-image.its source file..."
- its_base_name="${KERNEL_IMAGETYPE}-its-${PV}-${PR}-${MACHINE}-${DATETIME}"
- its_symlink_name=${KERNEL_IMAGETYPE}-its-${MACHINE}
+ its_base_name="fitImage-its-${PV}-${PR}-${MACHINE}-${DATETIME}"
+ its_symlink_name=fitImage-its-${MACHINE}
install -m 0644 fit-image.its ${DEPLOYDIR}/${its_base_name}.its
- linux_bin_base_name="${KERNEL_IMAGETYPE}-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}"
- linux_bin_symlink_name=${KERNEL_IMAGETYPE}-linux.bin-${MACHINE}
+ linux_bin_base_name="fitImage-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}"
+ linux_bin_symlink_name=fitImage-linux.bin-${MACHINE}
install -m 0644 linux.bin ${DEPLOYDIR}/${linux_bin_base_name}.bincd ${DEPLOYDIR}
diff --git a/meta/classes/kernel-grub.bbclass b/meta/classes/kernel-grub.bbclass index a63f482..f7dcc07 100644
--- a/meta/classes/kernel-grub.bbclass
+++ b/meta/classes/kernel-grub.bbclass
@@ -10,41 +10,44 @@
# updates the new kernel as the boot priority.
#
Quoted 7 lines
-pkg_preinst_kernel-image_append () {
+python__anonymous() {Maybe it is just the patch context making me misread this, but can you elaborate on what is changing here ?
Here I change the two variables, pkg_preinst_kernel-image_append and pkg_postinst_kernel-image_prepend to two strings, and change all "${KERNEL_IMAGETYPE}" in the strings to "KERNEL_IMAGETYPE" to avoid being expanded in parsing time. So that I can replace KERNEL_IMAGETYPEs to every single image type in the following loops, in which the two original variables' name are constructed and their values are set.
According to bitbake user manual, __anonymous functions are executed during parsing. It should be OK for the following references. I've verified this by building an image with kernel-grub.bbclass.
Quoted 20 lines
Is it the old preinst is being replaced by anonymous python that generates the preinst as a string, and that this injected into the package via the python ? Are we guaranteed to run the anonymous python at the right time ? .. I've been burned by that before, so I wanted to check that it has been considered.
+ import re
+
+ preinst = '''
# Parsing confliction
[ -f "$D/boot/grub/menu.list" ] && grubcfg="$D/boot/grub/menu.list" [ -f "$D/boot/grub/grub.cfg" ] && grubcfg="$D/boot/grub/grub.cfg" if [ -n "$grubcfg" ]; then
# Dereference symlink to avoid confliction with new kernel name.
- if grep -q "/${KERNEL_IMAGETYPE} \+root=" $grubcfg; then
- if [ -L "$D/boot/${KERNEL_IMAGETYPE}" ]; then
- kimage=realpath $D/boot/${KERNEL_IMAGETYPE} 2>/dev/null
+ if grep -q "/KERNEL_IMAGETYPE \+root=" $grubcfg; then
Quoted 4 lines
It's lines like these that made me ask my question above. This looks like its checking the grubcfg on disk. Is that same grep going to work in this anonymous python .. or maybe this isn't being run now, and only when the package is being installed ? I'm most likely missing something.
No, it's not running, it's in the middle of the string.
Quoted 131 lines
+ if [ -L "$D/boot/KERNEL_IMAGETYPE" ]; then
+ kimage=realpath $D/boot/KERNEL_IMAGETYPE 2>/dev/null
if [ -f "$D$kimage" ]; then
- sed -i "s:${KERNEL_IMAGETYPE} \+root=:${kimage##*/} root=:" $grubcfg
+ sed -i "s:KERNEL_IMAGETYPE \+root=:${kimage##*/} root=:" $grubcfg
fi
fi
fi# Rename old kernel if it conflicts with new kernel name.
- if grep -q "/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} \+root=" $grubcfg; then
- if [ -f "$D/boot/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}" ]; then
+ if grep -q "/KERNEL_IMAGETYPE-${KERNEL_VERSION} \+root=" $grubcfg; then
+ if [ -f "$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}" ]; then
timestamp=date +%s
- kimage="$D/boot/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}-$timestamp-back"
- sed -i "s:${KERNEL_IMAGETYPE}-${KERNEL_VERSION} \+root=:${kimage##*/} root=:" $grubcfg
- mv "$D/boot/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}" "$kimage"
+ kimage="$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}-$timestamp-back"
+ sed -i "s:KERNEL_IMAGETYPE-${KERNEL_VERSION} \+root=:${kimage##*/} root=:" $grubcfg
+ mv "$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}" "$kimage"
fi
fi
fi
-}
+'''-pkg_postinst_kernel-image_prepend () {
+ postinst = '''
get_new_grub_cfg(){
grubcfg="$1"
old_image="$2"
- title="Update ${KERNEL_IMAGETYPE}-${KERNEL_VERSION}-${PV}"
+ title="Update KERNEL_IMAGETYPE-${KERNEL_VERSION}-${PV}"
if [ "${grubcfg##*/}" = "grub.cfg" ]; then
rootfs=`grep " *linux \+[^ ]\+ \+root=" $grubcfg -m 1 | \
- sed "s#${old_image}#${old_image%/*}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}#"`
+ sed "s#${old_image}#${old_image%/*}/KERNEL_IMAGETYPE-${KERNEL_VERSION}#"`echo "menuentry \"$title\" {"
echo " set root=(hd0,1)"
@@ -52,7 +55,7 @@ pkg_postinst_kernel-image_prepend () {
echo "}"
elif [ "${grubcfg##*/}" = "menu.list" ]; then
rootfs=`grep "kernel \+[^ ]\+ \+root=" $grubcfg -m 1 | \
- sed "s#${old_image}#${old_image%/*}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}#"`
+ sed "s#${old_image}#${old_image%/*}/KERNEL_IMAGETYPE-${KERNEL_VERSION}#"`echo "default 0"
echo "timeout 30"
@@ -87,5 +90,16 @@ pkg_postinst_kernel-image_prepend () {
mv $grubcfgtmp $grubcfg
echo "Caution! Update kernel may affect kernel-module!"
fi
+'''
+
+ imagetypes =d.getVar('KERNEL_IMAGETYPES', True)
+ imagetypes =re.sub(r'\.gz$', '', imagetypes)
+
+ for type inimagetypes.split():
+ typelower =type.lower()
+preinst_append=preinst.replace('KERNEL_IMAGETYPE', type)
+postinst_prepend=postinst.replace('KERNEL_IMAGETYPE', type)
+d.setVar('pkg_preinst_kernel-image-' + typelower + '_append', preinst_append)
+d.setVar('pkg_postinst_kernel-image-' + typelower + '_prepend', postinst_prepend)
}diff --git a/meta/classes/kernel-uimage.bbclass b/meta/classes/kernel-uimage.bbclass index f73965b..a238ce4 100644
--- a/meta/classes/kernel-uimage.bbclass
+++ b/meta/classes/kernel-uimage.bbclass
@@ -1,23 +1,25 @@
inherit kernel-ubootpython
__anonymous() {
- kerneltype =d.getVar('KERNEL_IMAGETYPE', True)
- if kerneltype == 'uImage':
+ if "uImage" in (d.getVar('KERNEL_IMAGETYPES', True)or "").split():
depends =d.getVar("DEPENDS", True)depends = "%s u-boot-mkimage-native" % dependsd.setVar("DEPENDS", depends)- # Override
KERNEL_IMAGETYPE_FOR_MAKEvariable, which is internal
- # to kernel.bbclass . We override the variable here, since we need
- # to build uImage using the kernel build system if and only if
- # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into
- # the uImage .
- ifd.getVar("KEEPUIMAGE", True)!= 'yes':
-d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "zImage")
+ # OverrideKERNEL_IMAGETYPE_FOR_MAKEvariable, which is internal
+ # to kernel.bbclass . We override the variable here, since we need
+ # to build uImage using the kernel build system if and only if
+ # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux into
+ # the uImage .
+ ifd.getVar("KEEPUIMAGE", True)!= 'yes':
+ typeformake =d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True)or ""
+ if "uImage" intypeformake.split():
+typeformake.replace('uImage', 'zImage')
+d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)
}
do_uboot_mkimage(){
- if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
+ if echo "${KERNEL_IMAGETYPES}" | grep -Pq "\buImage\b"; then
if test "x${KEEPUIMAGE}" != "xyes" ; then
uboot_prep_kimagediff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index c3eab50..6db2e2e 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -16,12 +16,48 @@INITRAMFS_IMAGE?= ""
INITRAMFS_TASK?= ""
INITRAMFS_IMAGE_BUNDLE?= ""+#
KERNEL_VERSIONis extracted from source code. It is evaluated as
+# None for the first parsing, since the code has not been fetched.
+# After the code is fetched, it will be evaluated as real version
+# number and cause kernel to be rebuilt. To avoid this, make
+#KERNEL_VERSION_NAMEandKERNEL_VERSION_PKG_NAMEdepend on
+#LINUX_VERSIONwhich is a constant.
+KERNEL_VERSION_NAME = "${@d.getVar('KERNEL_VERSION', True) or ""}" +KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}" +KERNEL_VERSION_PKG_NAME = "${@legitimize_package_name(d.getVar('KERNEL_VERSION', True))}" +KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}"
+
python__anonymous() {
import re
Quoted 8 lines
- kerneltype =
d.getVar('KERNEL_IMAGETYPE', True)
+ type =d.getVar('KERNEL_IMAGETYPE', True)or ""Aha. Here is that use of
KERNEL_IMAGETYPE. Like I mentioned for the alt image type, can't this existing variable be checked, and then added toKERNEL_IMAGE_TYPESin some python code ? That would simplify the code here, and also not require the two variables to be kept around.
See above for explanation for KERNEL_IMAGETYPES.
Quoted 71 lines
+ types =
d.getVar('KERNEL_IMAGETYPES', True)or ""
+ if type not intypes.split():
+ types = (type + ' ' + types).strip()
+d.setVar('KERNEL_IMAGETYPES', types)
+ typeformake =re.sub(r'\.gz', '', types)
+d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)
+
+ for type intypeformake.split():
+ typelower =type.lower()
+
+d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower)
+
+d.setVar('FILES_kernel-image-' + typelower, '/boot/' + type + '*')
+
+d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-' + typelower)
+
+d.setVar('PKG_kernel-image-' + typelower, 'kernel-image-' + typelower + '-${KERNEL_VERSION_PKG_NAME}')
+
+d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')-
d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", re.sub(r'\.gz$', '', kerneltype))
+ imagedest =d.getVar('KERNEL_IMAGEDEST', True)
+ priority =d.getVar('KERNEL_PRIORITY', True)
+ postinst = '#!/bin/sh\n' + 'update-alternatives --install /' + imagedest + '/' + type + ' ' + type + ' ' + '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
+d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
+
+ postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + ' ' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
+d.setVar('pkg_postrm_kernel-image-' + typelower, postrm)image =
d.getVar('INITRAMFS_IMAGE', True)
if image:
@@ -92,8 +128,8 @@KERNEL_PRIORITY?= "${@int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.
KERNEL_RELEASE?= "${KERNEL_VERSION}"-# Where built kernel lies in the kernel tree -KERNEL_OUTPUT ?= "
arch/${ARCH}/boot/${KERNEL_IMAGETYPE}" +# The directory where built kernel lies in the kernel tree +KERNEL_OUTPUT_DIR ?= "arch/${ARCH}/boot"
KERNEL_IMAGEDEST= "boot"#
@@ -119,8 +155,6 @@KERNEL_EXTRA_ARGS?= ""
# We don't want to override kernelMakefilevariables from the environmentEXTRA_OEMAKE= ""-KERNEL_ALT_IMAGETYPE ??= ""
-
# Define where the kernel headers are installed on the target as well as where # they are staged.
KERNEL_SRC_PATH= "/usr/src/kernel"
@@ -166,23 +200,48 @@copy_initramfs(){
echo "Finished copy of initramfs into ./usr"
}-INITRAMFS_BASE_NAME = "${KERNEL_IMAGETYPE}-initramfs-${PV}-${PR}-${MACHINE}-${DATETIME}" +INITRAMFS_BASE_NAME = "initramfs-${PV}-${PR}-${MACHINE}-${DATETIME}"
INITRAMFS_BASE_NAME[vardepsexclude] = "DATETIME"
do_bundle_initramfs() {
if [ ! -z "${INITRAMFS_IMAGE}" -a x"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
echo "Creating a kernel image with a bundled initramfs..."copy_initramfs
- if [ -e ${KERNEL_OUTPUT} ] ; then
- mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.bak
- fi
+ # Backuping kernel image relies on its type(regular file or symbolic link)
Quoted 1 line
s/Backuping/Backing up/
I'll correct it.
Quoted 57 lines
+ tmp_path=""
+ for type in ${KERNEL_IMAGETYPES} ; do
+ if [ -h ${KERNEL_OUTPUT_DIR}/$type ] ; then
+ linkpath=readlink -n ${KERNEL_OUTPUT_DIR}/$type
+ realpath=readlink -fn ${KERNEL_OUTPUT_DIR}/$type
+ mv -f $realpath $realpath.bak
+ tmp_path=$tmp_path" "$type"#"$linkpath"#"$realpath
+ elif [ -f ${KERNEL_OUTPUT_DIR}/$type ]; then
+ mv -f ${KERNEL_OUTPUT_DIR}/$type ${KERNEL_OUTPUT_DIR}/$type.bak
+ tmp_path=$tmp_path" "$type"##"
+ fi
+ done
use_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpiokernel_do_compile
- mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.initramfs
- mv -f ${KERNEL_OUTPUT}.bak ${KERNEL_OUTPUT}
+ # Restoring kernel image
+ for tp in $tmp_path ; do
+ type=echo $tp|cut -d "#" -f 1
+ linkpath=echo $tp|cut -d "#" -f 2
+ realpath=echo $tp|cut -d "#" -f 3
+ if [ -n "$realpath" ]; then
+ mv -f $realpath $realpath.initramfs
+ mv -f $realpath.bak $realpath
+ cd ${B}/${KERNEL_OUTPUT_DIR}
+ ln -sf $linkpath.initramfs
+ else
+ mv -f ${KERNEL_OUTPUT_DIR}/$type ${KERNEL_OUTPUT_DIR}/$type.initramfs
+ mv -f ${KERNEL_OUTPUT_DIR}/$type.bak ${KERNEL_OUTPUT_DIR}/$type
+ fi
+ done
# Update install area
- echo "There is kernel image bundled with initramfs: ${B}/${KERNEL_OUTPUT}.initramfs"
- install -m 0644 ${B}/${KERNEL_OUTPUT}.initramfs ${D}/boot/${KERNEL_IMAGETYPE}-initramfs-${MACHINE}.bin
- echo "${B}/${KERNEL_OUTPUT}.initramfs"
+ for type in ${KERNEL_IMAGETYPES} ; do
+ echo "There is kernel image bundled with initramfs: ${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs"
+ install -m 0644 ${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs ${D}/boot/$type-initramfs-${MACHINE}.bin
+ echo "${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs"
+ done
fi
}@@ -207,10 +266,15 @@
kernel_do_compile(){
copy_initramfsuse_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
fi
-oe_runmake${KERNEL_IMAGETYPE_FOR_MAKE} ${KERNEL_ALT_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
- if test "${KERNEL_IMAGETYPE_FOR_MAKE}.gz" = "${KERNEL_IMAGETYPE}"; then
- gzip -9c < "${KERNEL_IMAGETYPE_FOR_MAKE}" > "${KERNEL_OUTPUT}"
- fi
+oe_runmake${KERNEL_IMAGETYPE_FOR_MAKE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
Quoted 6 lines
This is probably something that is worth mentioning in the top of the commit message. You are building multiple kernel image types, but they are all currently using the same configuration.
If the make invokations were split into separate calls per image type, we could conceivably extend this to generate and use a separate config int he future.
OK. Let me test if there is any side effect after putting this make in a type loop.
Quoted 54 lines
+ for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do
+ for type in ${KERNEL_IMAGETYPES} ; do
+ if test "${typeformake}.gz" = "${type}"; then
+ gzip -9c < "${typeformake}" > "${KERNEL_OUTPUT_DIR}/${type}"
+ break;
+ fi
+ done
+ done
}
do_compile_kernelmodules(){
@@ -251,7 +315,9 @@kernel_do_install(){
#
install -d ${D}/${KERNEL_IMAGEDEST}
install -d ${D}/boot
- install -m 0644 ${KERNEL_OUTPUT} ${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
+ for type in ${KERNEL_IMAGETYPES} ; do
+ install -m 0644 ${KERNEL_OUTPUT_DIR}/${type} ${D}/${KERNEL_IMAGEDEST}/${type}-${KERNEL_VERSION}
+ done
install -m 0644 System.map ${D}/boot/System.map-${KERNEL_VERSION}
install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION}
install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION}
@@ -365,12 +431,12 @@EXPORT_FUNCTIONSdo_compiledo_installdo_configure
PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image kernel-dev kernel-modules"
FILES_${PN} = ""
FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order/lib/modules/${KERNEL_VERSION}/modules.builtin"
-FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}*"
+FILES_kernel-image = ""
FILES_kernel-dev = "/boot/System.map*/boot/Module.symvers*/boot/config*${KERNEL_SRC_PATH}/lib/modules/${KERNEL_VERSION}/build" FILES_kernel-vmlinux = "/boot/vmlinux*"
FILES_kernel-modules = ""
RDEPENDS_kernel= "kernel-base"
-# Allow machines to override this dependency if kernel image files are
+# Allow machines to override this dependency if kernel image files are
# not wanted in images as standard
RDEPENDS_kernel-base ?= "kernel-image"
PKG_kernel-image = "kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
@@ -394,14 +460,6 @@ pkg_postinst_kernel-base () {
fi
}-pkg_postinst_kernel-image () {
- update-alternatives --install /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true
-}
-
-pkg_postrm_kernel-image () {
- update-alternatives --remove ${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
-}
-
PACKAGESPLITFUNCS_prepend= "split_kernel_packages"python
split_kernel_packages() {
@@ -422,13 +480,13 @@do_kernel_link_vmlinux(){
Quoted 8 lines
do_strip(){
if [ -n "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}" ]; then
- if [ "${KERNEL_IMAGETYPE}" != "vmlinux" ]; then
- bbwarn "image type will not be stripped (not supported): ${KERNEL_IMAGETYPE}"
+ if ! (echo "${KERNEL_IMAGETYPES}" | grep -q "vmlinux"); thenYou had used the \bfitImage\b, but here you don't .. grep -w could work for them all.
I'll correct it.
Quoted 9 lines
+ bbwarn "image type(s) will not be stripped (not supported): ${KERNEL_IMAGETYPES}"
But on another note. Is it really right to say that none of the images will be stripped if you find vmlinux anywhere in the image type list ?
Not clear what you mean here.
Quoted 32 lines
return
ficd ${B}
- headers=`"$CROSS_COMPILE"readelf -S ${KERNEL_OUTPUT} | \
+ headers=`"$CROSS_COMPILE"readelf -S ${KERNEL_OUTPUT_DIR}/vmlinux | \
grep "^ \{1,\}\[[0-9 ]\{1,\}\] [^ ]" | \
sed "s/^ \{1,\}\[[0-9 ]\{1,\}\] //" | \
gawk '{print $1}'`
@@ -438,7 +496,7 @@do_strip(){
bbwarn "Section not found: $str";
fi- "$CROSS_COMPILE"strip -s -R $str ${KERNEL_OUTPUT}
+ "$CROSS_COMPILE"strip -s -R $str ${KERNEL_OUTPUT_DIR}/vmlinux
}; donebbnote "
KERNEL_IMAGE_STRIP_EXTRA_SECTIONSis set, stripping sections:" \
@@ -457,20 +515,22 @@do_sizecheck(){
if [ -n "$invalid" ]; then
die "InvalidKERNEL_IMAGE_MAXSIZE: ${KERNEL_IMAGE_MAXSIZE}, should be an integerx (The unit is Kbytes)"
fi
- size=du -ks ${B}/${KERNEL_OUTPUT} | awk '{ print $1}'
- if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
- die "This kernel (size=$size(K) > ${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device. Please reduce the size of the kernel by making more of it modular."
- fi
+ for type in ${KERNEL_IMAGETYPES} ; do
+ size=du -ks ${B}/${KERNEL_OUTPUT_DIR}/$type | awk '{print $1}'
+ if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
+ die "This kernel $type (size=$size(K) > ${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device. Please reduce the size of the kernel by making more of it modular."
Quoted 4 lines
Hmm. Again here. Multiple image types are being built. If one of them is too large for the device, who's to say that that's the one that is going to be used ? Maybe this should be a warn, instead of a die ?
Fair point. A warn is OK.
Quoted 119 lines
+ fi
+ done
fi
}
do_sizecheck[dirs] = "${B}"addtask sizecheck before
do_installafterdo_strip-KERNEL_IMAGE_BASE_NAME ?= "${KERNEL_IMAGETYPE}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}" +KERNEL_IMAGE_BASE_NAME ?= "${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
# Don't include the DATETIME variable in the sstate package signatures KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
-KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}" +KERNEL_IMAGE_SYMLINK_NAME ?= "${MACHINE}"
MODULE_IMAGE_BASE_NAME?= "modules-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}" MODULE_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME"
MODULE_TARBALL_BASE_NAME?= "${MODULE_IMAGE_BASE_NAME}.tgz"
@@ -479,28 +539,37 @@MODULE_TARBALL_SYMLINK_NAME?= "modules-${MACHINE}.tgz"
MODULE_TARBALL_DEPLOY?= "1"
kernel_do_deploy(){
- install -m 0644 ${KERNEL_OUTPUT} ${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
+ for type in ${KERNEL_IMAGETYPES} ; do
+ base_name=${type}-${KERNEL_IMAGE_BASE_NAME}
+ install -m 0644 ${KERNEL_OUTPUT_DIR}/${type} ${DEPLOYDIR}/${base_name}.bin
+ done
if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
mkdir -p ${D}/lib
tar -cvzf ${DEPLOYDIR}/${MODULE_TARBALL_BASE_NAME} -C ${D} lib
ln -sf ${MODULE_TARBALL_BASE_NAME} ${DEPLOYDIR}/${MODULE_TARBALL_SYMLINK_NAME}
fi- ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${DEPLOYDIR}/${KERNEL_IMAGE_SYMLINK_NAME}.bin
- ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin ${DEPLOYDIR}/${KERNEL_IMAGETYPE}
+ for type in ${KERNEL_IMAGETYPES} ; do
+ base_name=${type}-${KERNEL_IMAGE_BASE_NAME}
+ symlink_name=${type}-${KERNEL_IMAGE_SYMLINK_NAME}
+ ln -sf ${base_name}.bin ${DEPLOYDIR}/${symlink_name}.bin
+ ln -sf ${base_name}.bin ${DEPLOYDIR}/${type}
+ donecp
${COREBASE}/meta/files/deploydir_readme.txt${DEPLOYDIR}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txtcd ${B}
# Update deploy directory
- if [ -e "${KERNEL_OUTPUT}.initramfs" ]; then
- echo "Copying deploy kernel-initramfs image and setting up links..."
- initramfs_base_name=${INITRAMFS_BASE_NAME}
- initramfs_symlink_name=${KERNEL_IMAGETYPE}-initramfs-${MACHINE}
- install -m 0644 ${KERNEL_OUTPUT}.initramfs ${DEPLOYDIR}/${initramfs_base_name}.bin
- cd ${DEPLOYDIR}
- ln -sf ${initramfs_base_name}.bin ${initramfs_symlink_name}.bin
- fi
+ for type in ${KERNEL_IMAGETYPES} ; do
+ if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ]; then
+ echo "Copying deploy ${type} kernel-initramfs image and setting up links..."
+ initramfs_base_name=${type}-${INITRAMFS_BASE_NAME}
+ initramfs_symlink_name=${type}-initramfs-${MACHINE}
+ install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}.initramfs ${DEPLOYDIR}/${initramfs_base_name}.bin
+ cd ${DEPLOYDIR}
+ ln -sf ${initramfs_base_name}.bin ${initramfs_symlink_name}.bin
+ fi
+ done
}
do_deploy[cleandirs] = "${DEPLOYDIR}"
do_deploy[dirs] = "${DEPLOYDIR} ${B}"
diff --gita/meta/conf/documentation.confb/meta/conf/documentation.conf
index 00a69da..b3969b0 100644
---a/meta/conf/documentation.conf
+++b/meta/conf/documentation.conf
@@ -246,6 +246,7 @@ KERNEL_CLASSES[doc] = "A list of classes defining kernel image types that kernel
KERNEL_EXTRA_ARGS[doc] = "Specifies additional make command-line arguments the OpenEmbedded build system passes on when compiling the kernel." KERNEL_FEATURES[doc] = "Includes additional metadata from the Yocto Project kernel Git repository. The metadata you add through this variable includes config fragments and features descriptions." KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device, usually set by the machine configuration files and defaults to 'zImage'."
+KERNEL_IMAGETYPES[doc] = "The list of types of kernel to build for a device, usually set by the machine configuration files and defaults toKERNEL_IMAGETYPE."
KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be auto-loaded during boot"
KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the build system expects to find module_conf_* values that specify configuration for each of the modules" KERNEL_PATH[doc] = "The location of the kernel sources. This variable is set to the value of theSTAGING_KERNEL_DIRwithin the module class (module.bbclass)."
diff --gita/meta/conf/machine/qemumips.confb/meta/conf/machine/qemumips.conf
index fbf8137..67ce161 100644
---a/meta/conf/machine/qemumips.conf
+++b/meta/conf/machine/qemumips.conf
@@ -6,7 +6,7 @@ require conf/machine/include/qemu.inc
require conf/machine/include/tune-mips32r2.inc
KERNEL_IMAGETYPE= "vmlinux"
-KERNEL_ALT_IMAGETYPE = "vmlinux.bin"
+KERNEL_IMAGETYPES = "vmlinux.bin"
SERIAL_CONSOLES= "115200;ttyS0 115200;ttyS1"diff --git
a/meta/conf/machine/qemumips64.confb/meta/conf/machine/qemumips64.confindex 8c3f1fe..393212e 100644
---a/meta/conf/machine/qemumips64.conf
+++b/meta/conf/machine/qemumips64.conf
@@ -6,7 +6,7 @@ require conf/machine/include/qemu.inc
require conf/machine/include/tune-mips64.inc
KERNEL_IMAGETYPE= "vmlinux"
-KERNEL_ALT_IMAGETYPE = "vmlinux.bin"
+KERNEL_IMAGETYPES = "vmlinux.bin"
SERIAL_CONSOLES= "115200;ttyS0 115200;ttyS1"diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc index 651a19e..74f5ef8 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -34,9 +34,12 @@do_install_append(){
for DTB in ${KERNEL_DEVICETREE}; do
DTB=normalize_dtb "${DTB}"
DTB_BASE_NAME=basename ${DTB} .dtb
- DTB_SYMLINK_NAME=echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"
- DTB_PATH=get_real_dtb_path_in_kernel "${DTB}"
- install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
+ for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
+ symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
Quoted 1 line
If there are multiple image types being built, is this valid for them all ?
Add these links for convenience. If we give different configurations to different types of images in the future, as you pointed above, we might also need different dtb.
Quoted 85 lines
+ DTB_SYMLINK_NAME=`echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"` + DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"` + install -m 0644 ${DTB_PATH} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb+ done
done
}@@ -44,31 +47,39 @@
do_deploy_append(){
for DTB in ${KERNEL_DEVICETREE}; do
DTB=normalize_dtb "${DTB}"DTB_BASE_NAME=basename ${DTB} .dtb
- DTB_NAME=echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"
- DTB_SYMLINK_NAME=echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"
- DTB_PATH=get_real_dtb_path_in_kernel "${DTB}"
- install -d ${DEPLOYDIR}
- install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.dtb
- ln -sf ${DTB_NAME}.dtb ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.dtb
+ for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
+ base_name=${type}"-"${KERNEL_IMAGE_BASE_NAME}
+ symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
+ DTB_NAME=echo ${base_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"
+ DTB_SYMLINK_NAME=echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"
+ DTB_PATH=get_real_dtb_path_in_kernel "${DTB}"
+ install -d ${DEPLOYDIR}
+ install -m 0644 ${DTB_PATH} ${DEPLOYDIR}/${DTB_NAME}.dtb
+ ln -sf ${DTB_NAME}.dtb ${DEPLOYDIR}/${DTB_SYMLINK_NAME}.dtb
+ done
done
}pkg_postinst_kernel-devicetree () {
cd /${KERNEL_IMAGEDEST}
- for DTB in ${KERNEL_DEVICETREE}
- do
- DTB_BASE_NAME=basename ${DTB} | awk -F "." '{print $1}'
- DTB_SYMLINK_NAME=echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"
- update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb/boot/devicetree-${DTB_SYMLINK_NAME}.dtb${KERNEL_PRIORITY} || true
+ for DTB in ${KERNEL_DEVICETREE}; do
+ for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
+ symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
+ DTB_BASE_NAME=basename ${DTB} | awk -F "." '{print $1}'
+ DTB_SYMLINK_NAME=echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"
+ update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb/boot/devicetree-${DTB_SYMLINK_NAME}.dtb${KERNEL_PRIORITY} || true
+ done
done
}pkg_postrm_kernel-devicetree () {
cd /${KERNEL_IMAGEDEST}
- for DTB in ${KERNEL_DEVICETREE}
- do
- DTB_BASE_NAME=basename ${DTB} | awk -F "." '{print $1}'
- DTB_SYMLINK_NAME=echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"
- update-alternatives --remove ${DTB_BASE_NAME}.dtb/boot/devicetree-${DTB_SYMLINK_NAME}.dtb${KERNEL_PRIORITY} || true
+ for DTB in ${KERNEL_DEVICETREE}; do
+ for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
+ symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
+ DTB_BASE_NAME=basename ${DTB} | awk -F "." '{print $1}'
+ DTB_SYMLINK_NAME=echo ${symlink_name} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"
+ update-alternatives --remove ${DTB_BASE_NAME}.dtb/boot/devicetree-${DTB_SYMLINK_NAME}.dtb${KERNEL_PRIORITY} || true
+ done
done
}
diff --gita/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.confb/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.confindex b319d62..e4a6f30 100644
---a/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.conf
+++b/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.conf
@@ -9,7 +9,7 @@ require conf/machine/include/tune-mips32.inc
MACHINE_FEATURES= "screen keyboard pci usbhost ext2 ext3 serial"
KERNEL_IMAGETYPE= "vmlinux"
-KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin"
KERNEL_IMAGE_STRIP_EXTRA_SECTIONS= ".comment"{{ if
kernel_choice== "custom":preferred_kernel= "linux-yocto-custom" }}
diff --gita/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.confb/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.confindex 3afc5e0..2c2d8af 100644
---a/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.conf
+++b/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.conf
@@ -9,7 +9,7 @@ require conf/machine/include/tune-mips64.inc
MACHINE_FEATURES= "pci ext2 ext3 serial"
Quoted 8 lines
KERNEL_IMAGETYPE= "vmlinux"
-KERNEL_ALT_IMAGETYPE = "vmlinux.bin"
+KERNEL_IMAGETYPES = "vmlinux.bin"Again, why can't vmlinux just bein in
KERNEL_IMAGETYPES?
Discussed above.
Thanks,
Zhe
Quoted 32 lines
Bruce
KERNEL_IMAGE_STRIP_EXTRA_SECTIONS = ".comment" {{ if kernel_choice == "custom": preferred_kernel = "linux-yocto-custom" }} diff --git a/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.conf b/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.conf index 67e1cbd..7a0a4d3 100644 --- a/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.conf +++ b/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.conf @@ -69,6 +69,6 @@ SERIAL_CONSOLE = "115200 ttyS0" {{ if qemuarch == "mips" or qemuarch == "mips64": }} KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" SERIAL_CONSOLE = "115200 ttyS0" MACHINE_EXTRA_RRECOMMENDS = " kernel-modules" -- 1.9.1 -- _______________________________________________ Openembedded-core mailing list [email protected] <mailto:[email protected]> http://lists.openembedded.org/mailman/listinfo/openembedded-coreSignature · 1 line
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
Re: [PATCH v2 1/2] kernel: Add KERNEL_IMAGETYPES to build multi types kernel at one time
Quoted 125 lines · He Zhe
Quoted 3 lines · Bruce Ashfield
On Fri, Feb 19, 2016 at 4:56 AM, <[email protected] <mailto:
Quoted 6 lines · [email protected]>>wrote:
From: He Zhe <[email protected] <mailto:[email protected]>>
Add
KERNEL_IMAGETYPESto support building packaging and installing multi types of kernel images, such as zImage uImage, at one time.Quoted 6 lines
KERNEL_IMAGETYPEworks as before. AllKERNEL_ALT_IMAGETYPEsare replaced byKERNEL_IMAGETYPES.I see that you have updated layers/configs with the new variable, but
obviously you can't see all the
Quoted 3 lines
layers that may be using that old variable.
Isn't it possible to have a python routine that detects the old
ALT_IMAGETYPEvariable andQuoted 1 line
assigns it to the new one (if it isn't already set) ? Sort of like how
distro features/features backfill
Quoted 2 lines
work ?
Thanks for careful review.
OK. I'll try to add such function.
Quoted 4 lines
Fixes [YOCTO #6945].
Signed-off-by He Zhe <[email protected] <mailto:Quoted 7 lines
---
documentation/ref-manual/ref-variables.xml| 10 +-
meta-yocto-bsp/conf/machine/edgerouter.conf| 2 +-
meta/classes/kernel-fitimage.bbclass | 20 +--
meta/classes/kernel-grub.bbclass | 44 ++++--
meta/classes/kernel-uimage.bbclass | 22 +--
meta/classes/kernel.bbclass | 171+++++++++++++++------
Quoted 10 lines
meta/conf/documentation.conf | 1 + meta/conf/machine/qemumips.conf | 2 +- meta/conf/machine/qemumips64.conf | 2 +- meta/recipes-kernel/linux/linux-dtb.inc | 49 +++--- .../target/arch/mips/conf/machine/machine.conf | 2 +- .../target/arch/mips64/conf/machine/machine.conf | 2 +- .../target/arch/qemu/conf/machine/machine.conf | 2 +- 13 files changed, 214 insertions(+), 115 deletions(-)diff --git a/documentation/ref-manual/ref-variables.xml
b/documentation/ref-manual/ref-variables.xmlQuoted 4 lines
index a76a8c2..a8e4fd8 100644 --- a/documentation/ref-manual/ref-variables.xml +++ b/documentation/ref-manual/ref-variables.xml @@ -6417,14 +6417,14 @@recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR = "${INC_PR}.3"
Quoted 4 lines
</glossdef>
</glossentry>- <glossentry
id='var-KERNEL_ALT_IMAGETYPE'><glossterm>KERNEL_ALT_IMAGETYPE</glossterm>
Quoted 1 line
+ <glossentry
id='var-KERNEL_IMAGETYPES'><glossterm>KERNEL_IMAGETYPES</glossterm>
Quoted 2 lines
<info>
- KERNEL_ALT_IMAGETYPE[doc] = "Specifies an alternatekernel image type for creation."
Quoted 1 line
+ KERNEL_IMAGETYPES[doc] = "Specifies alternate
kernel image types for creation."
Quoted 4 lines
</info>
<glossdef>
<para role="glossdeffirst">
<!-- <para role="glossdeffirst"><imagedatafileref="figures/define-generic.png" /> -->
Quoted 1 line
- Specifies an alternate kernel image type for
creation in
Quoted 1 line
+ Specifies alternate kernel image types for
creation in
Quoted 1 line
addition to the kernel image type specified
using the
Quoted 1 line
<link
linkend='var-KERNEL_IMAGETYPE'><filename>KERNEL_IMAGETYPE</filename></link>
Quoted 2 lines
variable. @@ -6612,8 +6612,8 @@ recipes-graphics/xorg-font/font-alias_1.0.3.bb:PR= "${INC_PR}.3"
Quoted 4 lines
</para> <para> - If you want to build an alternate kernel imagetype, use the
Quoted 1 line
- <link
linkend='var-KERNEL_ALT_IMAGETYPE'><filename>KERNEL_ALT_IMAGETYPE</filename></link>
Quoted 1 line
+ If you want to build alternate kernel image
types, use the
Quoted 1 line
+ <link
linkend='var-KERNEL_IMAGETYPES'><filename>KERNEL_IMAGETYPES</filename></link>
Quoted 4 lines
variable. </para> </glossdef> diff --git a/meta-yocto-bsp/conf/machine/edgerouter.conf
b/meta-yocto-bsp/conf/machine/edgerouter.confQuoted 6 lines
index 476e690..affd568 100644
---a/meta-yocto-bsp/conf/machine/edgerouter.conf+++b/meta-yocto-bsp/conf/machine/edgerouter.conf@@ -7,7 +7,7 @@ require conf/machine/include/tune-mips64.inc
MACHINE_FEATURES= "pci ext2 ext3 serial"Quoted 6 lines
KERNEL_IMAGETYPE= "vmlinux"
-KERNEL_ALT_IMAGETYPE = "vmlinux.bin"
+KERNEL_IMAGETYPES = "vmlinux.bin"This now reads a bit ... odd (for back of a better description). I'm
concerned that it will cause
Quoted 5 lines
confusion, there are two variables:
KERNEL_IMAGETYPEandKERNEL_IMAGETYPES..They are very close in name, and just reading the variable doesn't
really tell us why
Quoted 9 lines
Quoted 2 lines
we'd set one and not the other. The old "ALT" made it more obvious.
But changing original
KERNEL_ALT_IMAGETYPEto a list or usingKERNEL_ALT_IMAGETYPES
in addition toKERNEL_ALT_IMAGETYPEalso seems not very clear. Below is the previous
talk with Richard Purdie and Christopher Larson.
Aha. I didn't recall that previous discussion. Clearly there's no "one good way" to name
these to avoid some confusion, so I'd defer to Richard's opinion on the naming.
That being said, I do wish that the names conveyed why there was a variable that
took a single image type, and then another one that took a list, and that the lists
were non overlapping.
Quoted 165 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Question, why not add
KERNEL_IMAGETYPES, and makeKERNEL_IMAGETYPEequal to your new KERNEL_IMAGETYPE_0?(Christopher)
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Adding a new
KERNEL_IMAGETYPESwill also work. But it should bebetter(me)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
not to change the name of
KERNEL_IMAGETYPE, so that those who have used it don't have to change their code.Thank you for reviewing.
I have to agree with Chris here, keeping
KERNEL_IMAGETYPEas usedtoday(Richard)
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines
and equivalent to
KERNEL_IMAGETYPE_0and addingKERNEL_IMAGETYPESdoes seem like a cleaner way to implement this.But it might mean we are going to check both
KERNEL_IMAGETYPEand
KERNEL_IMAGETYPES(me)Quoted 3 lines
Quoted 1 line
to generate final image type list. Is that OK?
Well, in some places you will use one and in some places you'll use
the(Richard)
Quoted 8 lines
other, that is unavoidable.
I much prefer "
KERNEL_IMAGETYPEandKERNEL_IMAGETYPES" to "KERNEL_IMAGETYPE_0andKERNEL_IMAGETYPE" as variable names though.Cheers,
But from the patch,
KERNEL_IMAGETYPEisn't used, so does it have to beset at
Quoted 1 line
all in these .conf files ? .. or maybe I missed where it is still used
other than for
Quoted 2 lines
compatibility.
Not every
KERNEL_IMAGETYPEshould be replaced byKERNEL_IMAGETYPES. Only one
type of kernel image is necessary for below cases.Right?Yes, more explanations should be added to commit message and code comments.
1) boot fs image meta/classes/bootimg.bbclass:50:KERNEL_IMAGETYPE ??= "bzImage"
meta/classes/bootimg.bbclass:72: install -m 0644
${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} ${DEST}/vmlinuz meta/classes/image_types.bbclass:109:ELF_KERNEL ?= "${STAGING_DIR_HOST}/usr/src/kernel/${KERNEL_IMAGETYPE}"2) test fs image
meta/lib/oeqa/controllers/masterimage.py:55: self.kernel =
os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True),d.getVar("KERNEL_IMAGETYPE", False)+ '-' +d.getVar('MACHINE', False)+ '.bin')meta/lib/oeqa/targetcontrol.py:126: self.kernel =
os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True),d.getVar("KERNEL_IMAGETYPE", False)+ '-' +d.getVar('MACHINE', False)+ '.bin')Quoted 4 lines
KERNEL_IMAGE_STRIP_EXTRA_SECTIONS= ".comment"PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
diff --git a/meta/classes/kernel-fitimage.bbclassb/meta/classes/kernel-fitimage.bbclass
Quoted 6 lines
index f1b409c..51df19d 100644
--- a/meta/classes/kernel-fitimage.bbclass
+++ b/meta/classes/kernel-fitimage.bbclass
@@ -1,8 +1,8 @@
inherit kernel-ubootQuoted 10 lines
python
__anonymous() {
- kerneltype =d.getVar('KERNEL_IMAGETYPE', True)
- if kerneltype == 'fitImage':
+ kerneltypes =d.getVar('KERNEL_IMAGETYPES', True)or ""
+ if 'fitImage' inkerneltypes.split():
depends =d.getVar("DEPENDS", True)
depends = "%s u-boot-mkimage-native dtc-native" % dependsd.setVar("DEPENDS", depends)
@@ -10,7 +10,9 @@ python__anonymous() {
# OverrideKERNEL_IMAGETYPE_FOR_MAKEvariable, which isinternal
Quoted 1 line
# to kernel.bbclass . We have to override it, since we packzImage
Quoted 3 lines
# (at least for now) into the fitImage .
-d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "zImage")
+ typeformake =d.getVar("KERNEL_IMAGETYPE_FOR_MAKE", True)or ""
Quoted 2 lines
+ if 'fitImage' in
typeformake.split():
+ d.setVar('KERNEL_IMAGETYPE_FOR_MAKE',
typeformake.replace('fitImage', 'zImage'))Quoted 6 lines
image =
d.getVar('INITRAMFS_IMAGE', True)if image:
@@ -154,7 +156,7 @@ EOF
}Quoted 6 lines
do_assemble_fitimage(){
- if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then
+ if echo ${KERNEL_IMAGETYPES} | grep -Pq "\bfitImage\b"; thenNot that it really matters, but grep -w would work here as well, and
might read bit simpler.
OK. I'll replace it with "-w"
Quoted 6 lines
kernelcount=1 dtbcount="" rm -f fit-image.its @@ -217,14 +219,14 @@ addtask assemble_fitimage before do_installafter
do_compileQuoted 8 lines
kernel_do_deploy_append(){
# Update deploy directory
- if test "x${KERNEL_IMAGETYPE}" = "xfitImage" ; then
+ if echo ${KERNEL_IMAGETYPES} | grep -Pq "\bfitImage\b"; then
cd ${B}
echo "Copying fit-image.its source file..."
-its_base_name="${KERNEL_IMAGETYPE}-its-${PV}-${PR}-${MACHINE}-${DATETIME}"
Quoted 2 lines
- its_symlink_name=${KERNEL_IMAGETYPE}-its-${MACHINE}
+its_base_name="fitImage-its-${PV}-${PR}-${MACHINE}-${DATETIME}"
Quoted 2 lines
+ its_symlink_name=fitImage-its-${MACHINE}
install -m 0644 fit-image.its${DEPLOYDIR}/${its_base_name}.its
Quoted 1 line
-linux_bin_base_name="${KERNEL_IMAGETYPE}-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}"
Quoted 1 line
-linux_bin_symlink_name=${KERNEL_IMAGETYPE}-linux.bin-${MACHINE}
Quoted 1 line
+linux_bin_base_name="fitImage-linux.bin-${PV}-${PR}-${MACHINE}-${DATETIME}"
Quoted 2 lines
+ linux_bin_symlink_name=fitImage-linux.bin-${MACHINE}
install -m 0644 linux.bin${DEPLOYDIR}/${linux_bin_base_name}.bin
Quoted 3 lines
cd ${DEPLOYDIR} diff --git a/meta/classes/kernel-grub.bbclassb/meta/classes/kernel-grub.bbclass
Quoted 11 lines
index a63f482..f7dcc07 100644 --- a/meta/classes/kernel-grub.bbclass +++ b/meta/classes/kernel-grub.bbclass @@ -10,41 +10,44 @@ # updates the new kernel as the boot priority. # -pkg_preinst_kernel-image_append () { +python __anonymous () {Quoted 1 line
Maybe it is just the patch context making me misread this, but can you
elaborate on
Quoted 2 lines
what is changing here ?
Here I change the two variables, pkg_preinst_kernel-image_append and pkg_postinst_kernel-image_prepend to two strings, and change all "${KERNEL_IMAGETYPE}"
in the strings to "KERNEL_IMAGETYPE" to avoid being expanded in parsing time. So that I can
replaceKERNEL_IMAGETYPEsto every single image type in the following loops, in which the
two original variables' name are constructed and their values are set.
Quoted 6 lines
According to bitbake user manual,
__anonymousfunctions are executed during parsing. It
should be OK for the following references. I've verified this by building an image with
kernel-grub.bbclass.
Thanks. That clarifies things, I know there have been some variable expansion changes
recently in bitbake, and I wanted to make sure they have been taken into account.
Quoted 30 lines
Quoted 2 lines
Is it the old preinst is being replaced by anonymous python that
generates the preinst as
Quoted 1 line
a string, and that this injected into the package via the python ? Are
we guaranteed
Quoted 1 line
to run the anonymous python at the right time ? .. I've been burned by
that before, so
Quoted 8 lines
I wanted to check that it has been considered.
+ import re
+
+ preinst = '''
# Parsing confliction
[ -f "$D/boot/grub/menu.list" ] &&grubcfg="$D/boot/grub/menu.list"
Quoted 1 line
[ -f "$D/boot/grub/grub.cfg" ] &&grubcfg="$D/boot/grub/grub.cfg"
Quoted 2 lines
if [ -n "$grubcfg" ]; then
# Dereference symlink to avoid confliction with newkernel name.
Quoted 1 line
- if grep -q "/${KERNEL_IMAGETYPE} \+root=" $grubcfg;
then
Quoted 2 lines
- if [ -L "$D/boot/${KERNEL_IMAGETYPE}" ]; then
- kimage=`realpath$D/boot/${KERNEL_IMAGETYPE} 2>/dev/null`
Quoted 4 lines
+ if grep -q "/KERNEL_IMAGETYPE \+root=" $grubcfg; then
It's lines like these that made me ask my question above. This looks
Quoted 9 lines
like its checking the
Quoted 1 line
grubcfg on disk. Is that same grep going to work in this anonymous
python .. or maybe this
Quoted 1 line
isn't being run now, and only when the package is being installed ? I'm
most likely missing
Quoted 1 line
something.
No, it's not running, it's in the middle of the string.
Hmm. Indeed, the way that nested strings are valid is a bit confusing, but that's
just my background not being in python chowing through!
Quoted 177 lines
Quoted 5 lines
+ if [ -L "$D/boot/KERNEL_IMAGETYPE" ]; then
+ kimage=`realpath$D/boot/KERNEL_IMAGETYPE 2>/dev/null`
Quoted 2 lines
if [ -f "$D$kimage" ]; then
- sed -i"s:${KERNEL_IMAGETYPE} \+root=:${kimage##*/} root=:" $grubcfg
Quoted 1 line
+ sed -i "s:KERNEL_IMAGETYPE
\+root=:${kimage##*/} root=:" $grubcfg
Quoted 5 lines
fi
fi
fi# Rename old kernel if it conflicts with new kernel
name.
Quoted 1 line
- if grep -q "/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
\+root=" $grubcfg; then
Quoted 1 line
- if [ -f
"$D/boot/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}" ]; then
Quoted 1 line
+ if grep -q "/KERNEL_IMAGETYPE-${KERNEL_VERSION}
\+root=" $grubcfg; then
Quoted 1 line
+ if [ -f
"$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}" ]; then
Quoted 2 lines
timestamp=`date +%s` -kimage="$D/boot/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}-$timestamp-back"
Quoted 1 line
- sed -i
"s:${KERNEL_IMAGETYPE}-${KERNEL_VERSION} \+root=:${kimage##*/} root=:" $grubcfg
Quoted 1 line
- mv
"$D/boot/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}" "$kimage"
Quoted 1 line
+kimage="$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}-$timestamp-back"
Quoted 1 line
+ sed -i
"s:KERNEL_IMAGETYPE-${KERNEL_VERSION} \+root=:${kimage##*/} root=:" $grubcfg
Quoted 1 line
+ mv
"$D/boot/KERNEL_IMAGETYPE-${KERNEL_VERSION}" "$kimage"
Quoted 4 lines
fi fi fi -}Quoted 8 lines
+''' -pkg_postinst_kernel-image_prepend () { + postinst = ''' get_new_grub_cfg() { grubcfg="$1" old_image="$2" - title="Update${KERNEL_IMAGETYPE}-${KERNEL_VERSION}-${PV}"
Quoted 1 line
+ title="Update
KERNEL_IMAGETYPE-${KERNEL_VERSION}-${PV}"
Quoted 2 lines
if [ "${grubcfg##*/}" = "grub.cfg" ]; then rootfs=`grep " *linux \+[^ ]\+ \+root="$grubcfg -m 1 | \
Quoted 1 line
- sed
"s#${old_image}#${old_image%/*}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}#"`
Quoted 1 line
+ sed
"s#${old_image}#${old_image%/*}/KERNEL_IMAGETYPE-${KERNEL_VERSION}#"`
Quoted 7 lines
echo "menuentry \"$title\" {" echo " set root=(hd0,1)" @@ -52,7 +55,7 @@ pkg_postinst_kernel-image_prepend () { echo "}" elif [ "${grubcfg##*/}" = "menu.list" ]; then rootfs=`grep "kernel \+[^ ]\+ \+root="$grubcfg -m 1 | \
Quoted 1 line
- sed
"s#${old_image}#${old_image%/*}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}#"`
Quoted 1 line
+ sed
"s#${old_image}#${old_image%/*}/KERNEL_IMAGETYPE-${KERNEL_VERSION}#"`
Quoted 6 lines
echo "default 0"
echo "timeout 30"
@@ -87,5 +90,16 @@ pkg_postinst_kernel-image_prepend () {
mv $grubcfgtmp $grubcfg
echo "Caution! Update kernel may affectkernel-module!"
Quoted 10 lines
fi
+'''
+
+ imagetypes =d.getVar('KERNEL_IMAGETYPES', True)
+ imagetypes =re.sub(r'\.gz$', '', imagetypes)
+
+ for type inimagetypes.split():
+ typelower =type.lower()
+preinst_append=preinst.replace('KERNEL_IMAGETYPE', type)
+postinst_prepend= postinst.replace('KERNEL_IMAGETYPE',type)
Quoted 1 line
+ d.setVar('pkg_preinst_kernel-image-' + typelower +
'
_append',preinst_append)Quoted 1 line
+ d.setVar('pkg_postinst_kernel-image-' + typelower +
'
_prepend',postinst_prepend)Quoted 3 lines
} diff --git a/meta/classes/kernel-uimage.bbclassb/meta/classes/kernel-uimage.bbclass
Quoted 10 lines
index f73965b..a238ce4 100644
--- a/meta/classes/kernel-uimage.bbclass
+++ b/meta/classes/kernel-uimage.bbclass
@@ -1,23 +1,25 @@
inherit kernel-ubootpython
__anonymous() {
- kerneltype =d.getVar('KERNEL_IMAGETYPE', True)
- if kerneltype == 'uImage':
+ if "uImage" in (d.getVar('KERNEL_IMAGETYPES', True)or"").split():
Quoted 5 lines
depends =
d.getVar("DEPENDS", True)depends = "%s u-boot-mkimage-native" % dependsd.setVar("DEPENDS", depends)- # Override
KERNEL_IMAGETYPE_FOR_MAKEvariable, which isinternal
Quoted 1 line
- # to kernel.bbclass . We override the variable here, since
we need
Quoted 1 line
- # to build uImage using the kernel build system if and only
if
Quoted 1 line
- # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux
into
Quoted 4 lines
- # the uImage .
- ifd.getVar("KEEPUIMAGE", True)!= 'yes':
-d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", "zImage")
+ # OverrideKERNEL_IMAGETYPE_FOR_MAKEvariable, which isinternal
Quoted 1 line
+ # to kernel.bbclass . We override the variable here, since
we need
Quoted 1 line
+ # to build uImage using the kernel build system if and only
if
Quoted 1 line
+ # KEEPUIMAGE == yes. Otherwise, we pack compressed vmlinux
into
Quoted 3 lines
+ # the uImage .
+ ifd.getVar("KEEPUIMAGE", True)!= 'yes':
+ typeformake = d.getVar("KERNEL_IMAGETYPE_FOR_MAKE",True) or ""
Quoted 5 lines
+ if "uImage" in
typeformake.split():
+typeformake.replace('uImage', 'zImage')
+d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)
}Quoted 7 lines
do_uboot_mkimage(){
- if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then
+ if echo "${KERNEL_IMAGETYPES}" | grep -Pq "\buImage\b"; then
if test "x${KEEPUIMAGE}" != "xyes" ; then
uboot_prep_kimagediff --git a/meta/classes/kernel.bbclass
b/meta/classes/kernel.bbclass
Quoted 7 lines
index c3eab50..6db2e2e 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -16,12 +16,48 @@INITRAMFS_IMAGE?= ""
INITRAMFS_TASK?= ""
INITRAMFS_IMAGE_BUNDLE?= ""Quoted 9 lines
+#
KERNEL_VERSIONis extracted from source code. It is evaluated as +# None for the first parsing, since the code has not been fetched. +# After the code is fetched, it will be evaluated as real version +# number and cause kernel to be rebuilt. To avoid this, make +#KERNEL_VERSION_NAMEandKERNEL_VERSION_PKG_NAMEdepend on +#LINUX_VERSIONwhich is a constant. +KERNEL_VERSION_NAME = "${@d.getVar('KERNEL_VERSION', True) or ""}" +KERNEL_VERSION_NAME[vardepvalue] = "${LINUX_VERSION}" +KERNEL_VERSION_PKG_NAME ="${@legitimize_package_name(d.getVar('KERNEL_VERSION', True))}"
Quoted 10 lines
+KERNEL_VERSION_PKG_NAME[vardepvalue] = "${LINUX_VERSION}" + python __anonymous () { import re - kerneltype = d.getVar('KERNEL_IMAGETYPE', True) + type = d.getVar('KERNEL_IMAGETYPE', True) or ""Aha. Here is that use of
KERNEL_IMAGETYPE. Like I mentioned for the alt
Quoted 9 lines
image type, can't
Quoted 1 line
this existing variable be checked, and then added to
KERNEL_IMAGE_TYPESin some
Quoted 1 line
python code ? That would simplify the code here, and also not require
the two variables to
Quoted 1 line
be kept around.
See above for explanation for
KERNEL_IMAGETYPES.
True. But I still think that we could allow the old variable to be set, and have it joined
into a single variable by python code. That would mean you'd only need to check
one variable, and users can continue to set the existing one. Something to think about.
Quoted 269 lines
Quoted 16 lines
+ types =
d.getVar('KERNEL_IMAGETYPES', True)or ""
+ if type not intypes.split():
+ types = (type + ' ' + types).strip()
+d.setVar('KERNEL_IMAGETYPES', types)
+ typeformake =re.sub(r'\.gz', '', types)
+d.setVar('KERNEL_IMAGETYPE_FOR_MAKE', typeformake)
+
+ for type intypeformake.split():
+ typelower =type.lower()
+
+d.appendVar('PACKAGES', ' ' + 'kernel-image-' + typelower)
+
+ d.setVar('FILES_kernel-image-' + typelower, '/boot/' + type+ '*')
Quoted 2 lines
+
+ d.appendVar('RDEPENDS_kernel-image', ' ' + 'kernel-image-'+ typelower)
Quoted 2 lines
+
+ d.setVar('PKG_kernel-image-' + typelower, 'kernel-image-' +typelower + '-${KERNEL_VERSION_PKG_NAME}')
Quoted 4 lines
+
+d.setVar('ALLOW_EMPTY_kernel-image-' + typelower, '1')- d.setVar("KERNEL_IMAGETYPE_FOR_MAKE", re.sub(r'\.gz$', '',
kerneltype))
Quoted 3 lines
+ imagedest = d.getVar('KERNEL_IMAGEDEST', True) + priority = d.getVar('KERNEL_PRIORITY', True) + postinst = '#!/bin/sh\n' + 'update-alternatives --install/' + imagedest + '/' + type + ' ' + type + ' ' + '/' + imagedest + '/' + type + '-${KERNEL_VERSION_NAME} ' + priority + ' || true' + '\n'
Quoted 3 lines
+
d.setVar('pkg_postinst_kernel-image-' + typelower, postinst)
+
+ postrm = '#!/bin/sh\n' + 'update-alternatives --remove' + '' + type + ' ' + type + '-${KERNEL_VERSION_NAME} || true' + '\n'
Quoted 5 lines
+
d.setVar('pkg_postrm_kernel-image-' + typelower, postrm)image =
d.getVar('INITRAMFS_IMAGE', True)if image:
@@ -92,8 +128,8 @@KERNEL_PRIORITY?="${@int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.
Quoted 12 lines
KERNEL_RELEASE ?= "${KERNEL_VERSION}" -# Where built kernel lies in the kernel tree -KERNEL_OUTPUT ?= "arch/${ARCH}/boot/${KERNEL_IMAGETYPE}" +# The directory where built kernel lies in the kernel tree +KERNEL_OUTPUT_DIR ?= "arch/${ARCH}/boot" KERNEL_IMAGEDEST = "boot" # @@ -119,8 +155,6 @@ KERNEL_EXTRA_ARGS ?= "" # We don't want to override kernel Makefile variables from theenvironment
Quoted 5 lines
EXTRA_OEMAKE= ""-KERNEL_ALT_IMAGETYPE ??= ""
-
# Define where the kernel headers are installed on the target aswell as where
Quoted 7 lines
# they are staged. KERNEL_SRC_PATH = "/usr/src/kernel" @@ -166,23 +200,48 @@ copy_initramfs() { echo "Finished copy of initramfs into ./usr" }-INITRAMFS_BASE_NAME =
"${KERNEL_IMAGETYPE}-initramfs-${PV}-${PR}-${MACHINE}-${DATETIME}"
Quoted 5 lines
+INITRAMFS_BASE_NAME = "initramfs-${PV}-${PR}-${MACHINE}-${DATETIME}" INITRAMFS_BASE_NAME[vardepsexclude] = "DATETIME" do_bundle_initramfs () { if [ ! -z "${INITRAMFS_IMAGE}" -ax"${INITRAMFS_IMAGE_BUNDLE}" = x1 ]; then
Quoted 1 line
echo "Creating a kernel image with a bundled
initramfs..."
Quoted 5 lines
copy_initramfs
- if [ -e ${KERNEL_OUTPUT} ] ; then
- mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.bak
- fi
+ # Backuping kernel image relies on its type(regularfile or symbolic link)
Quoted 3 lines
s/Backuping/Backing up/
I'll correct it.
Quoted 6 lines
+ tmp_path=""
+ for type in ${KERNEL_IMAGETYPES} ; do
+ if [ -h ${KERNEL_OUTPUT_DIR}/$type ] ; then
+ linkpath=`readlink -n${KERNEL_OUTPUT_DIR}/$type`
Quoted 1 line
+ realpath=`readlink -fn
${KERNEL_OUTPUT_DIR}/$type`
Quoted 2 lines
+ mv -f $realpath $realpath.bak
+ tmp_path=$tmp_path""$type"#"$linkpath"#"$realpath
Quoted 2 lines
+ elif [ -f ${KERNEL_OUTPUT_DIR}/$type ]; then
+ mv -f ${KERNEL_OUTPUT_DIR}/$type${KERNEL_OUTPUT_DIR}/$type.bak
Quoted 4 lines
+ tmp_path=$tmp_path" "$type"##"
+ fi
+ doneuse_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
Quoted 7 lines
kernel_do_compile
- mv -f ${KERNEL_OUTPUT} ${KERNEL_OUTPUT}.initramfs
- mv -f ${KERNEL_OUTPUT}.bak ${KERNEL_OUTPUT}
+ # Restoring kernel image
+ for tp in $tmp_path ; do
+ type=echo $tp|cut -d "#" -f 1
+ linkpath=echo $tp|cut -d "#" -f 2Quoted 8 lines
+ realpath=
echo $tp|cut -d "#" -f 3
+ if [ -n "$realpath" ]; then
+ mv -f $realpath $realpath.initramfs
+ mv -f $realpath.bak $realpath
+ cd ${B}/${KERNEL_OUTPUT_DIR}
+ ln -sf $linkpath.initramfs
+ else
+ mv -f ${KERNEL_OUTPUT_DIR}/$type${KERNEL_OUTPUT_DIR}/$type.initramfs
Quoted 1 line
+ mv -f ${KERNEL_OUTPUT_DIR}/$type.bak
${KERNEL_OUTPUT_DIR}/$type
Quoted 4 lines
+ fi
+ done
# Update install area
- echo "There is kernel image bundled with initramfs:${B}/${KERNEL_OUTPUT}.initramfs"
Quoted 1 line
- install -m 0644 ${B}/${KERNEL_OUTPUT}.initramfs
${D}/boot/${KERNEL_IMAGETYPE}-initramfs-${MACHINE}.bin
Quoted 3 lines
- echo "${B}/${KERNEL_OUTPUT}.initramfs"
+ for type in ${KERNEL_IMAGETYPES} ; do
+ echo "There is kernel image bundled withinitramfs: ${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs"
Quoted 1 line
+ install -m 0644
${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs
${D}/boot/$type-initramfs-${MACHINE}.binQuoted 1 line
+ echo
"${B}/${KERNEL_OUTPUT_DIR}/$type.initramfs"
Quoted 7 lines
+ done fi } @@ -207,10 +266,15 @@ kernel_do_compile() { copy_initramfsuse_alternate_initrd=CONFIG_INITRAMFS_SOURCE=${B}/usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio
Quoted 2 lines
fi
-oe_runmake${KERNEL_IMAGETYPE_FOR_MAKE}${KERNEL_ALT_IMAGETYPE} CC="${KERNEL_CC}" LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
Quoted 1 line
- if test "${KERNEL_IMAGETYPE_FOR_MAKE}.gz" =
"${KERNEL_IMAGETYPE}"; then
Quoted 1 line
- gzip -9c < "${KERNEL_IMAGETYPE_FOR_MAKE}" >
"${KERNEL_OUTPUT}"
Quoted 2 lines
- fi
+oe_runmake${KERNEL_IMAGETYPE_FOR_MAKE} CC="${KERNEL_CC}"LD="${KERNEL_LD}" ${KERNEL_EXTRA_ARGS} $use_alternate_initrd
Quoted 4 lines
This is probably something that is worth mentioning in the top of the
commit message. You are
Quoted 1 line
building multiple kernel image types, but they are all currently using
the same configuration.
Quoted 2 lines
If the make invokations were split into separate calls per image type,
we could conceivably
Quoted 2 lines
extend this to generate and use a separate config int he future.
OK. Let me test if there is any side effect after putting this make in a type loop.
Quoted 4 lines
+ for typeformake in ${KERNEL_IMAGETYPE_FOR_MAKE} ; do
+ for type in ${KERNEL_IMAGETYPES} ; do
+ if test "${typeformake}.gz" = "${type}"; then
+ gzip -9c < "${typeformake}" >"${KERNEL_OUTPUT_DIR}/${type}"
Quoted 4 lines
+ break; + fi + done + doneQuoted 8 lines
} do_compile_kernelmodules() { @@ -251,7 +315,9 @@ kernel_do_install() { # install -d ${D}/${KERNEL_IMAGEDEST} install -d ${D}/boot - install -m 0644 ${KERNEL_OUTPUT}${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION}
Quoted 2 lines
+ for type in ${KERNEL_IMAGETYPES} ; do
+ install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}${D}/${KERNEL_IMAGEDEST}/${type}-${KERNEL_VERSION}
Quoted 2 lines
+ done
install -m 0644 System.map${D}/boot/System.map-${KERNEL_VERSION}
Quoted 3 lines
install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION} install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION} @@ -365,12 +431,12 @@ EXPORT_FUNCTIONS do_compile do_install
do_configureQuoted 1 line
PACKAGES = "kernel kernel-base kernel-vmlinux kernel-image
kernel-dev kernel-modules"
Quoted 2 lines
FILES_${PN} = "" FILES_kernel-base = "/lib/modules/${KERNEL_VERSION}/modules.order
/lib/modules/${KERNEL_VERSION}/modules.builtin"Quoted 3 lines
-FILES_kernel-image = "
/boot/${KERNEL_IMAGETYPE}*" +FILES_kernel-image = ""
FILES_kernel-dev = "/boot/System.map*/boot/Module.symvers*
/boot/config*${KERNEL_SRC_PATH}/lib/modules/${KERNEL_VERSION}/build"Quoted 4 lines
FILES_kernel-vmlinux = "
/boot/vmlinux*" FILES_kernel-modules = ""
RDEPENDS_kernel= "kernel-base"
-# Allow machines to override this dependency if kernel image filesare
Quoted 1 line
+# Allow machines to override this dependency if kernel image files
are
Quoted 3 lines
# not wanted in images as standard RDEPENDS_kernel-base ?= "kernel-image" PKG_kernel-image ="kernel-image-${@legitimize_package_name('${KERNEL_VERSION}')}"
Quoted 6 lines
@@ -394,14 +460,6 @@ pkg_postinst_kernel-base () { fi } -pkg_postinst_kernel-image () { - update-alternatives --install/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE} ${KERNEL_IMAGETYPE} /${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_VERSION} ${KERNEL_PRIORITY} || true
Quoted 4 lines
-} - -pkg_postrm_kernel-image () { - update-alternatives --remove ${KERNEL_IMAGETYPE}${KERNEL_IMAGETYPE}-${KERNEL_VERSION} || true
Quoted 11 lines
-} - PACKAGESPLITFUNCS_prepend = "split_kernel_packages " python split_kernel_packages () { @@ -422,13 +480,13 @@ do_kernel_link_vmlinux() { do_strip() { if [ -n "${KERNEL_IMAGE_STRIP_EXTRA_SECTIONS}" ]; then - if [ "${KERNEL_IMAGETYPE}" != "vmlinux" ]; then - bbwarn "image type will not be stripped (notsupported): ${KERNEL_IMAGETYPE}"
Quoted 1 line
+ if ! (echo "${KERNEL_IMAGETYPES}" | grep -q
"vmlinux"); then
Quoted 3 lines
You had used the \bfitImage\b, but here you don't .. grep -w could work
for them all.
I'll correct it.
Quoted 3 lines
+ bbwarn "image type(s) will not be stripped
(not supported): ${KERNEL_IMAGETYPES}"
Quoted 3 lines
Quoted 7 lines
Quoted 1 line
But on another note. Is it really right to say that none of the images
will be stripped if you
Quoted 2 lines
find vmlinux anywhere in the image type list ?
Not clear what you mean here.
Consider that there are a list of image types in KERNEL_IMAGETYPES, and most of them
could be stripped, but that list contains vmlinux. The test above will avoid stripping any
of them, where the intent was really to not strip vmlinux, and only vmlinux.
Quoted 219 lines
Quoted 6 lines
return
ficd ${B}
- headers=`"$CROSS_COMPILE"readelf -S ${KERNEL_OUTPUT}| \
Quoted 1 line
+ headers=`"$CROSS_COMPILE"readelf -S
${KERNEL_OUTPUT_DIR}/vmlinux | \
Quoted 8 lines
grep "^ \{1,\}\[[0-9 ]\{1,\}\] [^ ]" | \ sed "s/^ \{1,\}\[[0-9 ]\{1,\}\] //" | \ gawk '{print $1}'` @@ -438,7 +496,7 @@ do_strip() { bbwarn "Section not found: $str"; fi - "$CROSS_COMPILE"strip -s -R $str${KERNEL_OUTPUT}
Quoted 1 line
+ "$CROSS_COMPILE"strip -s -R $str
${KERNEL_OUTPUT_DIR}/vmlinux
Quoted 3 lines
}; done
bbnote "
KERNEL_IMAGE_STRIP_EXTRA_SECTIONSis set,stripping sections:" \
Quoted 3 lines
@@ -457,20 +515,22 @@ do_sizecheck() { if [ -n "$invalid" ]; then die "Invalid KERNEL_IMAGE_MAXSIZE:${KERNEL_IMAGE_MAXSIZE}, should be an integerx (The unit is Kbytes)"
Quoted 2 lines
fi
- size=`du -ks ${B}/${KERNEL_OUTPUT} | awk '{ print$1}'`
Quoted 2 lines
- if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
- die "This kernel (size=$size(K) >${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device. Please reduce the size of the kernel by making more of it modular."
Quoted 3 lines
- fi
+ for type in ${KERNEL_IMAGETYPES} ; do
+ size=`du -ks ${B}/${KERNEL_OUTPUT_DIR}/$type| awk '{print $1}'`
Quoted 1 line
+ if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ];
then
Quoted 1 line
+ die "This kernel $type
(size=$size(K) > ${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device. Please reduce the size of the kernel by making more of it modular."
Quoted 3 lines
Hmm. Again here. Multiple image types are being built. If one of them is
too large for the device,
Quoted 1 line
who's to say that that's the one that is going to be used ? Maybe this
should be a warn, instead
Quoted 2 lines
of a die ?
Fair point. A warn is OK.
Quoted 9 lines
+ fi
+ done
fi
}
do_sizecheck[dirs] = "${B}"addtask sizecheck before
do_installafterdo_strip-KERNEL_IMAGE_BASE_NAME ?=
"${KERNEL_IMAGETYPE}-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
Quoted 1 line
+KERNEL_IMAGE_BASE_NAME ?=
"${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
Quoted 1 line
# Don't include the DATETIME variable in the sstate package
signatures
Quoted 4 lines
KERNEL_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME" -KERNEL_IMAGE_SYMLINK_NAME ?= "${KERNEL_IMAGETYPE}-${MACHINE}" +KERNEL_IMAGE_SYMLINK_NAME ?= "${MACHINE}" MODULE_IMAGE_BASE_NAME ?="modules-${PKGE}-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}"
Quoted 3 lines
MODULE_IMAGE_BASE_NAME[vardepsexclude] = "DATETIME" MODULE_TARBALL_BASE_NAME ?= "${MODULE_IMAGE_BASE_NAME}.tgz" @@ -479,28 +539,37 @@ MODULE_TARBALL_SYMLINK_NAME ?="modules-${MACHINE}.tgz"
Quoted 4 lines
MODULE_TARBALL_DEPLOY?= "1"
kernel_do_deploy(){
- install -m 0644 ${KERNEL_OUTPUT}${DEPLOYDIR}/${KERNEL_IMAGE_BASE_NAME}.bin
Quoted 3 lines
+ for type in ${KERNEL_IMAGETYPES} ; do
+ base_name=${type}-${KERNEL_IMAGE_BASE_NAME}
+ install -m 0644 ${KERNEL_OUTPUT_DIR}/${type}${DEPLOYDIR}/${base_name}.bin
Quoted 2 lines
+ done
if [ ${MODULE_TARBALL_DEPLOY} = "1" ] && (grep -q -i -e'^CONFIG_MODULES=y$' .config); then
Quoted 2 lines
mkdir -p ${D}/lib tar -cvzf ${DEPLOYDIR}/${MODULE_TARBALL_BASE_NAME}-C ${D} lib
Quoted 1 line
ln -sf ${MODULE_TARBALL_BASE_NAME}${DEPLOYDIR}/${MODULE_TARBALL_SYMLINK_NAME}
Quoted 3 lines
fi
- ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin
${DEPLOYDIR}/${KERNEL_IMAGE_SYMLINK_NAME}.bin
Quoted 1 line
- ln -sf ${KERNEL_IMAGE_BASE_NAME}.bin
${DEPLOYDIR}/${KERNEL_IMAGETYPE}
Quoted 4 lines
+ for type in ${KERNEL_IMAGETYPES} ; do
+ base_name=${type}-${KERNEL_IMAGE_BASE_NAME}
+ symlink_name=${type}-${KERNEL_IMAGE_SYMLINK_NAME}
+ ln -sf ${base_name}.bin${DEPLOYDIR}/${symlink_name}.bin
Quoted 4 lines
+ ln -sf ${base_name}.bin ${DEPLOYDIR}/${type}
+ donecp
${COREBASE}/meta/files/deploydir_readme.txt
${DEPLOYDIR}/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txtQuoted 5 lines
cd ${B}
# Update deploy directory
- if [ -e "${KERNEL_OUTPUT}.initramfs" ]; then
- echo "Copying deploy kernel-initramfs image andsetting up links..."
Quoted 2 lines
- initramfs_base_name=${INITRAMFS_BASE_NAME}
-initramfs_symlink_name=${KERNEL_IMAGETYPE}-initramfs-${MACHINE}
Quoted 1 line
- install -m 0644 ${KERNEL_OUTPUT}.initramfs
${DEPLOYDIR}/${initramfs_base_name}.bin
Quoted 2 lines
- cd ${DEPLOYDIR}
- ln -sf ${initramfs_base_name}.bin${initramfs_symlink_name}.bin
Quoted 3 lines
- fi
+ for type in ${KERNEL_IMAGETYPES} ; do
+ if [ -e "${KERNEL_OUTPUT_DIR}/${type}.initramfs" ];then
Quoted 1 line
+ echo "Copying deploy ${type}
kernel-initramfs image and setting up links..."
Quoted 1 line
+initramfs_base_name=${type}-${INITRAMFS_BASE_NAME}
Quoted 1 line
+initramfs_symlink_name=${type}-initramfs-${MACHINE}
Quoted 1 line
+ install -m 0644
${KERNEL_OUTPUT_DIR}/${type}.initramfs
${DEPLOYDIR}/${initramfs_base_name}.binQuoted 2 lines
+ cd ${DEPLOYDIR}
+ ln -sf ${initramfs_base_name}.bin${initramfs_symlink_name}.bin
Quoted 6 lines
+ fi + done } do_deploy[cleandirs] = "${DEPLOYDIR}" do_deploy[dirs] = "${DEPLOYDIR} ${B}" diff --git a/meta/conf/documentation.conf
b/meta/conf/documentation.confQuoted 4 lines
index 00a69da..b3969b0 100644 --- a/meta/conf/documentation.conf +++ b/meta/conf/documentation.conf @@ -246,6 +246,7 @@ KERNEL_CLASSES[doc] = "A list of classesdefining kernel image types that kernel
Quoted 1 line
KERNEL_EXTRA_ARGS[doc] = "Specifies additional make command-line
arguments the OpenEmbedded build system passes on when compiling the kernel."
Quoted 1 line
KERNEL_FEATURES[doc] = "Includes additional metadata from the Yocto
Project kernel Git repository. The metadata you add through this variable includes config fragments and features descriptions."
Quoted 1 line
KERNEL_IMAGETYPE[doc] = "The type of kernel to build for a device,
usually set by the machine configuration files and defaults to 'zImage'."
Quoted 1 line
+KERNEL_IMAGETYPES[doc] = "The list of types of kernel to build for
a device, usually set by the machine configuration files and defaults to
KERNEL_IMAGETYPE."Quoted 1 line
KERNEL_MODULE_AUTOLOAD[doc] = "Lists kernel modules that need to be
auto-loaded during boot"
Quoted 1 line
KERNEL_MODULE_PROBECONF[doc] = "Lists kernel modules for which the
build system expects to find module_conf_* values that specify configuration for each of the modules"
Quoted 1 line
KERNEL_PATH[doc] = "The location of the kernel sources. This
variable is set to the value of the
STAGING_KERNEL_DIRwithin the module class (module.bbclass)."Quoted 1 line
diff --git a/meta/conf/machine/qemumips.conf
b/meta/conf/machine/qemumips.confQuoted 6 lines
index fbf8137..67ce161 100644 --- a/meta/conf/machine/qemumips.conf +++ b/meta/conf/machine/qemumips.conf @@ -6,7 +6,7 @@ require conf/machine/include/qemu.inc require conf/machine/include/tune-mips32r2.incQuoted 7 lines
KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS1" diff --git a/meta/conf/machine/qemumips64.conf
b/meta/conf/machine/qemumips64.confQuoted 6 lines
index 8c3f1fe..393212e 100644 --- a/meta/conf/machine/qemumips64.conf +++ b/meta/conf/machine/qemumips64.conf @@ -6,7 +6,7 @@ require conf/machine/include/qemu.inc require conf/machine/include/tune-mips64.incQuoted 7 lines
KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" SERIAL_CONSOLES = "115200;ttyS0 115200;ttyS1" diff --git a/meta/recipes-kernel/linux/linux-dtb.incb/meta/recipes-kernel/linux/linux-dtb.inc
Quoted 8 lines
index 651a19e..74f5ef8 100644 --- a/meta/recipes-kernel/linux/linux-dtb.inc +++ b/meta/recipes-kernel/linux/linux-dtb.inc @@ -34,9 +34,12 @@ do_install_append() { for DTB in ${KERNEL_DEVICETREE}; do DTB=`normalize_dtb "${DTB}"` DTB_BASE_NAME=`basename ${DTB} .dtb` - DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME}| sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
Quoted 2 lines
- DTB_PATH=
get_real_dtb_path_in_kernel "${DTB}"
- install -m 0644 ${DTB_PATH}${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
Quoted 2 lines
+ for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
+symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
Quoted 2 lines
Quoted 7 lines
Quoted 1 line
If there are multiple image types being built, is this valid for them
all ?
Add these links for convenience. If we give different configurations to different types of images in the future, as you pointed above, we might also need different dtb.
Sounds good.
Quoted 131 lines
Quoted 4 lines
+ DTB_SYMLINK_NAME=`echo ${symlink_name} | sed
"s/${MACHINE}/${DTB_BASE_NAME}/g"`
Quoted 1 line
+ DTB_PATH=`get_real_dtb_path_in_kernel
"${DTB}"`
Quoted 1 line
+ install -m 0644 ${DTB_PATH}
${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
Quoted 9 lines
+ done done } @@ -44,31 +47,39 @@ do_deploy_append() { for DTB in ${KERNEL_DEVICETREE}; do DTB=`normalize_dtb "${DTB}"` DTB_BASE_NAME=`basename ${DTB} .dtb` - DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed"s/${MACHINE}/${DTB_BASE_NAME}/g"`
Quoted 1 line
- DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME}
| sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
Quoted 3 lines
- DTB_PATH=`get_real_dtb_path_in_kernel "${DTB}"` - install -d ${DEPLOYDIR} - install -m 0644 ${DTB_PATH}${DEPLOYDIR}/${DTB_NAME}.dtb
Quoted 1 line
- ln -sf ${DTB_NAME}.dtb
${DEPLOYDIR}/${DTB_SYMLINK_NAME}.dtb
Quoted 3 lines
+ for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
+ base_name=${type}"-"${KERNEL_IMAGE_BASE_NAME}
+symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
Quoted 1 line
+ DTB_NAME=`echo ${base_name} | sed
"s/${MACHINE}/${DTB_BASE_NAME}/g"`
Quoted 1 line
+ DTB_SYMLINK_NAME=`echo ${symlink_name} | sed
"s/${MACHINE}/${DTB_BASE_NAME}/g"`
Quoted 1 line
+ DTB_PATH=`get_real_dtb_path_in_kernel
"${DTB}"`
Quoted 2 lines
+ install -d ${DEPLOYDIR}
+ install -m 0644 ${DTB_PATH}${DEPLOYDIR}/${DTB_NAME}.dtb
Quoted 1 line
+ ln -sf ${DTB_NAME}.dtb
${DEPLOYDIR}/${DTB_SYMLINK_NAME}.dtb
Quoted 9 lines
+ done
done
}pkg_postinst_kernel-devicetree () {
cd /${KERNEL_IMAGEDEST}
- for DTB in ${KERNEL_DEVICETREE}
- do
- DTB_BASE_NAME=`basename ${DTB} | awk -F "." '{print$1}'`
Quoted 1 line
- DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME}
| sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
Quoted 1 line
- update-alternatives --install
/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb
/boot/devicetree-${DTB_SYMLINK_NAME}.dtb${KERNEL_PRIORITY} || trueQuoted 3 lines
+ for DTB in ${KERNEL_DEVICETREE}; do
+ for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
+symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
Quoted 1 line
+ DTB_BASE_NAME=`basename ${DTB} | awk -F "."
'{print $1}'`
Quoted 1 line
+ DTB_SYMLINK_NAME=`echo ${symlink_name} | sed
"s/${MACHINE}/${DTB_BASE_NAME}/g"`
Quoted 1 line
+ update-alternatives --install
/${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb
/boot/devicetree-${DTB_SYMLINK_NAME}.dtb${KERNEL_PRIORITY} || trueQuoted 9 lines
+ done
done
}pkg_postrm_kernel-devicetree () {
cd /${KERNEL_IMAGEDEST}
- for DTB in ${KERNEL_DEVICETREE}
- do
- DTB_BASE_NAME=`basename ${DTB} | awk -F "." '{print$1}'`
Quoted 1 line
- DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME}
| sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
Quoted 1 line
- update-alternatives --remove ${DTB_BASE_NAME}.dtb
/boot/devicetree-${DTB_SYMLINK_NAME}.dtb${KERNEL_PRIORITY} || trueQuoted 3 lines
+ for DTB in ${KERNEL_DEVICETREE}; do
+ for type in ${KERNEL_IMAGETYPE_FOR_MAKE}; do
+symlink_name=${type}"-"${KERNEL_IMAGE_SYMLINK_NAME}
Quoted 1 line
+ DTB_BASE_NAME=`basename ${DTB} | awk -F "."
'{print $1}'`
Quoted 1 line
+ DTB_SYMLINK_NAME=`echo ${symlink_name} | sed
"s/${MACHINE}/${DTB_BASE_NAME}/g"`
Quoted 1 line
+ update-alternatives --remove
${DTB_BASE_NAME}.dtb
/boot/devicetree-${DTB_SYMLINK_NAME}.dtb${KERNEL_PRIORITY} || trueQuoted 4 lines
+ done done } diff --git
a/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.confb/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.confQuoted 2 lines
index b319d62..e4a6f30 100644 ---
a/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.confQuoted 1 line
+++
b/scripts/lib/bsp/substrate/target/arch/mips/conf/machine/machine.confQuoted 9 lines
@@ -9,7 +9,7 @@ require conf/machine/include/tune-mips32.inc
MACHINE_FEATURES= "screen keyboard pci usbhost ext2 ext3 serial"
KERNEL_IMAGETYPE= "vmlinux"
-KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin"
KERNEL_IMAGE_STRIP_EXTRA_SECTIONS= ".comment"{{ if
kernel_choice== "custom":preferred_kernel="linux-yocto-custom" }}
Quoted 1 line
diff --git
a/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.confb/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.confQuoted 2 lines
index 3afc5e0..2c2d8af 100644 ---
a/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.confQuoted 1 line
+++
b/scripts/lib/bsp/substrate/target/arch/mips64/conf/machine/machine.confQuoted 9 lines
@@ -9,7 +9,7 @@ require conf/machine/include/tune-mips64.inc
MACHINE_FEATURES= "pci ext2 ext3 serial"
KERNEL_IMAGETYPE= "vmlinux"
-KERNEL_ALT_IMAGETYPE = "vmlinux.bin"
+KERNEL_IMAGETYPES = "vmlinux.bin"
Quoted 5 lines
Quoted 2 lines
Again, why can't vmlinux just bein in
KERNEL_IMAGETYPES?Discussed above.
Thanks for the quick follow up!
Cheers,
Bruce
Quoted 45 lines
Thanks,
ZheQuoted 6 lines
Bruce
KERNEL_IMAGE_STRIP_EXTRA_SECTIONS= ".comment"{{ if
kernel_choice== "custom":preferred_kernel="linux-yocto-custom" }}
Quoted 1 line
diff --git
a/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.confb/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.confQuoted 2 lines
index 67e1cbd..7a0a4d3 100644 ---
a/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.confQuoted 1 line
+++
b/scripts/lib/bsp/substrate/target/arch/qemu/conf/machine/machine.confQuoted 7 lines
@@ -69,6 +69,6 @@ SERIAL_CONSOLE = "115200 ttyS0" {{ if qemuarch == "mips" or qemuarch == "mips64": }} KERNEL_IMAGETYPE = "vmlinux" -KERNEL_ALT_IMAGETYPE = "vmlinux.bin" +KERNEL_IMAGETYPES = "vmlinux.bin" SERIAL_CONSOLE = "115200 ttyS0"Quoted 8 lines
MACHINE_EXTRA_RRECOMMENDS = " kernel-modules" -- 1.9.1 -- _______________________________________________ Openembedded-core mailing list [email protected] <mailto:Quoted 7 lines
http://lists.openembedded.org/mailman/listinfo/openembedded-core
--
"Thou shalt not follow the NULL pointer, for chaos and madness awaitthee at its end"
Signature · 2 lines
"Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end"
PATCH v2 2/2 kernel: Make symbol link to vmlinuz in boot directory
In reply to [email protected]From: He Zhe <[email protected]>
Rename do_kernel_link_vmlinux to do_kernel_link_images and make a symbol link to vmlinuz(if exists) for reference in arch/$arch/boot directory.
--- documentation/ref-manual/ref-tasks.xml | 8 ++++---- meta/classes/kernel.bbclass | 13 ++++++++----- meta/conf/documentation.conf | 2 +- meta/recipes-kernel/linux/linux-yocto.inc | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-)
documentation/ref-manual/ref-tasks.xml +4 -4
@@ -663,13 +663,13 @@ </para> </section> - <section id='ref-tasks-kernel_link_vmlinux'> - <title><filename>do_kernel_link_vmlinux</filename></title> + <section id='ref-tasks-kernel_link_images'> + <title><filename>do_kernel_link_images</filename></title> <para> Creates a symbolic link in - <filename>arch/$arch/boot</filename> for vmlinux kernel - images. + <filename>arch/$arch/boot</filename> for vmlinux and vmlinuz + kernel images. </para> </section>
meta/classes/kernel.bbclass +8 -5
@@ -467,15 +467,18 @@ python split_kernel_packages () { } # Many scripts want to look in arch/$arch/boot for the bootable -# image. This poses a problem for vmlinux based booting. This -# task arranges to have vmlinux appear in the normalized directory -# location. -do_kernel_link_vmlinux() { +# image. This poses a problem for vmlinux and vmlinuz based +# booting. This task arranges to have vmlinux and vmlinuz appear +# in the normalized directory location. +do_kernel_link_images() { if [ ! -d "${B}/arch/${ARCH}/boot" ]; then mkdir ${B}/arch/${ARCH}/boot fi cd ${B}/arch/${ARCH}/boot ln -sf ../../../vmlinux + if [ -f ../../../vmlinuz ]; then + ln -sf ../../../vmlinuz + fi } do_strip() {
@@ -505,7 +508,7 @@ do_strip() { } do_strip[dirs] = "${B}" -addtask do_strip before do_sizecheck after do_kernel_link_vmlinux +addtask do_strip before do_sizecheck after do_kernel_link_images # Support checking the kernel size since some kernels need to reside in partitions # with a fixed length or there is a limit in transferring the kernel to memory
meta/conf/documentation.conf +1 -1
@@ -28,7 +28,7 @@ do_install_ptest_base[doc] = "Copies the runtime test suite files from the compi do_kernel_checkout[doc] = "Checks out source/meta branches for a linux-yocto style kernel" do_kernel_configcheck[doc] = "Validates the kernel configuration for a linux-yocto style kernel" do_kernel_configme[doc] = "Assembles the kernel configuration for a linux-yocto style kernel" -do_kernel_link_vmlinux[doc] = "Creates a symbolic link in arch/$arch/boot for vmlinux kernel images" +do_kernel_link_images[doc] = "Creates a symbolic link in arch/$arch/boot for vmlinux and vmlinuz kernel images" do_listtasks[doc] = "Lists all defined tasks for a target" do_menuconfig[doc] = "Runs 'make menuconfig' for the kernel" do_package[doc] = "Analyzes the content of the holding area and splits it into subsets based on available packages and files"
meta/recipes-kernel/linux/linux-yocto.inc +1 -1
@@ -52,6 +52,6 @@ do_install_append(){ } # extra tasks -addtask kernel_link_vmlinux after do_compile before do_install +addtask kernel_link_images after do_compile before do_install addtask validate_branches before do_patch after do_kernel_checkout addtask kernel_configcheck after do_configure before do_compile
Signature · 1 line
1.9.1
Re: [PATCH v2 2/2] kernel: Make symbol link to vmlinuz in boot directory
Quoted 5 lines · On 19 February 2016 at 09:56, <[email protected]> wrote:
documentation/ref-manual/ref-tasks.xml | 8 ++++---- meta/classes/kernel.bbclass | 13 ++++++++----- meta/conf/documentation.conf | 2 +- meta/recipes-kernel/linux/linux-yocto.inc | 2 +-
documentation/ is actually a separate git repo (yocto-docs), please submit a patch to yocto@ (with [yocto-docs] in the subject) when this patch is merged into oe-core.
Ross