* [PATCH 0/2] ppp build fix for musl + 4.9 headers
From: Jussi Kukkonen @ 2016-12-28 14:45 UTC (permalink / raw)
To: openembedded-core
These patches should apply to master but are meant for current
ross/mut: ppp fails to build on musl when the 4.9 headers are used.
Thanks to Khem for the patch suggestion.
Jussi
The following changes since commit 1dc1894e05ef0f3aeeefa61ed89613f17bba2e83:
cairo: set license for cairo-doc (2016-12-22 20:29:28 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib jku/ppp-fix-for-mut
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=jku/ppp-fix-for-mut
Jussi Kukkonen (2):
ppp: Partly remove patch that doesn't make sense any more
ppp: Add patch to fix build with musl and 4.9 headers
...01-ppp-Fix-compilation-errors-in-Makefile.patch | 51 ++--------------------
.../ppp/ppp/0001-ppp-Remove-unneeded-include.patch | 43 ++++++++++++++++++
meta/recipes-connectivity/ppp/ppp_2.4.7.bb | 1 +
3 files changed, 47 insertions(+), 48 deletions(-)
create mode 100644 meta/recipes-connectivity/ppp/ppp/0001-ppp-Remove-unneeded-include.patch
--
2.1.4
^ permalink raw reply
* [PATCH 1/2] ppp: Partly remove patch that doesn't make sense any more
From: Jussi Kukkonen @ 2016-12-28 14:45 UTC (permalink / raw)
To: openembedded-core
In-Reply-To: <cover.1482936066.git.jussi.kukkonen@intel.com>
ppp no longer provides the duplicate if_pppox.h header so no need to patch that
out of the Makefile.
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
...01-ppp-Fix-compilation-errors-in-Makefile.patch | 51 ++--------------------
1 file changed, 3 insertions(+), 48 deletions(-)
diff --git a/meta/recipes-connectivity/ppp/ppp/0001-ppp-Fix-compilation-errors-in-Makefile.patch b/meta/recipes-connectivity/ppp/ppp/0001-ppp-Fix-compilation-errors-in-Makefile.patch
index 8aa2d2e..ea4969b 100644
--- a/meta/recipes-connectivity/ppp/ppp/0001-ppp-Fix-compilation-errors-in-Makefile.patch
+++ b/meta/recipes-connectivity/ppp/ppp/0001-ppp-Fix-compilation-errors-in-Makefile.patch
@@ -3,34 +3,14 @@ From: Lu Chong <Chong.Lu@windriver.com>
Date: Tue, 5 Nov 2013 17:32:56 +0800
Subject: [PATCH] ppp: Fix compilation errors in Makefile
-This patch fixes below issues:
-
-1. Make can't exit while compilation error occurs in subdir for plugins building.
-
-2. If build ppp with newer kernel (3.10.10), it will pick 'if_pppox.h' from sysroot-dir and
- 'if_pppol2tp.h' from its own source dir, this cause below build errors:
-
- bitbake_build/tmp/sysroots/intel-x86-64/usr/include/linux/if_pppox.h:84:26:
- error: field 'pppol2tp' has incomplete type
- struct pppol2tpin6_addr pppol2tp;
- ^
- bitbake_build/tmp/sysroots/intel-x86-64/usr/include/linux/if_pppox.h:99:28:
- error: field 'pppol2tp' has incomplete type
- struct pppol2tpv3in6_addr pppol2tp;
- ^
-
-The 'sysroot-dir/if_pppox.h' enabled ipv6 support but the 'source-dir/if_pppol2tp.h' lost
-related structure definitions, we should use both header files from sysroots to fix this
-build failure.
+Make can't exit while compilation error occurs in subdir for plugins building.
Upstream-Status: Pending
Signed-off-by: Lu Chong <Chong.Lu@windriver.com>
---
- pppd/plugins/Makefile.linux | 2 +-
- pppd/plugins/pppol2tp/Makefile.linux | 2 +-
- pppd/plugins/rp-pppoe/Makefile.linux | 2 +-
- 3 files changed, 3 insertions(+), 3 deletions(-)
+ pppd/plugins/Makefile.linux | 1 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/pppd/plugins/Makefile.linux b/pppd/plugins/Makefile.linux
index 0a7ec7b..2a2c15a 100644
@@ -45,31 +25,6 @@ index 0a7ec7b..2a2c15a 100644
%.so: %.c
$(CC) -o $@ $(LDFLAGS) $(CFLAGS) $^
-diff --git a/pppd/plugins/pppol2tp/Makefile.linux b/pppd/plugins/pppol2tp/Makefile.linux
-index 19eff67..feb2f52 100644
---- a/pppd/plugins/pppol2tp/Makefile.linux
-+++ b/pppd/plugins/pppol2tp/Makefile.linux
-@@ -1,6 +1,6 @@
- #CC = gcc
- COPTS = -O2 -g
--CFLAGS = $(COPTS) -I. -I../.. -I../../../include -fPIC
-+CFLAGS = $(COPTS) -I. -I../.. -fPIC
- LDFLAGS = -shared
- INSTALL = install
-
-diff --git a/pppd/plugins/rp-pppoe/Makefile.linux b/pppd/plugins/rp-pppoe/Makefile.linux
-index f078991..15b9118 100644
---- a/pppd/plugins/rp-pppoe/Makefile.linux
-+++ b/pppd/plugins/rp-pppoe/Makefile.linux
-@@ -26,7 +26,7 @@ INSTALL = install
- RP_VERSION=3.8p
-
- COPTS=-O2 -g
--CFLAGS=$(COPTS) -I../../../include '-DRP_VERSION="$(RP_VERSION)"'
-+CFLAGS=$(COPTS) '-DRP_VERSION="$(RP_VERSION)"'
- all: rp-pppoe.so pppoe-discovery
-
- pppoe-discovery: pppoe-discovery.o debug.o
--
1.7.9.5
--
2.1.4
^ permalink raw reply related
* [PATCH 2/2] ppp: Add patch to fix build with musl and 4.9 headers
From: Jussi Kukkonen @ 2016-12-28 14:45 UTC (permalink / raw)
To: openembedded-core
In-Reply-To: <cover.1482936066.git.jussi.kukkonen@intel.com>
Removing unused includes fixes the build.
Fixes [YOCTO #10853].
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
.../ppp/ppp/0001-ppp-Remove-unneeded-include.patch | 43 ++++++++++++++++++++++
meta/recipes-connectivity/ppp/ppp_2.4.7.bb | 1 +
2 files changed, 44 insertions(+)
create mode 100644 meta/recipes-connectivity/ppp/ppp/0001-ppp-Remove-unneeded-include.patch
diff --git a/meta/recipes-connectivity/ppp/ppp/0001-ppp-Remove-unneeded-include.patch b/meta/recipes-connectivity/ppp/ppp/0001-ppp-Remove-unneeded-include.patch
new file mode 100644
index 0000000..a32f89f
--- /dev/null
+++ b/meta/recipes-connectivity/ppp/ppp/0001-ppp-Remove-unneeded-include.patch
@@ -0,0 +1,43 @@
+commit cd90fd147844a0cfec101f1e2db7a3c59d236621
+Author: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Wed Dec 28 14:11:22 2016 +0200
+
+pppol2tp plugin: Remove unneeded include
+
+The include is not required and will break compile on musl libc with
+
+| In file included from pppol2tp.c:34:0:
+| /usr/include/linux/if.h:97:2: error: expected identifier before numeric constant
+| IFF_LOWER_UP = 1<<16, /* __volatile__ */
+
+Patch originally from Khem Raj.
+
+Upstream-Status: Pending [https://github.com/paulusmack/ppp/issues/73]
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+
+diff --git a/pppd/plugins/pppol2tp/openl2tp.c b/pppd/plugins/pppol2tp/openl2tp.c
+index 9643b96..458316b 100644
+--- a/pppd/plugins/pppol2tp/openl2tp.c
++++ b/pppd/plugins/pppol2tp/openl2tp.c
+@@ -47,7 +47,6 @@
+ #include <linux/if_ether.h>
+ #include <linux/ppp_defs.h>
+ #include <linux/if_ppp.h>
+-#include <linux/if_pppox.h>
+ #include <linux/if_pppol2tp.h>
+
+ #include "l2tp_event.h"
+diff --git a/pppd/plugins/pppol2tp/pppol2tp.c b/pppd/plugins/pppol2tp/pppol2tp.c
+index 0e28606..4f6d98c 100644
+--- a/pppd/plugins/pppol2tp/pppol2tp.c
++++ b/pppd/plugins/pppol2tp/pppol2tp.c
+@@ -46,7 +46,6 @@
+ #include <linux/if_ether.h>
+ #include <linux/ppp_defs.h>
+ #include <linux/if_ppp.h>
+-#include <linux/if_pppox.h>
+ #include <linux/if_pppol2tp.h>
+
+ /* should be added to system's socket.h... */
+---
+
diff --git a/meta/recipes-connectivity/ppp/ppp_2.4.7.bb b/meta/recipes-connectivity/ppp/ppp_2.4.7.bb
index 56dbd98..86ada69 100644
--- a/meta/recipes-connectivity/ppp/ppp_2.4.7.bb
+++ b/meta/recipes-connectivity/ppp/ppp_2.4.7.bb
@@ -31,6 +31,7 @@ SRC_URI = "http://ppp.samba.org/ftp/ppp/ppp-${PV}.tar.gz \
file://ppp@.service \
file://fix-CVE-2015-3310.patch \
file://ppp-fix-building-with-linux-4.8.patch \
+ file://0001-ppp-Remove-unneeded-include.patch \
"
SRC_URI_append_libc-musl = "\
--
2.1.4
^ permalink raw reply related
* Re: [PATCH 0/9] UEFI + Secure Boot + qemu
From: Patrick Ohly @ 2016-12-28 19:27 UTC (permalink / raw)
To: Ricardo Neri; +Cc: openembedded-core
In-Reply-To: <1482893793.106950.42.camel@ranerica-desktop>
On Tue, 2016-12-27 at 18:56 -0800, Ricardo Neri wrote:
> On Wed, 2016-12-21 at 16:19 +0200, Fathi Boudra wrote:
> >
> > fwiw, I've been maintaining acpica recipe in meta-oe, and will keep an
> > eye here as well.
> > meta-luv supports both x86* and arm*, and we have an interest in
> > having the same features available and working for qemuaarch64.
>
> I was not aware of this. Perhaps there is no need for us to maintain a
> separate recipe in meta-luv.
Looks like there is consensus that maintaining an acpica recipe in
OE-core is the right approach. I'll prepare a revision of this patch
series that includes acpica instead of iasl and also addresses the other
points that Ricardo raised.
--
Best Regards, Patrick Ohly
The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.
^ permalink raw reply
* Re: [PATCH 4/9] ovmf: deploy firmware in image directory
From: Ricardo Neri @ 2016-12-28 21:38 UTC (permalink / raw)
To: Patrick Ohly; +Cc: openembedded-core
In-Reply-To: <ce57b729e9ac830d808040b7e3ff1fc128475420.1482324587.git.patrick.ohly@intel.com>
On Wed, 2016-12-21 at 14:11 +0100, Patrick Ohly wrote:
> When used with '-drive if=pflash', qemu will store UEFI variables
> inside the firmware image file. That is unexpected for a file located in
> the sysroot, which should be read-only, while it is normal for image
> files in the deploy/images directory. Therefore that directory is a
> better place for use with runqemu.
>
> The name was chose so that "runqemu ovmf" can be used as shorthand for
> "runqemu <full path>/ovmf.qcow2" by treating "ovmf" as the base name
> of the BIOS file. "ovmf_secboot.qcow2" is meant to be used for the
> Secure Boot enabled BIOS. qcow2 is used because it is needed for
> "savevm" snapshots of a virtual machine.
>
> Alternatively, OVMF_CODE.fd (read-only) and OVMF_VARS.fd (read/write)
> could be used. That would then allow updating the firmware of an
> existing machine without wiping out the variables set
> earlier. Configuring that in qemu would be more complicated, so for
> now the simpler approach with combined code and variable store is
> used.
>
> Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
> ---
> meta/recipes-core/ovmf/ovmf_git.bb | 33 +++++++++++++++++++++++----------
> 1 file changed, 23 insertions(+), 10 deletions(-)
>
> diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb
> index 13b583b..d0441d1 100644
> --- a/meta/recipes-core/ovmf/ovmf_git.bb
> +++ b/meta/recipes-core/ovmf/ovmf_git.bb
> @@ -16,7 +16,7 @@ PARALLEL_MAKE = ""
>
> S = "${WORKDIR}/git"
>
> -DEPENDS_class-native="util-linux-native iasl-native ossp-uuid-native"
> +DEPENDS_class-native="util-linux-native iasl-native ossp-uuid-native qemu-native"
>
> DEPENDS_class-target="ovmf-native"
>
> @@ -97,9 +97,20 @@ do_compile_class-target() {
> OVMF_ARCH="IA32"
> fi
>
> + # ${WORKDIR}/ovmf is a well-known location where do_install and
> + # do_deploy will be able to find the files.
> + rm -rf ${WORKDIR}/ovmf
> + mkdir ${WORKDIR}/ovmf
> + OVMF_DIR_SUFFIX="X64"
> + if [ "${TARGET_ARCH}" != "x86_64" ] ; then
> + OVMF_DIR_SUFFIX="Ia32" # Note the different capitalization
> + fi
> FIXED_GCCVER=$(fixup_target_tools ${GCC_VER})
> - echo FIXED_GCCVER is ${FIXED_GCCVER}
> + bbnote FIXED_GCCVER is ${FIXED_GCCVER}
> + build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}"
> +
> ${S}/OvmfPkg/build.sh -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER}
> + ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/OVMF.fd
> }
>
> do_install_class-native() {
> @@ -108,16 +119,18 @@ do_install_class-native() {
> }
>
> do_install_class-target() {
> - OVMF_DIR_SUFFIX="X64"
> - if [ "${TARGET_ARCH}" != "x86_64" ] ; then
> - OVMF_DIR_SUFFIX="Ia32" # Note the different capitalization
> - fi
> + # Traditional location.
> install -d ${D}${datadir}/ovmf
> + install -m 0755 ${WORKDIR}/ovmf/OVMF.fd ${D}${datadir}/ovmf/bios.bin
Now that I think about it. Installing here does not sever any purpose.
Thus, I think this can be removed by perhaps doing do_install[noexec] =
"1"
> +}
>
> - FIXED_GCCVER=$(fixup_target_tools ${GCC_VER})
> - build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}"
> - install -m 0755 ${build_dir}/FV/OVMF.fd \
> - ${D}${datadir}/ovmf/bios.bin
> +inherit deploy
I am not sure if there is a right way for inheriting in bitbake.
However, a quick grep -n inherit reveals that the majority of the
recipes put their inheritances towards the top of the recipe.
Thanks and BR,
Ricardo
> +do_deploy() {
> +}
> +do_deploy_class-target() {
> + # For use with "runqemu ovmf".
> + qemu-img convert -f raw -O qcow2 ${WORKDIR}/ovmf/OVMF.fd ${DEPLOYDIR}/ovmf.qcow2
> }
> +addtask do_deploy after do_compile before do_build
>
> BBCLASSEXTEND = "native"
^ permalink raw reply
* Re: [PATCH 6/9] ovmf_git.bb: enable Secure Boot
From: Ricardo Neri @ 2016-12-28 22:54 UTC (permalink / raw)
To: Patrick Ohly; +Cc: openembedded-core
In-Reply-To: <12e72d8f27d856bcc2007ca5226a693a68fe2ae0.1482324587.git.patrick.ohly@intel.com>
On Wed, 2016-12-21 at 14:11 +0100, Patrick Ohly wrote:
> The recipe now compiles OVMF twice, once without Secure Boot, once
> with. This is the same approach as in
> https://src.fedoraproject.org/cgit/rpms/edk2.git/tree/edk2.spec
Besides the fact that Fedora does it, is there a particular reason to
build twice? On my side, I am able to build with secure boot with a
single build. Also, the Ubuntu documentation does not mention that two
builds are needed [1].
I do see that in Fedora, the build parameters change. OVMF without
secure boot support is built with -a X64 -p OvmfPkg/OvmfPkgX64.dsc while
OVMF with secure boot support is built with -a IA32 -a X64 -p
OvmfPkg/OvmfPkgIa32X64.dsc. Perhaps this is the reason?
>
> The results are "ovmf.qcow2" and "ovmf.secboot.qcow2" in the
> image deploy directory, so
> runqemu <machine> <image> ovmf.secboot
> will boot with Secure Boot enabled.
>
> In contrast to Fedora, no attempt is made to strip potentially patent
> encumbered algorithms out of the OpenSSL archive. OVMF does not use
> the ones considered problematic for Fedora, so this shouldn't be a
> problem.
>
> Fixes: luv-yocto/#38
Also, I think it would be nice if we could choose between to not have
secure boot at all for OVMF. Maybe this could be achieved by having a
common ovmf.inc and two ovmf_git.bb and ovmf_sb_git.bb with the
different the specific things to support secure boot or not. Maybe all
that is needed in the secure boot recipe are the extra variables for
OpenSSL and a prepend to do_compile_class-target with the OpenSSL
patching. Something to ponder.
>
> Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
> ---
> meta/recipes-core/ovmf/ovmf_git.bb | 27 ++++++++++++++++++++++++++-
> 1 file changed, 26 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb
> index 67e65b8..c4eedf0 100644
> --- a/meta/recipes-core/ovmf/ovmf_git.bb
> +++ b/meta/recipes-core/ovmf/ovmf_git.bb
> @@ -1,6 +1,6 @@
> DESCRIPTION = "OVMF - UEFI firmware for Qemu and KVM"
> HOMEPAGE = "http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF"
> -LICENSE = "BSD"
> +LICENSE = "BSD & OpenSSL"
> LIC_FILES_CHKSUM = "file://OvmfPkg/License.txt;md5=343dc88e82ff33d042074f62050c3496"
>
> SRC_URI = "git://github.com/tianocore/edk2.git;branch=master \
> @@ -10,7 +10,13 @@ SRC_URI = "git://github.com/tianocore/edk2.git;branch=master \
> file://0003-BaseTools-makefile-adjust-to-build-in-under-bitbake.patch \
> "
>
> +SRC_URI_append_class-target = " \
> + http://www.openssl.org/source/openssl-1.0.2j.tar.gz;name=openssl;subdir=${S}/CryptoPkg/Library/OpensslLib \
> +"
> +
> SRCREV="4575a602ca6072ee9d04150b38bfb143cbff8588"
> +SRC_URI[openssl.md5sum] = "96322138f0b69e61b7212bc53d5e912b"
> +SRC_URI[openssl.sha256sum] = "e7aff292be21c259c6af26469c7a9b3ba26e9abaaffd325e3dccc9785256c431"
>
> PARALLEL_MAKE_class-native = ""
>
> @@ -30,6 +36,10 @@ BUILD_OPTIMIZATION="-pipe"
> # OVMF supports IA only, although it could conceivably support ARM someday.
> COMPATIBLE_HOST='(i.86|x86_64).*'
>
> +# Additional build flags for OVMF with Secure Boot.
> +# Fedora also uses "-D SMM_REQUIRE -D EXCLUDE_SHELL_FROM_FD".
> +OVMF_SECURE_BOOT_FLAGS = "-DSECURE_BOOT_ENABLE=TRUE"
> +
> do_patch_append_class-native() {
> bb.build.exec_func('do_fix_iasl', d)
> bb.build.exec_func('do_fix_toolchain', d)
> @@ -110,8 +120,22 @@ do_compile_class-target() {
> bbnote FIXED_GCCVER is ${FIXED_GCCVER}
> build_dir="${S}/Build/Ovmf$OVMF_DIR_SUFFIX/RELEASE_${FIXED_GCCVER}"
>
> + bbnote "Building without Secure Boot."
> + rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX
> ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER}
> ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/OVMF.fd
> +
> + # See CryptoPkg/Library/OpensslLib/Patch-HOWTO.txt and
> + # https://src.fedoraproject.org/cgit/rpms/edk2.git/tree/ for
> + # building with Secure Boot enabled.
> + bbnote "Building with Secure Boot."
> + rm -rf ${S}/Build/Ovmf$OVMF_DIR_SUFFIX
> + if ! [ -f ${S}/CryptoPkg/Library/OpensslLib/openssl-*/edk2-patch-applied ]; then
> + ( cd ${S}/CryptoPkg/Library/OpensslLib/openssl-* && patch -p1 <$(echo ../EDKII_openssl-*.patch) && touch edk2-patch-applied )
> + fi
> + ( cd ${S}/CryptoPkg/Library/OpensslLib/ && ./Install.sh )
> + ${S}/OvmfPkg/build.sh $PARALLEL_JOBS -a $OVMF_ARCH -b RELEASE -t ${FIXED_GCCVER} ${OVMF_SECURE_BOOT_FLAGS}
> + ln ${build_dir}/FV/OVMF.fd ${WORKDIR}/ovmf/OVMF.secboot.fd
At this point both ${WORKDIR}/ovmf/OVMF.secboot.fd and
${WORKDIR}/ovmf/OVMF.fd will be linked to the same OVMF.fd with secure
boot support. Maybe this could be fixed by copying the files rather than
creating a symbolic link.
> }
>
> do_install_class-native() {
> @@ -131,6 +155,7 @@ do_deploy() {
> do_deploy_class-target() {
> # For use with "runqemu ovmf".
> qemu-img convert -f raw -O qcow2 ${WORKDIR}/ovmf/OVMF.fd ${DEPLOYDIR}/ovmf.qcow2
> + qemu-img convert -f raw -O qcow2 ${WORKDIR}/ovmf/OVMF.secboot.fd ${DEPLOYDIR}/ovmf.secboot.qcow2
In the same line as my previous comment, these two images will have
secure boot support.
Thanks and BR,
Ricardo
[1]. https://wiki.ubuntu.com/UEFI/EDK2
> }
> addtask do_deploy after do_compile before do_build
>
> --
> 2.1.4
>
^ permalink raw reply
* Re: [PATCH 4/9] ovmf: deploy firmware in image directory
From: Ricardo Neri @ 2016-12-28 23:25 UTC (permalink / raw)
To: Patrick Ohly; +Cc: openembedded-core
In-Reply-To: <1482961124.106950.55.camel@ranerica-desktop>
On Wed, 2016-12-28 at 13:38 -0800, Ricardo Neri wrote:
> > do_install_class-target() {
> > - OVMF_DIR_SUFFIX="X64"
> > - if [ "${TARGET_ARCH}" != "x86_64" ] ; then
> > - OVMF_DIR_SUFFIX="Ia32" # Note the different capitalization
> > - fi
> > + # Traditional location.
> > install -d ${D}${datadir}/ovmf
> > + install -m 0755 ${WORKDIR}/ovmf/OVMF.fd
> ${D}${datadir}/ovmf/bios.bin
>
> Now that I think about it. Installing here does not sever any purpose.
> Thus, I think this can be removed by perhaps doing do_install[noexec]
> =
> "1"
I take back this. I seems that scripts/runqemu does look for OVMF in
STAGING_DIR_HOST/NATIVE. Perhaps this can be changed how that you are
also updating runqemu.
^ permalink raw reply
* Re: [PATCH 0/9] UEFI + Secure Boot + qemu
From: Ricardo Neri @ 2016-12-28 23:26 UTC (permalink / raw)
To: Patrick Ohly; +Cc: openembedded-core
In-Reply-To: <1482953240.32048.21.camel@intel.com>
On Wed, 2016-12-28 at 20:27 +0100, Patrick Ohly wrote:
> > > fwiw, I've been maintaining acpica recipe in meta-oe, and will
> keep an
> > > eye here as well.
> > > meta-luv supports both x86* and arm*, and we have an interest in
> > > having the same features available and working for qemuaarch64.
> >
> > I was not aware of this. Perhaps there is no need for us to maintain
> a
> > separate recipe in meta-luv.
>
> Looks like there is consensus that maintaining an acpica recipe in
> OE-core is the right approach. I'll prepare a revision of this patch
> series that includes acpica instead of iasl and also addresses the
> other
> points that Ricardo raised.
Just to be clear. I meant that it would be better for meta-luv to
leverage the acpica recipe present in meta-OE :).
^ permalink raw reply
* Re: [PATCH 8/9] runqemu: support UEFI with OVMF firmware
From: Ricardo Neri @ 2016-12-28 23:33 UTC (permalink / raw)
To: Patrick Ohly; +Cc: openembedded-core
In-Reply-To: <66377b2510edebf997b04812ff93c9ef0bb3c47f.1482324587.git.patrick.ohly@intel.com>
On Wed, 2016-12-21 at 14:11 +0100, Patrick Ohly wrote:
> + # File name of a OVMF BIOS file, to be added with -drive
> if=pflash.
> + # Found in the same places as the rootfs, with or without one
> of
> + # these suffices: qcow2, bin.
> + # Setting one also adds "-vga std" because that is all that
> + # OVMF supports.
> + self.ovmf_bios = ''
runqemu has the options biosdir and biosfilename. Although the log for
these options was lost when the script was migrated to python, the
motivation of adding these options was to use OVMF. It uses the -L and
-bios options of qemu. To my knowledge, the only custom bios at the
moment is OVMF. Thus, you would ponder either removing or tweaking these
options with your approach; which makes more sense to me.
Thanks and BR,
Ricardo
^ permalink raw reply
* Re: [PATCH v2 0/1] kexec-tools: Upgrade to 2.0.14
From: He Zhe @ 2016-12-29 2:05 UTC (permalink / raw)
To: Alexander Kanavin, openembedded-core; +Cc: Purdie, Richard
In-Reply-To: <1fad67ac-8ae2-e242-9830-e89311f14b12@linux.intel.com>
On 12/28/2016 08:15 PM, Alexander Kanavin wrote:
> On 12/27/2016 08:43 AM, zhe.he@windriver.com wrote:
>> From: He Zhe <zhe.he@windriver.com>
>>
>> Remove kexec-aarch64.patch since it has been merged upstream
>> Remove kexec-x32.patch since it has been reverted upstream
>> Backport patches for kdump arm64 from:
>> https://git.linaro.org/people/takahiro.akashi/kexec-tools.git
>>
>> v1 to v2: Remove redundant tarball link in SRC_URI
>
> None of my comments are addressed in this new version of the patch. Specifically:
>
> > Remove kexec-aarch64.patch since it has been merged upstream
> > Remove kexec-x32.patch since it has been reverted upstream
>
> You should also remove the actual files, not just drop them from the recipe.
>
> > Backport patches for kdump arm64 from:
> > https://git.linaro.org/people/takahiro.akashi/kexec-tools.git
>
> If the patches are coming from a different repository, they are not a backport. Change the upstream-status to 'pending' please, or 'submitted (link)' if they have been submitted upstream.
>
> > meta/recipes-kernel/kexec/kexec-tools_2.0.12.bb | 37 ----
> > meta/recipes-kernel/kexec/kexec-tools_2.0.14.bb | 44 +++++
>
> Please use git's rename detection when submitting patches, so we can see what is the difference between the two files.
>
Thank you for your careful review. Sorry for missing your comments for v1 since I just filter mails specifically sent to me...
I'll send v3 soon.
Thanks,
Zhe
>
> Alex
>
>
^ permalink raw reply
* [PATCH v3 0/1] kexec-tools: Upgrade to 2.0.14
From: zhe.he @ 2016-12-29 2:06 UTC (permalink / raw)
To: openembedded-core
From: He Zhe <zhe.he@windriver.com>
v1 to v2: Remove redundant tarball link in SRC_URI
v2 to v3: Address Alex's comments:
Remove kexec-aarch64.patch and kexec-x32.patch files
Correct Upstream-Status
Regenerate patch with git's rename detection enabled
He Zhe (1):
kexec-tools: Upgrade to 2.0.14
...nd-the-semantics-of-kexec_iomem_for_each_.patch | 78 ++
...eneralize-and-rename-get_kernel_stext_sym.patch | 194 +++++
...0003-arm64-identify-PHYS_OFFSET-correctly.patch | 76 ++
.../0004-arm64-kdump-identify-memory-regions.patch | 202 ++++++
...5-arm64-kdump-add-elf-core-header-segment.patch | 191 +++++
...6-arm64-kdump-set-up-kernel-image-segment.patch | 137 ++++
.../0007-arm64-kdump-set-up-other-segments.patch | 35 +
...-add-DT-properties-to-crash-dump-kernel-s.patch | 150 ++++
...-kdump-Add-support-for-binary-image-files.patch | 52 ++
.../kexec/kexec-tools/kexec-aarch64.patch | 801 ---------------------
.../kexec/kexec-tools/kexec-x32.patch | 88 ---
...kexec-tools_2.0.12.bb => kexec-tools_2.0.14.bb} | 15 +-
12 files changed, 1126 insertions(+), 893 deletions(-)
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0001-kexec-exntend-the-semantics-of-kexec_iomem_for_each_.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0002-kexec-generalize-and-rename-get_kernel_stext_sym.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0003-arm64-identify-PHYS_OFFSET-correctly.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0004-arm64-kdump-identify-memory-regions.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0005-arm64-kdump-add-elf-core-header-segment.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0006-arm64-kdump-set-up-kernel-image-segment.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0007-arm64-kdump-set-up-other-segments.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0009-arm64-kdump-Add-support-for-binary-image-files.patch
delete mode 100644 meta/recipes-kernel/kexec/kexec-tools/kexec-aarch64.patch
delete mode 100644 meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch
rename meta/recipes-kernel/kexec/{kexec-tools_2.0.12.bb => kexec-tools_2.0.14.bb} (55%)
--
2.8.3
^ permalink raw reply
* [PATCH v3 1/1] kexec-tools: Upgrade to 2.0.14
From: zhe.he @ 2016-12-29 2:06 UTC (permalink / raw)
To: openembedded-core
In-Reply-To: <cover.1482975938.git.zhe.he@windriver.com>
From: He Zhe <zhe.he@windriver.com>
Remove kexec-aarch64.patch since it has been merged upstream
Remove kexec-x32.patch since it has been reverted upstream
Add patches for kdump arm64 from upstream mailing list:
http://lists.infradead.org/pipermail/kexec/2016-November/017555.html
Signed-off-by: He Zhe <zhe.he@windriver.com>
---
...nd-the-semantics-of-kexec_iomem_for_each_.patch | 78 ++
...eneralize-and-rename-get_kernel_stext_sym.patch | 194 +++++
...0003-arm64-identify-PHYS_OFFSET-correctly.patch | 76 ++
.../0004-arm64-kdump-identify-memory-regions.patch | 202 ++++++
| 191 +++++
...6-arm64-kdump-set-up-kernel-image-segment.patch | 137 ++++
.../0007-arm64-kdump-set-up-other-segments.patch | 35 +
...-add-DT-properties-to-crash-dump-kernel-s.patch | 150 ++++
...-kdump-Add-support-for-binary-image-files.patch | 52 ++
.../kexec/kexec-tools/kexec-aarch64.patch | 801 ---------------------
.../kexec/kexec-tools/kexec-x32.patch | 88 ---
...kexec-tools_2.0.12.bb => kexec-tools_2.0.14.bb} | 15 +-
12 files changed, 1126 insertions(+), 893 deletions(-)
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0001-kexec-exntend-the-semantics-of-kexec_iomem_for_each_.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0002-kexec-generalize-and-rename-get_kernel_stext_sym.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0003-arm64-identify-PHYS_OFFSET-correctly.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0004-arm64-kdump-identify-memory-regions.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0005-arm64-kdump-add-elf-core-header-segment.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0006-arm64-kdump-set-up-kernel-image-segment.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0007-arm64-kdump-set-up-other-segments.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0009-arm64-kdump-Add-support-for-binary-image-files.patch
delete mode 100644 meta/recipes-kernel/kexec/kexec-tools/kexec-aarch64.patch
delete mode 100644 meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch
rename meta/recipes-kernel/kexec/{kexec-tools_2.0.12.bb => kexec-tools_2.0.14.bb} (55%)
diff --git a/meta/recipes-kernel/kexec/kexec-tools/0001-kexec-exntend-the-semantics-of-kexec_iomem_for_each_.patch b/meta/recipes-kernel/kexec/kexec-tools/0001-kexec-exntend-the-semantics-of-kexec_iomem_for_each_.patch
new file mode 100644
index 0000000..dc8f9b1
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/0001-kexec-exntend-the-semantics-of-kexec_iomem_for_each_.patch
@@ -0,0 +1,78 @@
+From 02eed0f8f2748fd7579f69e5373445b52b2b8754 Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Mon, 17 Oct 2016 13:56:58 +0900
+Subject: [PATCH 1/9] kexec: exntend the semantics of kexec_iomem_for_each_line
+
+The current kexec_iomem_for_each_line() counts up all the lines for which
+a callback function returns zero(0) or positive, and otherwise it stops
+further scanning.
+This behavior is incovenient in some cases. For instance, on arm64, we want
+to count up "System RAM" entries, but need to skip "reserved" entries.
+
+So this patch extends the semantics so that we will continue to scan
+succeeding entries but not count lines for which a callback function
+returns positive.
+
+The current users of kexec_iomem_for_each_line(), arm, sh and x86, will not
+be affected by this change because
+* arm
+ The callback function only returns -1 or 0, and the return value of
+ kexec_iomem_for_each_line() will never be used.
+* sh, x86
+ The callback function may return (-1 for sh,) 0 or 1, but always returns
+ 1 once we have reached the maximum number of entries allowed.
+ Even so the current kexec_iomem_for_each_line() counts them up.
+ This change actually fixes this bug.
+
+Upstream-Status: Submitted [http://lists.infradead.org/pipermail/kexec/2016-November/017556.html]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/kexec-iomem.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/kexec/kexec-iomem.c b/kexec/kexec-iomem.c
+index 485a2e8..0a0277a 100644
+--- a/kexec/kexec-iomem.c
++++ b/kexec/kexec-iomem.c
+@@ -18,6 +18,9 @@
+ * Iterate over each line in the file returned by proc_iomem(). If match is
+ * NULL or if the line matches with our match-pattern then call the
+ * callback if non-NULL.
++ * If match is NULL, callback should return a negative if error.
++ * Otherwise the interation goes on, incrementing nr but only if callback
++ * returns 0 (matched).
+ *
+ * Return the number of lines matched.
+ */
+@@ -37,7 +40,7 @@ int kexec_iomem_for_each_line(char *match,
+ char *str;
+ int consumed;
+ int count;
+- int nr = 0;
++ int nr = 0, ret;
+
+ fp = fopen(iomem, "r");
+ if (!fp)
+@@ -50,11 +53,13 @@ int kexec_iomem_for_each_line(char *match,
+ str = line + consumed;
+ size = end - start + 1;
+ if (!match || memcmp(str, match, strlen(match)) == 0) {
+- if (callback
+- && callback(data, nr, str, start, size) < 0) {
+- break;
++ if (callback) {
++ ret = callback(data, nr, str, start, size);
++ if (ret < 0)
++ break;
++ else if (ret == 0)
++ nr++;
+ }
+- nr++;
+ }
+ }
+
+--
+1.9.1
+
diff --git a/meta/recipes-kernel/kexec/kexec-tools/0002-kexec-generalize-and-rename-get_kernel_stext_sym.patch b/meta/recipes-kernel/kexec/kexec-tools/0002-kexec-generalize-and-rename-get_kernel_stext_sym.patch
new file mode 100644
index 0000000..ac95ad5
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/0002-kexec-generalize-and-rename-get_kernel_stext_sym.patch
@@ -0,0 +1,194 @@
+From d29f37bb6e9114aba96c606103b110f511bee9a1 Mon Sep 17 00:00:00 2001
+From: Pratyush Anand <panand@redhat.com>
+Date: Wed, 2 Nov 2016 15:05:25 +0530
+Subject: [PATCH 2/9] kexec: generalize and rename get_kernel_stext_sym()
+
+get_kernel_stext_sym() has been defined for both arm and i386. Other
+architecture might need some other kernel symbol address. Therefore rewrite
+this function as generic function to get any kernel symbol address.
+
+More over, kallsyms is not arch specific representation, therefore have
+common function for all arches.
+
+Upstream-Status: Submitted [http://lists.infradead.org/pipermail/kexec/2016-November/017579.html]
+
+Signed-off-by: Pratyush Anand <panand@redhat.com>
+[created symbols.c]
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/Makefile | 1 +
+ kexec/arch/arm/crashdump-arm.c | 40 +---------------------------------------
+ kexec/arch/i386/crashdump-x86.c | 29 -----------------------------
+ kexec/kexec.h | 2 ++
+ kexec/symbols.c | 41 +++++++++++++++++++++++++++++++++++++++++
+ 5 files changed, 45 insertions(+), 68 deletions(-)
+ create mode 100644 kexec/symbols.c
+
+diff --git a/kexec/Makefile b/kexec/Makefile
+index 39f365f..2b4fb3d 100644
+--- a/kexec/Makefile
++++ b/kexec/Makefile
+@@ -26,6 +26,7 @@ KEXEC_SRCS_base += kexec/kernel_version.c
+ KEXEC_SRCS_base += kexec/lzma.c
+ KEXEC_SRCS_base += kexec/zlib.c
+ KEXEC_SRCS_base += kexec/kexec-xen.c
++KEXEC_SRCS_base += kexec/symbols.c
+
+ KEXEC_GENERATED_SRCS += $(PURGATORY_HEX_C)
+
+diff --git a/kexec/arch/arm/crashdump-arm.c b/kexec/arch/arm/crashdump-arm.c
+index 4a89b5e..245c21a 100644
+--- a/kexec/arch/arm/crashdump-arm.c
++++ b/kexec/arch/arm/crashdump-arm.c
+@@ -73,48 +73,10 @@ static struct crash_elf_info elf_info = {
+
+ extern unsigned long long user_page_offset;
+
+-/* Retrieve kernel _stext symbol virtual address from /proc/kallsyms */
+-static unsigned long long get_kernel_stext_sym(void)
+-{
+- const char *kallsyms = "/proc/kallsyms";
+- const char *stext = "_stext";
+- char sym[128];
+- char line[128];
+- FILE *fp;
+- unsigned long long vaddr = 0;
+- char type;
+-
+- fp = fopen(kallsyms, "r");
+- if (!fp) {
+- fprintf(stderr, "Cannot open %s\n", kallsyms);
+- return 0;
+- }
+-
+- while(fgets(line, sizeof(line), fp) != NULL) {
+- unsigned long long addr;
+-
+- if (sscanf(line, "%Lx %c %s", &addr, &type, sym) != 3)
+- continue;
+-
+- if (strcmp(sym, stext) == 0) {
+- dbgprintf("kernel symbol %s vaddr = %#llx\n", stext, addr);
+- vaddr = addr;
+- break;
+- }
+- }
+-
+- fclose(fp);
+-
+- if (vaddr == 0)
+- fprintf(stderr, "Cannot get kernel %s symbol address\n", stext);
+-
+- return vaddr;
+-}
+-
+ static int get_kernel_page_offset(struct kexec_info *info,
+ struct crash_elf_info *elf_info)
+ {
+- unsigned long long stext_sym_addr = get_kernel_stext_sym();
++ unsigned long long stext_sym_addr = get_kernel_sym("_stext");
+ if (stext_sym_addr == 0) {
+ if (user_page_offset != (-1ULL)) {
+ elf_info->page_offset = user_page_offset;
+diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
+index ab833d4..abf82a5 100644
+--- a/kexec/arch/i386/crashdump-x86.c
++++ b/kexec/arch/i386/crashdump-x86.c
+@@ -102,35 +102,6 @@ static int get_kernel_paddr(struct kexec_info *UNUSED(info),
+ return -1;
+ }
+
+-/* Retrieve kernel symbol virtual address from /proc/kallsyms */
+-static unsigned long long get_kernel_sym(const char *symbol)
+-{
+- const char *kallsyms = "/proc/kallsyms";
+- char sym[128];
+- char line[128];
+- FILE *fp;
+- unsigned long long vaddr;
+- char type;
+-
+- fp = fopen(kallsyms, "r");
+- if (!fp) {
+- fprintf(stderr, "Cannot open %s\n", kallsyms);
+- return 0;
+- }
+-
+- while(fgets(line, sizeof(line), fp) != NULL) {
+- if (sscanf(line, "%Lx %c %s", &vaddr, &type, sym) != 3)
+- continue;
+- if (strcmp(sym, symbol) == 0) {
+- dbgprintf("kernel symbol %s vaddr = %16llx\n", symbol, vaddr);
+- return vaddr;
+- }
+- }
+-
+- fprintf(stderr, "Cannot get kernel %s symbol address\n", symbol);
+- return 0;
+-}
+-
+ /* Retrieve info regarding virtual address kernel has been compiled for and
+ * size of the kernel from /proc/kcore. Current /proc/kcore parsing from
+ * from kexec-tools fails because of malformed elf notes. A kernel patch has
+diff --git a/kexec/kexec.h b/kexec/kexec.h
+index 9194f1c..b4fafad 100644
+--- a/kexec/kexec.h
++++ b/kexec/kexec.h
+@@ -312,4 +312,6 @@ int xen_kexec_load(struct kexec_info *info);
+ int xen_kexec_unload(uint64_t kexec_flags);
+ void xen_kexec_exec(void);
+
++extern unsigned long long get_kernel_sym(const char *text);
++
+ #endif /* KEXEC_H */
+diff --git a/kexec/symbols.c b/kexec/symbols.c
+new file mode 100644
+index 0000000..ea6e327
+--- /dev/null
++++ b/kexec/symbols.c
+@@ -0,0 +1,41 @@
++#include <stdio.h>
++#include <string.h>
++#include "kexec.h"
++
++/* Retrieve kernel symbol virtual address from /proc/kallsyms */
++unsigned long long get_kernel_sym(const char *text)
++{
++ const char *kallsyms = "/proc/kallsyms";
++ char sym[128];
++ char line[128];
++ FILE *fp;
++ unsigned long long vaddr = 0;
++ char type;
++
++ fp = fopen(kallsyms, "r");
++ if (!fp) {
++ fprintf(stderr, "Cannot open %s\n", kallsyms);
++ return 0;
++ }
++
++ while (fgets(line, sizeof(line), fp) != NULL) {
++ unsigned long long addr;
++
++ if (sscanf(line, "%Lx %c %s", &addr, &type, sym) != 3)
++ continue;
++
++ if (strcmp(sym, text) == 0) {
++ dbgprintf("kernel symbol %s vaddr = %#llx\n",
++ text, addr);
++ vaddr = addr;
++ break;
++ }
++ }
++
++ fclose(fp);
++
++ if (vaddr == 0)
++ fprintf(stderr, "Cannot get kernel %s symbol address\n", text);
++
++ return vaddr;
++}
+--
+1.9.1
+
diff --git a/meta/recipes-kernel/kexec/kexec-tools/0003-arm64-identify-PHYS_OFFSET-correctly.patch b/meta/recipes-kernel/kexec/kexec-tools/0003-arm64-identify-PHYS_OFFSET-correctly.patch
new file mode 100644
index 0000000..285ce45
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/0003-arm64-identify-PHYS_OFFSET-correctly.patch
@@ -0,0 +1,76 @@
+From 16df170ad4808d12acd5e919ac4f6e7f33a247b3 Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Thu, 1 Sep 2016 10:57:42 +0900
+Subject: [PATCH 3/9] arm64: identify PHYS_OFFSET correctly
+
+Due to the kernel patch, commit e7cd190385d1 ("arm64: mark reserved
+memblock regions explicitly in iomem"), the current code will not be able
+to identify the correct value of PHYS_OFFSET if some "reserved" memory
+region, which is likely to be UEFI runtime services code/data, exists at
+an address below the first "System RAM" regions.
+
+This patch fixes this issue.
+
+Upstream-Status: Submitted [http://lists.infradead.org/pipermail/kexec/2016-November/017558.html]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/iomem.h | 7 +++++++
+ kexec/arch/arm64/kexec-arm64.c | 12 ++++++++++--
+ 2 files changed, 17 insertions(+), 2 deletions(-)
+ create mode 100644 kexec/arch/arm64/iomem.h
+
+diff --git a/kexec/arch/arm64/iomem.h b/kexec/arch/arm64/iomem.h
+new file mode 100644
+index 0000000..7fd66eb
+--- /dev/null
++++ b/kexec/arch/arm64/iomem.h
+@@ -0,0 +1,7 @@
++#ifndef IOMEM_H
++#define IOMEM_H
++
++#define SYSTEM_RAM "System RAM\n"
++#define IOMEM_RESERVED "reserved\n"
++
++#endif
+diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
+index 2e8839a..8ac811d 100644
+--- a/kexec/arch/arm64/kexec-arm64.c
++++ b/kexec/arch/arm64/kexec-arm64.c
+@@ -21,6 +21,7 @@
+ #include "crashdump-arm64.h"
+ #include "dt-ops.h"
+ #include "fs2dt.h"
++#include "iomem.h"
+ #include "kexec-syscall.h"
+ #include "arch/options.h"
+
+@@ -475,7 +476,14 @@ static int get_memory_ranges_iomem_cb(void *data, int nr, char *str,
+ return -1;
+
+ r = (struct memory_range *)data + nr;
+- r->type = RANGE_RAM;
++
++ if (!strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)))
++ r->type = RANGE_RAM;
++ else if (!strncmp(str, IOMEM_RESERVED, strlen(IOMEM_RESERVED)))
++ r->type = RANGE_RESERVED;
++ else
++ return 1;
++
+ r->start = base;
+ r->end = base + length - 1;
+
+@@ -494,7 +502,7 @@ static int get_memory_ranges_iomem_cb(void *data, int nr, char *str,
+ static int get_memory_ranges_iomem(struct memory_range *array,
+ unsigned int *count)
+ {
+- *count = kexec_iomem_for_each_line("System RAM\n",
++ *count = kexec_iomem_for_each_line(NULL,
+ get_memory_ranges_iomem_cb, array);
+
+ if (!*count) {
+--
+1.9.1
+
diff --git a/meta/recipes-kernel/kexec/kexec-tools/0004-arm64-kdump-identify-memory-regions.patch b/meta/recipes-kernel/kexec/kexec-tools/0004-arm64-kdump-identify-memory-regions.patch
new file mode 100644
index 0000000..2fe4193
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/0004-arm64-kdump-identify-memory-regions.patch
@@ -0,0 +1,202 @@
+From 48a4c7874d8264ddbfaec2e9858d7866a2d2eb60 Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Wed, 5 Aug 2015 13:16:30 +0900
+Subject: [PATCH 4/9] arm64: kdump: identify memory regions
+
+The following regions need to be identified for later use:
+ a) memory regions which belong to the 1st kernel
+ b) usable memory reserved for crash dump kernel
+
+We go through /proc/iomem to find out a) and b) which are marked
+as "System RAM" and "Crash kernel", respectively.
+
+Upstream-Status: Submitted [http://lists.infradead.org/pipermail/kexec/2016-November/017559.html]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/Makefile | 2 +
+ kexec/arch/arm64/crashdump-arm64.c | 100 ++++++++++++++++++++++++++++++++++++-
+ kexec/arch/arm64/crashdump-arm64.h | 14 +++++-
+ kexec/arch/arm64/iomem.h | 1 +
+ 4 files changed, 114 insertions(+), 3 deletions(-)
+
+diff --git a/kexec/arch/arm64/Makefile b/kexec/arch/arm64/Makefile
+index 74b677f..2d4ae0e 100644
+--- a/kexec/arch/arm64/Makefile
++++ b/kexec/arch/arm64/Makefile
+@@ -6,6 +6,8 @@ arm64_FS2DT_INCLUDE += \
+
+ arm64_DT_OPS += kexec/dt-ops.c
+
++arm64_MEM_REGIONS = kexec/mem_regions.c
++
+ arm64_CPPFLAGS += -I $(srcdir)/kexec/
+
+ arm64_KEXEC_SRCS += \
+diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
+index d2272c8..dcaca43 100644
+--- a/kexec/arch/arm64/crashdump-arm64.c
++++ b/kexec/arch/arm64/crashdump-arm64.c
+@@ -1,5 +1,13 @@
+ /*
+ * ARM64 crashdump.
++ * partly derived from arm implementation
++ *
++ * Copyright (c) 2014-2016 Linaro Limited
++ * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
+ */
+
+ #define _GNU_SOURCE
+@@ -10,12 +18,102 @@
+ #include "kexec.h"
+ #include "crashdump.h"
+ #include "crashdump-arm64.h"
++#include "iomem.h"
+ #include "kexec-arm64.h"
+ #include "kexec-elf.h"
++#include "mem_regions.h"
+
+-struct memory_ranges usablemem_rgns = {};
++/* memory ranges on crashed kernel */
++static struct memory_range crash_memory_ranges[CRASH_MAX_MEMORY_RANGES];
++static struct memory_ranges crash_memory_rgns = {
++ .size = 0,
++ .max_size = CRASH_MAX_MEMORY_RANGES,
++ .ranges = crash_memory_ranges,
++};
++
++/* memory range reserved for crashkernel */
++struct memory_range crash_reserved_mem;
++struct memory_ranges usablemem_rgns = {
++ .size = 0,
++ .max_size = 1,
++ .ranges = &crash_reserved_mem,
++};
++
++/*
++ * iomem_range_callback() - callback called for each iomem region
++ * @data: not used
++ * @nr: not used
++ * @str: name of the memory region
++ * @base: start address of the memory region
++ * @length: size of the memory region
++ *
++ * This function is called once for each memory region found in /proc/iomem.
++ * It locates system RAM and crashkernel reserved memory and places these to
++ * variables, respectively, crash_memory_ranges and crash_reserved_mem.
++ */
++
++static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr),
++ char *str, unsigned long long base,
++ unsigned long long length)
++{
++ if (strncmp(str, CRASH_KERNEL, strlen(CRASH_KERNEL)) == 0)
++ return mem_regions_add(&usablemem_rgns,
++ base, length, RANGE_RAM);
++ else if (strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) == 0)
++ return mem_regions_add(&crash_memory_rgns,
++ base, length, RANGE_RAM);
++
++ return 0;
++}
+
+ int is_crashkernel_mem_reserved(void)
+ {
++ if (!crash_reserved_mem.end)
++ kexec_iomem_for_each_line(NULL, iomem_range_callback, NULL);
++
++ return crash_reserved_mem.start != crash_reserved_mem.end;
++}
++
++/*
++ * crash_get_memory_ranges() - read system physical memory
++ *
++ * Function reads through system physical memory and stores found memory
++ * regions in crash_memory_ranges.
++ * Regions are sorted in ascending order.
++ *
++ * Returns 0 in case of success and -1 otherwise (errno is set).
++ */
++static int crash_get_memory_ranges(void)
++{
++ /*
++ * First read all memory regions that can be considered as
++ * system memory including the crash area.
++ */
++ if (!usablemem_rgns.size)
++ kexec_iomem_for_each_line(NULL, iomem_range_callback, NULL);
++
++ /* allow only a single region for crash dump kernel */
++ if (usablemem_rgns.size != 1) {
++ errno = EINVAL;
++ return -1;
++ }
++
++ dbgprint_mem_range("Reserved memory range", &crash_reserved_mem, 1);
++
++ if (mem_regions_exclude(&crash_memory_rgns, &crash_reserved_mem)) {
++ fprintf(stderr,
++ "Error: Number of crash memory ranges excedeed the max limit\n");
++ errno = ENOMEM;
++ return -1;
++ }
++
++ /*
++ * Make sure that the memory regions are sorted.
++ */
++ mem_regions_sort(&crash_memory_rgns);
++
++ dbgprint_mem_range("Coredump memory ranges",
++ crash_memory_rgns.ranges, crash_memory_rgns.size);
++
+ return 0;
+ }
+diff --git a/kexec/arch/arm64/crashdump-arm64.h b/kexec/arch/arm64/crashdump-arm64.h
+index f33c7a2..07a0ed0 100644
+--- a/kexec/arch/arm64/crashdump-arm64.h
++++ b/kexec/arch/arm64/crashdump-arm64.h
+@@ -1,12 +1,22 @@
+ /*
+ * ARM64 crashdump.
++ *
++ * Copyright (c) 2014-2016 Linaro Limited
++ * Author: AKASHI Takahiro <takahiro.akashi@linaro.org>
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
+ */
+
+-#if !defined(CRASHDUMP_ARM64_H)
++#ifndef CRASHDUMP_ARM64_H
+ #define CRASHDUMP_ARM64_H
+
+ #include "kexec.h"
+
++#define CRASH_MAX_MEMORY_RANGES 32
++
+ extern struct memory_ranges usablemem_rgns;
++extern struct memory_range crash_reserved_mem;
+
+-#endif
++#endif /* CRASHDUMP_ARM64_H */
+diff --git a/kexec/arch/arm64/iomem.h b/kexec/arch/arm64/iomem.h
+index 7fd66eb..20cda87 100644
+--- a/kexec/arch/arm64/iomem.h
++++ b/kexec/arch/arm64/iomem.h
+@@ -2,6 +2,7 @@
+ #define IOMEM_H
+
+ #define SYSTEM_RAM "System RAM\n"
++#define CRASH_KERNEL "Crash kernel\n"
+ #define IOMEM_RESERVED "reserved\n"
+
+ #endif
+--
+1.9.1
+
--git a/meta/recipes-kernel/kexec/kexec-tools/0005-arm64-kdump-add-elf-core-header-segment.patch b/meta/recipes-kernel/kexec/kexec-tools/0005-arm64-kdump-add-elf-core-header-segment.patch
new file mode 100644
index 0000000..fcdb167
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/0005-arm64-kdump-add-elf-core-header-segment.patch
@@ -0,0 +1,191 @@
+From 769da25627cebb2a53caee5d5be78a32d376adc1 Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Wed, 5 Aug 2015 13:45:15 +0900
+Subject: [PATCH 5/9] arm64: kdump: add elf core header segment
+
+Elf core header contains the information necessary for the coredump of
+the 1st kernel, including its physcal memory layout as well as cpu register
+states at the panic.
+The segment is allocated inside the reserved memory of crash dump kernel.
+
+Upstream-Status: Submitted [http://lists.infradead.org/pipermail/kexec/2016-November/017560.html]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/crashdump-arm64.c | 96 ++++++++++++++++++++++++++++++++++++++
+ kexec/arch/arm64/crashdump-arm64.h | 3 ++
+ kexec/arch/arm64/iomem.h | 2 +
+ kexec/arch/arm64/kexec-elf-arm64.c | 10 ++++
+ 4 files changed, 111 insertions(+)
+
+diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
+index dcaca43..8346131 100644
+--- a/kexec/arch/arm64/crashdump-arm64.c
++++ b/kexec/arch/arm64/crashdump-arm64.c
+@@ -39,6 +39,39 @@ struct memory_ranges usablemem_rgns = {
+ .ranges = &crash_reserved_mem,
+ };
+
++struct memory_range elfcorehdr_mem;
++
++static struct crash_elf_info elf_info = {
++ .class = ELFCLASS64,
++#if (__BYTE_ORDER == __LITTLE_ENDIAN)
++ .data = ELFDATA2LSB,
++#else
++ .data = ELFDATA2MSB,
++#endif
++ .machine = EM_AARCH64,
++};
++
++/*
++ * Note: The returned value is correct only if !CONFIG_RANDOMIZE_BASE.
++ */
++static uint64_t get_kernel_page_offset(void)
++{
++ int i;
++
++ if (elf_info.kern_vaddr_start == UINT64_MAX)
++ return UINT64_MAX;
++
++ /* Current max virtual memory range is 48-bits. */
++ for (i = 48; i > 0; i--)
++ if (!(elf_info.kern_vaddr_start & (1UL << i)))
++ break;
++
++ if (i <= 0)
++ return UINT64_MAX;
++ else
++ return UINT64_MAX << i;
++}
++
+ /*
+ * iomem_range_callback() - callback called for each iomem region
+ * @data: not used
+@@ -62,6 +95,10 @@ static int iomem_range_callback(void *UNUSED(data), int UNUSED(nr),
+ else if (strncmp(str, SYSTEM_RAM, strlen(SYSTEM_RAM)) == 0)
+ return mem_regions_add(&crash_memory_rgns,
+ base, length, RANGE_RAM);
++ else if (strncmp(str, KERNEL_CODE, strlen(KERNEL_CODE)) == 0)
++ elf_info.kern_paddr_start = base;
++ else if (strncmp(str, KERNEL_DATA, strlen(KERNEL_DATA)) == 0)
++ elf_info.kern_size = base + length - elf_info.kern_paddr_start;
+
+ return 0;
+ }
+@@ -115,5 +152,64 @@ static int crash_get_memory_ranges(void)
+ dbgprint_mem_range("Coredump memory ranges",
+ crash_memory_rgns.ranges, crash_memory_rgns.size);
+
++ /*
++ * For additional kernel code/data segment.
++ * kern_paddr_start/kern_size are determined in iomem_range_callback
++ */
++ elf_info.kern_vaddr_start = get_kernel_sym("_text");
++ if (!elf_info.kern_vaddr_start)
++ elf_info.kern_vaddr_start = UINT64_MAX;
++
++ return 0;
++}
++
++/*
++ * load_crashdump_segments() - load the elf core header
++ * @info: kexec info structure
++ *
++ * This function creates and loads an additional segment of elf core header
++ : which is used to construct /proc/vmcore on crash dump kernel.
++ *
++ * Return 0 in case of success and -1 in case of error.
++ */
++
++int load_crashdump_segments(struct kexec_info *info)
++{
++ unsigned long elfcorehdr;
++ unsigned long bufsz;
++ void *buf;
++ int err;
++
++ /*
++ * First fetch all the memory (RAM) ranges that we are going to
++ * pass to the crash dump kernel during panic.
++ */
++
++ err = crash_get_memory_ranges();
++
++ if (err)
++ return err;
++
++ elf_info.page_offset = get_kernel_page_offset();
++ dbgprintf("%s: page_offset: %016llx\n", __func__,
++ elf_info.page_offset);
++
++ err = crash_create_elf64_headers(info, &elf_info,
++ crash_memory_rgns.ranges, crash_memory_rgns.size,
++ &buf, &bufsz, ELF_CORE_HEADER_ALIGN);
++
++ if (err)
++ return err;
++
++ elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 0,
++ crash_reserved_mem.start, crash_reserved_mem.end,
++ -1, 0);
++
++ elfcorehdr_mem.start = elfcorehdr;
++ elfcorehdr_mem.end = elfcorehdr + bufsz - 1;
++
++ dbgprintf("%s: elfcorehdr 0x%llx-0x%llx\n", __func__,
++ elfcorehdr_mem.start, elfcorehdr_mem.end);
++
+ return 0;
+ }
+diff --git a/kexec/arch/arm64/crashdump-arm64.h b/kexec/arch/arm64/crashdump-arm64.h
+index 07a0ed0..da75a2d 100644
+--- a/kexec/arch/arm64/crashdump-arm64.h
++++ b/kexec/arch/arm64/crashdump-arm64.h
+@@ -18,5 +18,8 @@
+
+ extern struct memory_ranges usablemem_rgns;
+ extern struct memory_range crash_reserved_mem;
++extern struct memory_range elfcorehdr_mem;
++
++extern int load_crashdump_segments(struct kexec_info *info);
+
+ #endif /* CRASHDUMP_ARM64_H */
+diff --git a/kexec/arch/arm64/iomem.h b/kexec/arch/arm64/iomem.h
+index 20cda87..d4864bb 100644
+--- a/kexec/arch/arm64/iomem.h
++++ b/kexec/arch/arm64/iomem.h
+@@ -2,6 +2,8 @@
+ #define IOMEM_H
+
+ #define SYSTEM_RAM "System RAM\n"
++#define KERNEL_CODE "Kernel code\n"
++#define KERNEL_DATA "Kernel data\n"
+ #define CRASH_KERNEL "Crash kernel\n"
+ #define IOMEM_RESERVED "reserved\n"
+
+diff --git a/kexec/arch/arm64/kexec-elf-arm64.c b/kexec/arch/arm64/kexec-elf-arm64.c
+index daf8bf0..c70a37a 100644
+--- a/kexec/arch/arm64/kexec-elf-arm64.c
++++ b/kexec/arch/arm64/kexec-elf-arm64.c
+@@ -119,6 +119,16 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
+ dbgprintf("%s: PE format: %s\n", __func__,
+ (arm64_header_check_pe_sig(header) ? "yes" : "no"));
+
++ if (info->kexec_flags & KEXEC_ON_CRASH) {
++ /* create and initialize elf core header segment */
++ result = load_crashdump_segments(info);
++ if (result) {
++ dbgprintf("%s: Creating eflcorehdr failed.\n",
++ __func__);
++ goto exit;
++ }
++ }
++
+ /* load the kernel */
+ result = elf_exec_load(&ehdr, info);
+
+--
+1.9.1
+
diff --git a/meta/recipes-kernel/kexec/kexec-tools/0006-arm64-kdump-set-up-kernel-image-segment.patch b/meta/recipes-kernel/kexec/kexec-tools/0006-arm64-kdump-set-up-kernel-image-segment.patch
new file mode 100644
index 0000000..4443fd5
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/0006-arm64-kdump-set-up-kernel-image-segment.patch
@@ -0,0 +1,137 @@
+From 4079c93ac5453ef5f7889ab64920c1e9427690ef Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Tue, 17 Feb 2015 16:06:55 +0900
+Subject: [PATCH 6/9] arm64: kdump: set up kernel image segment
+
+On arm64, we can use the same kernel image as 1st kernel, but
+we have to modify the entry point as well as segments' addresses
+in the kernel's elf header in order to load them into correct places.
+
+Upstream-Status: Submitted [http://lists.infradead.org/pipermail/kexec/2016-November/017561.html]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/crashdump-arm64.c | 23 +++++++++++++++++++++++
+ kexec/arch/arm64/crashdump-arm64.h | 1 +
+ kexec/arch/arm64/kexec-arm64.c | 25 ++++++++++++++++++++-----
+ kexec/arch/arm64/kexec-elf-arm64.c | 10 +++++++++-
+ 4 files changed, 53 insertions(+), 6 deletions(-)
+
+diff --git a/kexec/arch/arm64/crashdump-arm64.c b/kexec/arch/arm64/crashdump-arm64.c
+index 8346131..9517329 100644
+--- a/kexec/arch/arm64/crashdump-arm64.c
++++ b/kexec/arch/arm64/crashdump-arm64.c
+@@ -213,3 +213,26 @@ int load_crashdump_segments(struct kexec_info *info)
+
+ return 0;
+ }
++
++/*
++ * e_entry and p_paddr are actually in virtual address space.
++ * Those values will be translated to physcal addresses by
++ * using virt_to_phys().
++ * So let's get ready for later use so the memory base (phys_offset)
++ * will be correctly replaced with crash_reserved_mem.start.
++ */
++void modify_ehdr_for_crashdump(struct mem_ehdr *ehdr)
++{
++ struct mem_phdr *phdr;
++ int i;
++
++ ehdr->e_entry += - arm64_mem.phys_offset + crash_reserved_mem.start;
++
++ for (i = 0; i < ehdr->e_phnum; i++) {
++ phdr = &ehdr->e_phdr[i];
++ if (phdr->p_type != PT_LOAD)
++ continue;
++ phdr->p_paddr +=
++ (-arm64_mem.phys_offset + crash_reserved_mem.start);
++ }
++}
+diff --git a/kexec/arch/arm64/crashdump-arm64.h b/kexec/arch/arm64/crashdump-arm64.h
+index da75a2d..382f571 100644
+--- a/kexec/arch/arm64/crashdump-arm64.h
++++ b/kexec/arch/arm64/crashdump-arm64.h
+@@ -21,5 +21,6 @@ extern struct memory_range crash_reserved_mem;
+ extern struct memory_range elfcorehdr_mem;
+
+ extern int load_crashdump_segments(struct kexec_info *info);
++extern void modify_ehdr_for_crashdump(struct mem_ehdr *ehdr);
+
+ #endif /* CRASHDUMP_ARM64_H */
+diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
+index 8ac811d..cec4e41 100644
+--- a/kexec/arch/arm64/kexec-arm64.c
++++ b/kexec/arch/arm64/kexec-arm64.c
+@@ -307,12 +307,27 @@ unsigned long arm64_locate_kernel_segment(struct kexec_info *info)
+ {
+ unsigned long hole;
+
+- hole = locate_hole(info,
+- arm64_mem.text_offset + arm64_mem.image_size,
+- MiB(2), 0, ULONG_MAX, 1);
++ if (info->kexec_flags & KEXEC_ON_CRASH) {
++ unsigned long hole_end;
++
++ hole = (crash_reserved_mem.start < mem_min ?
++ mem_min : crash_reserved_mem.start);
++ hole = _ALIGN_UP(hole, MiB(2));
++ hole_end = hole + arm64_mem.text_offset + arm64_mem.image_size;
++
++ if ((hole_end > mem_max) ||
++ (hole_end > crash_reserved_mem.end)) {
++ dbgprintf("%s: Crash kernel out of range\n", __func__);
++ hole = ULONG_MAX;
++ }
++ } else {
++ hole = locate_hole(info,
++ arm64_mem.text_offset + arm64_mem.image_size,
++ MiB(2), 0, ULONG_MAX, 1);
+
+- if (hole == ULONG_MAX)
+- dbgprintf("%s: locate_hole failed\n", __func__);
++ if (hole == ULONG_MAX)
++ dbgprintf("%s: locate_hole failed\n", __func__);
++ }
+
+ return hole;
+ }
+diff --git a/kexec/arch/arm64/kexec-elf-arm64.c b/kexec/arch/arm64/kexec-elf-arm64.c
+index c70a37a..842ce21 100644
+--- a/kexec/arch/arm64/kexec-elf-arm64.c
++++ b/kexec/arch/arm64/kexec-elf-arm64.c
+@@ -9,6 +9,7 @@
+ #include <stdlib.h>
+ #include <linux/elf.h>
+
++#include "crashdump-arm64.h"
+ #include "kexec-arm64.h"
+ #include "kexec-elf.h"
+ #include "kexec-syscall.h"
+@@ -105,7 +106,8 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
+ }
+
+ arm64_mem.vp_offset = _ALIGN_DOWN(ehdr.e_entry, MiB(2));
+- arm64_mem.vp_offset -= kernel_segment - get_phys_offset();
++ if (!(info->kexec_flags & KEXEC_ON_CRASH))
++ arm64_mem.vp_offset -= kernel_segment - get_phys_offset();
+
+ dbgprintf("%s: kernel_segment: %016lx\n", __func__, kernel_segment);
+ dbgprintf("%s: text_offset: %016lx\n", __func__,
+@@ -127,6 +129,12 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
+ __func__);
+ goto exit;
+ }
++
++ /*
++ * offset addresses in order to fit vmlinux
++ * (elf_exec) into crash kernel's memory
++ */
++ modify_ehdr_for_crashdump(&ehdr);
+ }
+
+ /* load the kernel */
+--
+1.9.1
+
diff --git a/meta/recipes-kernel/kexec/kexec-tools/0007-arm64-kdump-set-up-other-segments.patch b/meta/recipes-kernel/kexec/kexec-tools/0007-arm64-kdump-set-up-other-segments.patch
new file mode 100644
index 0000000..1ee6809
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/0007-arm64-kdump-set-up-other-segments.patch
@@ -0,0 +1,35 @@
+From 07ad14e12665221d754fde8e47c32ac18c24586a Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Fri, 31 Jul 2015 20:01:39 +0900
+Subject: [PATCH 7/9] arm64: kdump: set up other segments
+
+We make sure that all the other segments, initrd and device-tree blob,
+also be loaded into the reserved memory of crash dump kernel.
+
+Upstream-Status: Submitted [http://lists.infradead.org/pipermail/kexec/2016-November/017562.html]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/kexec-arm64.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
+index cec4e41..78a0035 100644
+--- a/kexec/arch/arm64/kexec-arm64.c
++++ b/kexec/arch/arm64/kexec-arm64.c
+@@ -374,7 +374,10 @@ int arm64_load_other_segments(struct kexec_info *info,
+ /* Put the other segments after the image. */
+
+ hole_min = image_base + arm64_mem.image_size;
+- hole_max = ULONG_MAX;
++ if (info->kexec_flags & KEXEC_ON_CRASH)
++ hole_max = crash_reserved_mem.end;
++ else
++ hole_max = ULONG_MAX;
+
+ if (arm64_opts.initrd) {
+ initrd_buf = slurp_file(arm64_opts.initrd, &initrd_size);
+--
+1.9.1
+
diff --git a/meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch b/meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch
new file mode 100644
index 0000000..e8358c1
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch
@@ -0,0 +1,150 @@
+From 23bf7ac189cc3b87ceb9d1d3b69b5c4815354add Mon Sep 17 00:00:00 2001
+From: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Date: Wed, 27 Jan 2016 13:38:39 +0900
+Subject: [PATCH 8/9] arm64: kdump: add DT properties to crash dump kernel's
+ dtb
+
+We pass the following properties to crash dump kernel:
+linux,elfcorehdr: elf core header segment,
+ same as "elfcorehdr=" kernel parameter on other archs
+linux,usable-memory-range: usable memory reserved for crash dump kernel
+
+Upstream-Status: Submitted [http://lists.infradead.org/pipermail/kexec/2016-November/017563.html]
+
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/kexec-arm64.c | 76 +++++++++++++++++++++++++++++++++++---
+ kexec/arch/arm64/kexec-elf-arm64.c | 5 ---
+ 2 files changed, 71 insertions(+), 10 deletions(-)
+
+diff --git a/kexec/arch/arm64/kexec-arm64.c b/kexec/arch/arm64/kexec-arm64.c
+index 78a0035..a8fb64f 100644
+--- a/kexec/arch/arm64/kexec-arm64.c
++++ b/kexec/arch/arm64/kexec-arm64.c
+@@ -128,9 +128,6 @@ int arch_process_options(int argc, char **argv)
+ case OPT_INITRD:
+ arm64_opts.initrd = optarg;
+ break;
+- case OPT_PANIC:
+- die("load-panic (-p) not supported");
+- break;
+ default:
+ break; /* Ignore core and unknown options. */
+ }
+@@ -285,8 +282,12 @@ on_success:
+ * setup_2nd_dtb - Setup the 2nd stage kernel's dtb.
+ */
+
+-static int setup_2nd_dtb(struct dtb *dtb, char *command_line)
++static int setup_2nd_dtb(struct dtb *dtb, char *command_line, int on_crash)
+ {
++ char *new_buf;
++ int new_size;
++ int nodeoffset;
++ uint64_t range[2];
+ int result;
+
+ result = fdt_check_header(dtb->buf);
+@@ -298,8 +299,72 @@ static int setup_2nd_dtb(struct dtb *dtb, char *command_line)
+
+ result = set_bootargs(dtb, command_line);
+
++ /* remove those anyway */
++ nodeoffset = fdt_path_offset(dtb->buf, "/chosen");
++ fdt_delprop(dtb->buf, nodeoffset, "linux,crashkernel-base");
++ fdt_delprop(dtb->buf, nodeoffset, "linux,crashkernel-size");
++
++ if (on_crash) {
++ nodeoffset = fdt_path_offset(dtb->buf, "/chosen");
++ fdt_delprop(dtb->buf, nodeoffset, "linux,elfcorehdr");
++ fdt_delprop(dtb->buf, nodeoffset, "linux,usable-memory-range");
++ new_size = fdt_totalsize(dtb->buf)
++ + 2 * (sizeof(struct fdt_property)
++ + FDT_TAGALIGN(sizeof(range)))
++ + strlen("linux,elfcorehdr") + 1
++ + strlen("linux,usable-memory-range") + 1;
++
++ new_buf = xmalloc(new_size);
++ result = fdt_open_into(dtb->buf, new_buf, new_size);
++ if (result) {
++ dbgprintf("%s: fdt_open_into failed: %s\n", __func__,
++ fdt_strerror(result));
++ result = -ENOSPC;
++ goto on_error;
++ }
++
++ range[0] = cpu_to_be64(elfcorehdr_mem.start);
++ range[1] = cpu_to_be64(elfcorehdr_mem.end
++ - elfcorehdr_mem.start + 1);
++ nodeoffset = fdt_path_offset(new_buf, "/chosen");
++ result = fdt_setprop(new_buf, nodeoffset, "linux,elfcorehdr",
++ (void *)range, sizeof(range));
++ if (result) {
++ dbgprintf("%s: fdt_setprop failed: %s\n", __func__,
++ fdt_strerror(result));
++ result = -EINVAL;
++ goto on_error;
++ }
++
++ range[0] = cpu_to_be64(crash_reserved_mem.start);
++ range[1] = cpu_to_be64(crash_reserved_mem.end
++ - crash_reserved_mem.start + 1);
++ nodeoffset = fdt_path_offset(new_buf, "/chosen");
++ result = fdt_setprop(new_buf, nodeoffset,
++ "linux,usable-memory-range",
++ (void *)range, sizeof(range));
++ if (result) {
++ dbgprintf("%s: fdt_setprop failed: %s\n", __func__,
++ fdt_strerror(result));
++ result = -EINVAL;
++ goto on_error;
++ }
++
++ fdt_pack(new_buf);
++ dtb->buf = new_buf;
++ dtb->size = fdt_totalsize(new_buf);
++ }
++
+ dump_reservemap(dtb);
+
++
++ return result;
++
++on_error:
++ fprintf(stderr, "kexec: %s failed.\n", __func__);
++ if (new_buf)
++ free(new_buf);
++
+ return result;
+ }
+
+@@ -366,7 +431,8 @@ int arm64_load_other_segments(struct kexec_info *info,
+ }
+ }
+
+- result = setup_2nd_dtb(&dtb, command_line);
++ result = setup_2nd_dtb(&dtb, command_line,
++ info->kexec_flags & KEXEC_ON_CRASH);
+
+ if (result)
+ return -EFAILED;
+diff --git a/kexec/arch/arm64/kexec-elf-arm64.c b/kexec/arch/arm64/kexec-elf-arm64.c
+index 842ce21..b17a31a 100644
+--- a/kexec/arch/arm64/kexec-elf-arm64.c
++++ b/kexec/arch/arm64/kexec-elf-arm64.c
+@@ -47,11 +47,6 @@ int elf_arm64_load(int argc, char **argv, const char *kernel_buf,
+ int result;
+ int i;
+
+- if (info->kexec_flags & KEXEC_ON_CRASH) {
+- fprintf(stderr, "kexec: kdump not yet supported on arm64\n");
+- return -EFAILED;
+- }
+-
+ result = build_elf_exec_info(kernel_buf, kernel_size, &ehdr, 0);
+
+ if (result < 0) {
+--
+1.9.1
+
diff --git a/meta/recipes-kernel/kexec/kexec-tools/0009-arm64-kdump-Add-support-for-binary-image-files.patch b/meta/recipes-kernel/kexec/kexec-tools/0009-arm64-kdump-Add-support-for-binary-image-files.patch
new file mode 100644
index 0000000..6d42f83
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/0009-arm64-kdump-Add-support-for-binary-image-files.patch
@@ -0,0 +1,52 @@
+From 5a4958f01a793c3e7f440f5bae75666a4349cc50 Mon Sep 17 00:00:00 2001
+From: Pratyush Anand <panand@redhat.com>
+Date: Thu, 14 May 2015 11:25:37 +0530
+Subject: [PATCH 9/9] arm64: kdump: Add support for binary image files
+
+This patch adds support to use binary image ie arch/arm64/boot/Image with
+kdump.
+
+Upstream-Status: Submitted [http://lists.infradead.org/pipermail/kexec/2016-November/017564.html]
+
+Signed-off-by: Pratyush Anand <panand@redhat.com>
+[takahiro.akashi@linaro.org: a bit reworked]
+Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ kexec/arch/arm64/kexec-image-arm64.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/kexec/arch/arm64/kexec-image-arm64.c b/kexec/arch/arm64/kexec-image-arm64.c
+index 960ed96..982e431 100644
+--- a/kexec/arch/arm64/kexec-image-arm64.c
++++ b/kexec/arch/arm64/kexec-image-arm64.c
+@@ -4,7 +4,9 @@
+
+ #define _GNU_SOURCE
+
++#include "crashdump-arm64.h"
+ #include "kexec-arm64.h"
++#include "kexec-syscall.h"
+ #include <limits.h>
+
+ int image_arm64_probe(const char *kernel_buf, off_t kernel_size)
+@@ -58,6 +60,16 @@ int image_arm64_load(int argc, char **argv, const char *kernel_buf,
+ dbgprintf("%s: PE format: %s\n", __func__,
+ (arm64_header_check_pe_sig(header) ? "yes" : "no"));
+
++ if (info->kexec_flags & KEXEC_ON_CRASH) {
++ /* create and initialize elf core header segment */
++ result = load_crashdump_segments(info);
++ if (result) {
++ dbgprintf("%s: Creating eflcorehdr failed.\n",
++ __func__);
++ goto exit;
++ }
++ }
++
+ /* load the kernel */
+ add_segment_phys_virt(info, kernel_buf, kernel_size,
+ kernel_segment + arm64_mem.text_offset,
+--
+1.9.1
+
diff --git a/meta/recipes-kernel/kexec/kexec-tools/kexec-aarch64.patch b/meta/recipes-kernel/kexec/kexec-tools/kexec-aarch64.patch
deleted file mode 100644
index b03f582..0000000
--- a/meta/recipes-kernel/kexec/kexec-tools/kexec-aarch64.patch
+++ /dev/null
@@ -1,801 +0,0 @@
-From: Geoff Levand <geoff@infradead.org>
-Date: Mon, 15 Jul 2013 23:32:36 +0000 (-0700)
-Subject: Add arm64 support
-X-Git-Url: https://git.linaro.org/gitweb?p=people%2Fgeoff%2Fkexec-tools.git;a=commitdiff_plain;h=fbf5ac6c2c70ec0f6da2b9ff563e573999752c01
-
-Add arm64 support
-
-Signed-off-by: Geoff Levand <geoff@infradead.org>
-
-Get patch from:
-https://fedorapeople.org/~hrw/aarch64/for-fedora/kexec-aarch64.patch
-
-Upstream-Status: Pending
-
-Signed-off-by: Kai Kang <kai.kang@windriver.com>
----
-
----
- configure.ac | 3
- kexec/Makefile | 1
- kexec/arch/arm64/Makefile | 13 +
- kexec/arch/arm64/crashdump-arm64.c | 305 ++++++++++++++++++++++++++++++++
- kexec/arch/arm64/include/arch/options.h | 26 ++
- kexec/arch/arm64/kexec-arm64.c | 177 ++++++++++++++++++
- kexec/arch/arm64/kexec-arm64.h | 20 ++
- kexec/arch/arm64/kexec-elf-arm64.c | 114 +++++++++++
- kexec/kexec-syscall.h | 9
- kexec/kexec.c | 2
- purgatory/arch/arm64/Makefile | 7
- 11 files changed, 675 insertions(+), 2 deletions(-)
-
-Index: kexec-tools-2.0.10/configure.ac
-===================================================================
---- kexec-tools-2.0.10.orig/configure.ac
-+++ kexec-tools-2.0.10/configure.ac
-@@ -36,6 +36,9 @@ case $target_cpu in
- ARCH="ppc64"
- SUBARCH="LE"
- ;;
-+ aarch64* )
-+ ARCH="arm64"
-+ ;;
- arm* )
- ARCH="arm"
- ;;
-Index: kexec-tools-2.0.10/kexec/Makefile
-===================================================================
---- kexec-tools-2.0.10.orig/kexec/Makefile
-+++ kexec-tools-2.0.10/kexec/Makefile
-@@ -71,6 +71,7 @@ KEXEC_SRCS += $($(ARCH)_FS2DT)
-
- include $(srcdir)/kexec/arch/alpha/Makefile
- include $(srcdir)/kexec/arch/arm/Makefile
-+include $(srcdir)/kexec/arch/arm64/Makefile
- include $(srcdir)/kexec/arch/i386/Makefile
- include $(srcdir)/kexec/arch/ia64/Makefile
- include $(srcdir)/kexec/arch/m68k/Makefile
-Index: kexec-tools-2.0.10/kexec/arch/arm64/Makefile
-===================================================================
---- /dev/null
-+++ kexec-tools-2.0.10/kexec/arch/arm64/Makefile
-@@ -0,0 +1,13 @@
-+
-+arm64_KEXEC_SRCS += \
-+ kexec/arch/arm64/kexec-arm64.c \
-+ kexec/arch/arm64/kexec-elf-arm64.c \
-+ kexec/arch/arm64/crashdump-arm64.c
-+
-+arm64_ARCH_REUSE_INITRD =
-+arm64_ADD_SEGMENT =
-+arm64_VIRT_TO_PHYS =
-+
-+dist += $(arm64_KEXEC_SRCS) \
-+ kexec/arch/arm64/Makefile \
-+ kexec/arch/arm64/kexec-arm64.h
-Index: kexec-tools-2.0.10/kexec/arch/arm64/crashdump-arm64.c
-===================================================================
---- /dev/null
-+++ kexec-tools-2.0.10/kexec/arch/arm64/crashdump-arm64.c
-@@ -0,0 +1,305 @@
-+/*
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation (version 2 of the License).
-+ */
-+
-+#include "../../kexec.h"
-+#include "../../kexec-elf.h"
-+#include "../../crashdump.h"
-+
-+int is_crashkernel_mem_reserved(void)
-+{
-+ return 0;
-+}
-+
-+#if 0
-+/*
-+ * Used to save various memory ranges/regions needed for the captured
-+ * kernel to boot. (lime memmap= option in other archs)
-+ */
-+static struct memory_range crash_memory_ranges[CRASH_MAX_MEMORY_RANGES];
-+struct memory_ranges usablemem_rgns = {
-+ .size = 0,
-+ .ranges = crash_memory_ranges,
-+};
-+
-+/* memory range reserved for crashkernel */
-+static struct memory_range crash_reserved_mem;
-+
-+static struct crash_elf_info elf_info = {
-+ .class = ELFCLASS32,
-+ .data = ELFDATA2LSB,
-+ .machine = EM_ARM,
-+ .page_offset = PAGE_OFFSET,
-+};
-+
-+unsigned long phys_offset;
-+
-+/**
-+ * crash_range_callback() - callback called for each iomem region
-+ * @data: not used
-+ * @nr: not used
-+ * @str: name of the memory region
-+ * @base: start address of the memory region
-+ * @length: size of the memory region
-+ *
-+ * This function is called once for each memory region found in /proc/iomem. It
-+ * locates system RAM and crashkernel reserved memory and places these to
-+ * variables: @crash_memory_ranges and @crash_reserved_mem. Number of memory
-+ * regions is placed in @crash_memory_nr_ranges.
-+ */
-+static int crash_range_callback(void *UNUSED(data), int UNUSED(nr),
-+ char *str, unsigned long base,
-+ unsigned long length)
-+{
-+ struct memory_range *range;
-+
-+ if (usablemem_rgns.size >= CRASH_MAX_MEMORY_RANGES)
-+ return 1;
-+
-+ range = usablemem_rgns.ranges + usablemem_rgns.size;
-+
-+ if (strncmp(str, "System RAM\n", 11) == 0) {
-+ range->start = base;
-+ range->end = base + length - 1;
-+ range->type = RANGE_RAM;
-+ usablemem_rgns.size++;
-+ } else if (strncmp(str, "Crash kernel\n", 13) == 0) {
-+ crash_reserved_mem.start = base;
-+ crash_reserved_mem.end = base + length - 1;
-+ crash_reserved_mem.type = RANGE_RAM;
-+ }
-+
-+ return 0;
-+}
-+
-+/**
-+ * crash_exclude_range() - excludes memory region reserved for crashkernel
-+ *
-+ * Function locates where crashkernel reserved memory is and removes that region
-+ * from the available memory regions.
-+ */
-+static void crash_exclude_range(void)
-+{
-+ const struct memory_range *range = &crash_reserved_mem;
-+ int i;
-+
-+ for (i = 0; i < usablemem_rgns.size; i++) {
-+ struct memory_range *r = usablemem_rgns.ranges + i;
-+
-+ /*
-+ * We assume that crash area is fully contained in
-+ * some larger memory area.
-+ */
-+ if (r->start <= range->start && r->end >= range->end) {
-+ struct memory_range *new;
-+ /*
-+ * Let's split this area into 2 smaller ones and
-+ * remove excluded range from between. First create
-+ * new entry for the remaining area.
-+ */
-+ new = usablemem_rgns.ranges + usablemem_rgns.size;
-+ new->start = range->end + 1;
-+ new->end = r->end;
-+ usablemem_rgns.size++;
-+ /*
-+ * Next update this area to end before excluded range.
-+ */
-+ r->end = range->start - 1;
-+ break;
-+ }
-+ }
-+}
-+
-+static int range_cmp(const void *a1, const void *a2)
-+{
-+ const struct memory_range *r1 = a1;
-+ const struct memory_range *r2 = a2;
-+
-+ if (r1->start > r2->start)
-+ return 1;
-+ if (r1->start < r2->start)
-+ return -1;
-+
-+ return 0;
-+}
-+
-+/**
-+ * crash_get_memory_ranges() - read system physical memory
-+ *
-+ * Function reads through system physical memory and stores found memory regions
-+ * in @crash_memory_ranges. Number of memory regions found is placed in
-+ * @crash_memory_nr_ranges. Regions are sorted in ascending order.
-+ *
-+ * Returns %0 in case of success and %-1 otherwise (errno is set).
-+ */
-+static int crash_get_memory_ranges(void)
-+{
-+ /*
-+ * First read all memory regions that can be considered as
-+ * system memory including the crash area.
-+ */
-+ kexec_iomem_for_each_line(NULL, crash_range_callback, NULL);
-+
-+ if (usablemem_rgns.size < 1) {
-+ errno = EINVAL;
-+ return -1;
-+ }
-+
-+ /*
-+ * Exclude memory reserved for crashkernel (this may result a split memory
-+ * region).
-+ */
-+ crash_exclude_range();
-+
-+ /*
-+ * Make sure that the memory regions are sorted.
-+ */
-+ qsort(usablemem_rgns.ranges, usablemem_rgns.size,
-+ sizeof(*usablemem_rgns.ranges), range_cmp);
-+
-+ return 0;
-+}
-+
-+/**
-+ * cmdline_add_elfcorehdr() - adds elfcorehdr= to @cmdline
-+ * @cmdline: buffer where parameter is placed
-+ * @elfcorehdr: physical address of elfcorehdr
-+ *
-+ * Function appends 'elfcorehdr=start' at the end of the command line given in
-+ * @cmdline. Note that @cmdline must be at least %COMMAND_LINE_SIZE bytes long
-+ * (inclunding %NUL).
-+ */
-+static void cmdline_add_elfcorehdr(char *cmdline, unsigned long elfcorehdr)
-+{
-+ char buf[COMMAND_LINE_SIZE];
-+ int buflen;
-+
-+ buflen = snprintf(buf, sizeof(buf), "%s elfcorehdr=%#lx",
-+ cmdline, elfcorehdr);
-+ if (buflen < 0)
-+ die("Failed to construct elfcorehdr= command line parameter\n");
-+ if (buflen >= sizeof(buf))
-+ die("Command line overflow\n");
-+
-+ (void) strncpy(cmdline, buf, COMMAND_LINE_SIZE);
-+ cmdline[COMMAND_LINE_SIZE - 1] = '\0';
-+}
-+
-+/**
-+ * cmdline_add_mem() - adds mem= parameter to kernel command line
-+ * @cmdline: buffer where parameter is placed
-+ * @size: size of the kernel reserved memory (in bytes)
-+ *
-+ * This function appends 'mem=size' at the end of the command line given in
-+ * @cmdline. Note that @cmdline must be at least %COMMAND_LINE_SIZE bytes long
-+ * (including %NUL).
-+ */
-+static void cmdline_add_mem(char *cmdline, unsigned long size)
-+{
-+ char buf[COMMAND_LINE_SIZE];
-+ int buflen;
-+
-+ buflen = snprintf(buf, sizeof(buf), "%s mem=%ldK", cmdline, size >> 10);
-+ if (buflen < 0)
-+ die("Failed to construct mem= command line parameter\n");
-+ if (buflen >= sizeof(buf))
-+ die("Command line overflow\n");
-+
-+ (void) strncpy(cmdline, buf, COMMAND_LINE_SIZE);
-+ cmdline[COMMAND_LINE_SIZE - 1] = '\0';
-+}
-+
-+static unsigned long long range_size(const struct memory_range *r)
-+{
-+ return r->end - r->start + 1;
-+}
-+
-+static void dump_memory_ranges(void)
-+{
-+ int i;
-+
-+ if (!kexec_debug)
-+ return;
-+
-+ dbgprintf("crashkernel: [%#llx - %#llx] (%ldM)\n",
-+ crash_reserved_mem.start, crash_reserved_mem.end,
-+ (unsigned long)range_size(&crash_reserved_mem) >> 20);
-+
-+ for (i = 0; i < usablemem_rgns.size; i++) {
-+ struct memory_range *r = usablemem_rgns.ranges + i;
-+ dbgprintf("memory range: [%#llx - %#llx] (%ldM)\n",
-+ r->start, r->end, (unsigned long)range_size(r) >> 20);
-+ }
-+}
-+
-+/**
-+ * load_crashdump_segments() - loads additional segments needed for kdump
-+ * @info: kexec info structure
-+ * @mod_cmdline: kernel command line
-+ *
-+ * This function loads additional segments which are needed for the dump capture
-+ * kernel. It also updates kernel command line passed in @mod_cmdline to have
-+ * right parameters for the dump capture kernel.
-+ *
-+ * Return %0 in case of success and %-1 in case of error.
-+ */
-+int load_crashdump_segments(struct kexec_info *info, char *mod_cmdline)
-+{
-+ unsigned long elfcorehdr;
-+ unsigned long bufsz;
-+ void *buf;
-+ int err;
-+
-+ /*
-+ * First fetch all the memory (RAM) ranges that we are going to pass to
-+ * the crashdump kernel during panic.
-+ */
-+ err = crash_get_memory_ranges();
-+ if (err)
-+ return err;
-+
-+ /*
-+ * Now that we have memory regions sorted, we can use first memory
-+ * region as PHYS_OFFSET.
-+ */
-+ phys_offset = usablemem_rgns.ranges->start;
-+ dbgprintf("phys_offset: %#lx\n", phys_offset);
-+
-+ err = crash_create_elf32_headers(info, &elf_info,
-+ usablemem_rgns.ranges,
-+ usablemem_rgns.size, &buf, &bufsz,
-+ ELF_CORE_HEADER_ALIGN);
-+ if (err)
-+ return err;
-+
-+ /*
-+ * We allocate ELF core header from the end of the memory area reserved
-+ * for the crashkernel. We align the header to SECTION_SIZE (which is
-+ * 1MB) so that available memory passed in kernel command line will be
-+ * aligned to 1MB. This is because kernel create_mapping() wants memory
-+ * regions to be aligned to SECTION_SIZE.
-+ */
-+ elfcorehdr = add_buffer_phys_virt(info, buf, bufsz, bufsz, 1 << 20,
-+ crash_reserved_mem.start,
-+ crash_reserved_mem.end, -1, 0);
-+
-+ dbgprintf("elfcorehdr: %#lx\n", elfcorehdr);
-+ cmdline_add_elfcorehdr(mod_cmdline, elfcorehdr);
-+
-+ /*
-+ * Add 'mem=size' parameter to dump capture kernel command line. This
-+ * prevents the dump capture kernel from using any other memory regions
-+ * which belong to the primary kernel.
-+ */
-+ cmdline_add_mem(mod_cmdline, elfcorehdr - crash_reserved_mem.start);
-+
-+ dump_memory_ranges();
-+ dbgprintf("kernel command line: \"%s\"\n", mod_cmdline);
-+
-+ return 0;
-+}
-+
-+#endif
-+
-Index: kexec-tools-2.0.10/kexec/arch/arm64/include/arch/options.h
-===================================================================
---- /dev/null
-+++ kexec-tools-2.0.10/kexec/arch/arm64/include/arch/options.h
-@@ -0,0 +1,26 @@
-+#ifndef KEXEC_ARCH_ARM64_OPTIONS_H
-+#define KEXEC_ARCH_ARM64_OPTIONS_H
-+
-+//#define OPT_ARCH_MAX ((OPT_MAX)+0)
-+
-+#define OPT_APPEND ((OPT_MAX)+0)
-+#define OPT_RAMDISK ((OPT_MAX)+1)
-+#define OPT_DTB ((OPT_MAX)+2)
-+
-+#define OPT_ARCH_MAX ((OPT_MAX)+3)
-+
-+
-+#define KEXEC_ARCH_OPTIONS \
-+ KEXEC_OPTIONS \
-+ { "append", 1, NULL, OPT_APPEND }, \
-+ { "command-line", 1, NULL, OPT_APPEND }, \
-+ { "dtb", 1, NULL, OPT_DTB }, \
-+ { "initrd", 1, NULL, OPT_RAMDISK }, \
-+ { "ramdisk", 1, NULL, OPT_RAMDISK }, \
-+
-+#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR /* Only accept long arch options. */
-+
-+#define KEXEC_ALL_OPTIONS KEXEC_ARCH_OPTIONS
-+#define KEXEC_ALL_OPT_STR KEXEC_ARCH_OPT_STR
-+
-+#endif /* KEXEC_ARCH_ARM64_OPTIONS_H */
-Index: kexec-tools-2.0.10/kexec/arch/arm64/kexec-arm64.c
-===================================================================
---- /dev/null
-+++ kexec-tools-2.0.10/kexec/arch/arm64/kexec-arm64.c
-@@ -0,0 +1,177 @@
-+/*
-+ * ARM64 kexec support.
-+ */
-+
-+#define _GNU_SOURCE
-+
-+#include <errno.h>
-+#include <stddef.h>
-+
-+//#include <linux/kexec.h>
-+
-+#include "../../kexec.h"
-+#include "../../kexec-syscall.h"
-+#include "kexec-arm64.h"
-+
-+
-+void arch_usage(void)
-+{
-+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__);
-+
-+ printf(
-+" --append=STRING Set the kernel command line to STRING.\n"
-+" --command-line=STRING Set the kernel command line to STRING.\n"
-+" --dtb=FILE Use FILE as the device tree blob.\n"
-+" --initrd=FILE Use FILE as the kernel initial ramdisk.\n"
-+" --ramdisk=FILE Use FILE as the kernel initial ramdisk.\n");
-+
-+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__);
-+}
-+
-+int arch_process_options(int UNUSED(argc), char **UNUSED(argv))
-+{
-+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__);
-+ return 0;
-+}
-+
-+const struct arch_map_entry arches[] = {
-+ { "aarch64", KEXEC_ARCH_ARM64 },
-+ { NULL, 0 },
-+};
-+
-+void arch_update_purgatory(struct kexec_info *UNUSED(info))
-+{
-+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__);
-+}
-+
-+unsigned long virt_to_phys(unsigned long addr)
-+{
-+ fprintf(stderr, "%s:%d: %016lx -> %016lx\n", __func__, __LINE__, addr,
-+ addr + 0x080000000UL);
-+ return addr + 0x080000000UL;
-+}
-+
-+void add_segment(struct kexec_info *info, const void *buf, size_t bufsz,
-+ unsigned long base, size_t memsz)
-+{
-+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__);
-+ add_segment_phys_virt(info, buf, bufsz, base, memsz, 1);
-+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__);
-+}
-+
-+static int get_memory_ranges_1(struct memory_range **range, int *ranges,
-+ unsigned long kexec_flags)
-+{
-+ static struct memory_range memory_range[KEXEC_SEGMENT_MAX];
-+ const char *iomem;
-+ int range_count = 0;
-+ char line[MAX_LINE];
-+ FILE *fp;
-+
-+ iomem = proc_iomem();
-+ fp = fopen(iomem, "r");
-+
-+ if (!fp) {
-+ fprintf(stderr, "Cannot open %s: %s\n",
-+ iomem, strerror(errno));
-+ return -1;
-+ }
-+
-+ dbgprintf("memory ranges:\n");
-+
-+ while(fgets(line, sizeof(line), fp) != 0) {
-+ struct memory_range r;
-+ char *str;
-+ int consumed;
-+
-+ if (range_count >= KEXEC_SEGMENT_MAX)
-+ break;
-+
-+ if (sscanf(line, "%Lx-%Lx : %n", &r.start, &r.end, &consumed)
-+ != 2)
-+ continue;
-+
-+ str = line + consumed;
-+ r.end++;
-+
-+ if (memcmp(str, "System RAM\n", 11)) {
-+ dbgprintf(" Skip: %016Lx - %016Lx : %s", r.start, r.end,
-+ str);
-+ continue;
-+ }
-+
-+ r.type = RANGE_RAM;
-+ memory_range[range_count] = r;
-+ range_count++;
-+
-+ dbgprintf(" Add: %016Lx - %016Lx : %s", r.start, r.end, str);
-+ }
-+
-+ fclose(fp);
-+ *range = memory_range;
-+ *ranges = range_count;
-+
-+ return 0;
-+}
-+
-+static int get_memory_ranges_2(struct memory_range **range, int *ranges,
-+ unsigned long UNUSED(kexec_flags))
-+{
-+ static struct memory_range memory_range[2];
-+
-+ memory_range[0].start = 0x080000000;
-+ memory_range[0].end = 0x100000000;
-+ memory_range[0].type = RANGE_RAM;
-+
-+ memory_range[1].start = 0x900000000;
-+ memory_range[1].end = 0x880000000;
-+ memory_range[1].type = RANGE_RAM;
-+
-+ *range = memory_range;
-+ *ranges = sizeof(memory_range) / sizeof(memory_range[0]);
-+
-+ return 0;
-+}
-+
-+int get_memory_ranges(struct memory_range **range, int *ranges,
-+ unsigned long kexec_flags)
-+{
-+ /* FIXME: Should get this info from device tree. */
-+
-+ return get_memory_ranges_1(range, ranges, kexec_flags);
-+}
-+
-+struct file_type file_type[] = {
-+ { "elf-arm64", elf_arm64_probe, elf_arm64_load, elf_arm64_usage },
-+};
-+
-+int file_types = sizeof(file_type) / sizeof(file_type[0]);
-+
-+int arch_compat_trampoline(struct kexec_info *info)
-+{
-+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__);
-+ return 0;
-+}
-+
-+void arch_reuse_initrd(void)
-+{
-+}
-+
-+int machine_verify_elf_rel(struct mem_ehdr *ehdr)
-+{
-+ (void)ehdr;
-+
-+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__);
-+ return 0;
-+}
-+
-+void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type,
-+ void *location, unsigned long address, unsigned long value)
-+{
-+ (void)ehdr;
-+ (void)r_type;
-+ (void)location;
-+ (void)address;
-+ (void)value;
-+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__);
-+}
-Index: kexec-tools-2.0.10/kexec/arch/arm64/kexec-arm64.h
-===================================================================
---- /dev/null
-+++ kexec-tools-2.0.10/kexec/arch/arm64/kexec-arm64.h
-@@ -0,0 +1,20 @@
-+/*
-+ * ARM64 kexec support.
-+ */
-+
-+#if !defined(KEXEC_ARM64_H)
-+#define KEXEC_ARM64_H
-+
-+/* #include <linux/kexec.h> FIXME: this is broken */
-+#include <sys/types.h>
-+
-+#include "../../kexec.h"
-+
-+#define KEXEC_SEGMENT_MAX 16 /* FIXME: this should come from <linux/kexec.h> */
-+
-+int elf_arm64_probe(const char *buf, off_t len);
-+int elf_arm64_load(int argc, char **argv, const char *buf, off_t len,
-+ struct kexec_info *info);
-+void elf_arm64_usage(void);
-+
-+#endif
-\ No newline at end of file
-Index: kexec-tools-2.0.10/kexec/arch/arm64/kexec-elf-arm64.c
-===================================================================
---- /dev/null
-+++ kexec-tools-2.0.10/kexec/arch/arm64/kexec-elf-arm64.c
-@@ -0,0 +1,114 @@
-+/*
-+ * ARM64 kexec support.
-+ */
-+
-+#define _GNU_SOURCE
-+
-+#include <elf.h>
-+#include <getopt.h>
-+
-+#include "../../kexec-syscall.h"
-+
-+#include "kexec-arm64.h"
-+#include "arch/options.h"
-+
-+#if !defined(EM_AARCH64)
-+# define EM_AARCH64 183
-+#endif
-+
-+int elf_arm64_probe(const char *buf, off_t len)
-+{
-+ int result;
-+ struct mem_ehdr ehdr;
-+
-+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__);
-+
-+ result = build_elf_exec_info(buf, len, &ehdr, 0);
-+
-+ if (result < 0) {
-+ dbgprintf("Not an ELF executable\n");
-+ goto out;
-+ }
-+
-+ if (ehdr.e_machine != EM_AARCH64) {
-+ dbgprintf("Not an AARCH64 executable\n");
-+ result = -1;
-+ goto out;
-+ }
-+
-+ result = 0;
-+
-+out:
-+ free_elf_info(&ehdr);
-+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__);
-+ return result;
-+}
-+
-+int elf_arm64_load(int argc, char **argv, const char *buf, off_t len,
-+ struct kexec_info *info)
-+{
-+ static const struct option options[] = {
-+ KEXEC_ARCH_OPTIONS
-+ { 0 }
-+ };
-+ static const char short_options[] = KEXEC_OPT_STR "";
-+ const char *command_line = NULL;
-+ unsigned int command_line_len = 0;
-+ const char *ramdisk = NULL;
-+ const char *dtb = NULL;
-+ int opt;
-+ struct mem_ehdr ehdr;
-+ int result;
-+
-+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__);
-+
-+ while ((opt = getopt_long(argc, argv, short_options, options, 0))
-+ != -1) {
-+ switch (opt) {
-+ default:
-+ if (opt < OPT_MAX) /* Ignore core options */
-+ break;
-+ case OPT_APPEND:
-+ command_line = optarg;
-+ command_line_len = strlen(command_line) + 1;
-+ break;
-+ case OPT_RAMDISK:
-+ ramdisk = optarg;
-+ break;
-+ case OPT_DTB:
-+ dtb = optarg;
-+ break;
-+ }
-+ }
-+
-+ fprintf(stderr, "%s:%d: command_line: %s\n", __func__, __LINE__, command_line);
-+ fprintf(stderr, "%s:%d: ramdisk: %s\n", __func__, __LINE__, ramdisk);
-+ fprintf(stderr, "%s:%d: dtb: %s\n", __func__, __LINE__, dtb);
-+
-+ if (info->kexec_flags & KEXEC_ON_CRASH) {
-+ fprintf(stderr, "kexec: kdump not yet supported on arm64\n");
-+ return -1;
-+ }
-+
-+ result = build_elf_exec_info(buf, len, &ehdr, 0);
-+
-+ if (result < 0) {
-+ free_elf_info(&ehdr);
-+ fprintf(stderr, "%s:%d: free_elf_info failed\n", __func__,
-+ __LINE__);
-+ return result;
-+ }
-+
-+ elf_exec_build_load(info, &ehdr, buf, len, 0);
-+
-+ info->entry = (void*)0x80080000UL; // FIXME
-+
-+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__);
-+ return 0;
-+}
-+
-+void elf_arm64_usage(void)
-+{
-+ fprintf(stderr, "%s:%d: ->\n", __func__, __LINE__);
-+ fprintf(stderr, "%s:%d: <-\n", __func__, __LINE__);
-+}
-Index: kexec-tools-2.0.10/kexec/kexec-syscall.h
-===================================================================
---- kexec-tools-2.0.10.orig/kexec/kexec-syscall.h
-+++ kexec-tools-2.0.10/kexec/kexec-syscall.h
-@@ -39,8 +39,8 @@
- #ifdef __s390__
- #define __NR_kexec_load 277
- #endif
--#ifdef __arm__
--#define __NR_kexec_load __NR_SYSCALL_BASE + 347
-+#if defined(__arm__) || defined(__arm64__)
-+#define __NR_kexec_load __NR_SYSCALL_BASE + 347
- #endif
- #if defined(__mips__)
- #define __NR_kexec_load 4311
-@@ -108,6 +108,8 @@ static inline long kexec_file_load(int k
- #define KEXEC_ARCH_PPC64 (21 << 16)
- #define KEXEC_ARCH_IA_64 (50 << 16)
- #define KEXEC_ARCH_ARM (40 << 16)
-+#define KEXEC_ARCH_ARM64 (183 << 16)
-+/* #define KEXEC_ARCH_AARCH64 (183 << 16) */
- #define KEXEC_ARCH_S390 (22 << 16)
- #define KEXEC_ARCH_SH (42 << 16)
- #define KEXEC_ARCH_MIPS_LE (10 << 16)
-@@ -153,5 +155,8 @@ static inline long kexec_file_load(int k
- #ifdef __m68k__
- #define KEXEC_ARCH_NATIVE KEXEC_ARCH_68K
- #endif
-+#if defined(__arm64__)
-+#define KEXEC_ARCH_NATIVE KEXEC_ARCH_ARM64
-+#endif
-
- #endif /* KEXEC_SYSCALL_H */
-Index: kexec-tools-2.0.10/kexec/kexec.c
-===================================================================
---- kexec-tools-2.0.10.orig/kexec/kexec.c
-+++ kexec-tools-2.0.10/kexec/kexec.c
-@@ -664,6 +664,8 @@ static int my_load(const char *type, int
- memset(&info, 0, sizeof(info));
- info.kexec_flags = kexec_flags;
-
-+ fprintf(stderr, "%s:%d: do\n", __func__, __LINE__);
-+
- result = 0;
- if (argc - fileind <= 0) {
- fprintf(stderr, "No kernel specified\n");
-Index: kexec-tools-2.0.10/purgatory/arch/arm64/Makefile
-===================================================================
---- /dev/null
-+++ kexec-tools-2.0.10/purgatory/arch/arm64/Makefile
-@@ -0,0 +1,7 @@
-+#
-+# Purgatory arm64
-+#
-+
-+arm64_PURGATORY_SRCS =
-+
-+dist += purgatory/arch/arm64/Makefile $(arm64_PURGATORY_SRCS)
diff --git a/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch b/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch
deleted file mode 100644
index 26d18eb..0000000
--- a/meta/recipes-kernel/kexec/kexec-tools/kexec-x32.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-x86_64: Add support to build kexec-tools with x32 ABI
-
-Summary of changes,
-
-configure.ac: Add test for detect x32 ABI.
-purgatory/arch/x86_64/Makefile: Not use mcmodel large when
- x32 ABI is set.
-kexec/arch/x86_64/kexec-elf-rel-x86_64.c: When x32 ABI is set
- use ELFCLASS32 instead of ELFCLASS64.
-kexec/kexec-syscall.h: Add correct syscall number for x32 ABI.
-
-Upstream-Status: Submitted
-
-Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
-Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
-
----
- configure.ac | 9 +++++++++
- kexec/arch/x86_64/kexec-elf-rel-x86_64.c | 4 ++++
- kexec/kexec-syscall.h | 4 ++++
- purgatory/arch/x86_64/Makefile | 4 +++-
- 4 files changed, 20 insertions(+), 1 deletion(-)
-
-Index: kexec-tools-2.0.10/configure.ac
-===================================================================
---- kexec-tools-2.0.10.orig/configure.ac
-+++ kexec-tools-2.0.10/configure.ac
-@@ -56,6 +56,15 @@ case $target_cpu in
- ;;
- ia64|x86_64|alpha|m68k )
- ARCH="$target_cpu"
-+
-+ dnl ---Test for x32 ABI in x86_64
-+ if test "x$ARCH" = "xx86_64" ; then
-+ AC_EGREP_CPP(x32_test,
-+ [#if defined(__x86_64__) && defined (__ILP32__)
-+ x32_test
-+ #endif
-+ ], SUBARCH='x32', SUBARCH='64')
-+ fi
- ;;
- * )
- AC_MSG_ERROR([unsupported architecture $target_cpu])
-Index: kexec-tools-2.0.10/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
-===================================================================
---- kexec-tools-2.0.10.orig/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
-+++ kexec-tools-2.0.10/kexec/arch/x86_64/kexec-elf-rel-x86_64.c
-@@ -8,7 +8,11 @@ int machine_verify_elf_rel(struct mem_eh
- if (ehdr->ei_data != ELFDATA2LSB) {
- return 0;
- }
-+#ifdef __ILP32__
-+ if (ehdr->ei_class != ELFCLASS32) {
-+#else
- if (ehdr->ei_class != ELFCLASS64) {
-+#endif
- return 0;
- }
- if (ehdr->e_machine != EM_X86_64) {
-Index: kexec-tools-2.0.10/kexec/kexec-syscall.h
-===================================================================
---- kexec-tools-2.0.10.orig/kexec/kexec-syscall.h
-+++ kexec-tools-2.0.10/kexec/kexec-syscall.h
-@@ -31,8 +31,12 @@
- #define __NR_kexec_load 268
- #endif
- #ifdef __x86_64__
-+#ifdef __ILP32__
-+#define __NR_kexec_load 528
-+#else
- #define __NR_kexec_load 246
- #endif
-+#endif
- #ifdef __s390x__
- #define __NR_kexec_load 277
- #endif
-Index: kexec-tools-2.0.10/purgatory/arch/x86_64/Makefile
-===================================================================
---- kexec-tools-2.0.10.orig/purgatory/arch/x86_64/Makefile
-+++ kexec-tools-2.0.10/purgatory/arch/x86_64/Makefile
-@@ -23,4 +23,6 @@ x86_64_PURGATORY_SRCS += purgatory/arch/
- x86_64_PURGATORY_SRCS += purgatory/arch/i386/vga.c
- x86_64_PURGATORY_SRCS += purgatory/arch/i386/pic.c
-
--x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
-+ifeq ($(SUBARCH),64)
-+ x86_64_PURGATORY_EXTRA_CFLAGS = -mcmodel=large
-+endif
diff --git a/meta/recipes-kernel/kexec/kexec-tools_2.0.12.bb b/meta/recipes-kernel/kexec/kexec-tools_2.0.14.bb
similarity index 55%
rename from meta/recipes-kernel/kexec/kexec-tools_2.0.12.bb
rename to meta/recipes-kernel/kexec/kexec-tools_2.0.14.bb
index 59376c8..de5ce44 100644
--- a/meta/recipes-kernel/kexec/kexec-tools_2.0.12.bb
+++ b/meta/recipes-kernel/kexec/kexec-tools_2.0.14.bb
@@ -3,15 +3,22 @@ export LDFLAGS = "-L${STAGING_LIBDIR}"
EXTRA_OECONF = " --with-zlib=yes"
SRC_URI += " \
- file://kexec-aarch64.patch \
- file://kexec-x32.patch \
file://0002-powerpc-change-the-memory-size-limit.patch \
file://0001-purgatory-Pass-r-directly-to-linker.patch \
file://0001-vmcore-dmesg-Define-_GNU_SOURCE.patch \
+ file://0001-kexec-exntend-the-semantics-of-kexec_iomem_for_each_.patch \
+ file://0002-kexec-generalize-and-rename-get_kernel_stext_sym.patch \
+ file://0003-arm64-identify-PHYS_OFFSET-correctly.patch \
+ file://0004-arm64-kdump-identify-memory-regions.patch \
+ file://0005-arm64-kdump-add-elf-core-header-segment.patch \
+ file://0006-arm64-kdump-set-up-kernel-image-segment.patch \
+ file://0007-arm64-kdump-set-up-other-segments.patch \
+ file://0008-arm64-kdump-add-DT-properties-to-crash-dump-kernel-s.patch \
+ file://0009-arm64-kdump-Add-support-for-binary-image-files.patch \
"
-SRC_URI[md5sum] = "10ddaae0e86af54407b164a1f5a39cc3"
-SRC_URI[sha256sum] = "cc7b60dad0da202004048a6179d8a53606943062dd627a2edba45a8ea3a85135"
+SRC_URI[md5sum] = "b2b2c5e6b29d467d6e99d587fb6b7cf5"
+SRC_URI[sha256sum] = "b3e69519d2acced256843b1e8f1ecfa00d9b54fa07449ed78f05b9193f239370"
PACKAGES =+ "kexec kdump vmcore-dmesg"
--
2.8.3
^ permalink raw reply related
* Re: [PATCH v3 3/3] selftest/wic: Add tests for --exclude-dir option.
From: Kristian Amlie @ 2016-12-29 10:05 UTC (permalink / raw)
To: Burton, Ross; +Cc: OE-core
In-Reply-To: <CAJTo0LZ4S6FWzR6u2Kek_KjcXD48qTWbVLn5Vm2j20fJtyts9A@mail.gmail.com>
Ok, new patchset:
* Removed e2tools recipe.
* Switched to using 'debugfs' instead of 'e2ls' in selftest.
--
Kristian
^ permalink raw reply
* [PATCH v4 1/2] wic: Add --exclude-path option to rootfs source plugin.
From: Kristian Amlie @ 2016-12-29 10:05 UTC (permalink / raw)
To: Burton, Ross; +Cc: OE-core
In-Reply-To: <1483005929-8231-1-git-send-email-kristian.amlie@mender.io>
It will omit the given path from the resulting partition, and if the
given path ends in a slash, it will only delete the content, and keep
the directory.
Since mkfs only accepts whole directories as input, we need to copy
the rootfs directory to the workdir so that we can selectively delete
files from it.
Since we want to use the copyhardlinktree() function, we need to put
the generic oe lib in the module search path.
Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
---
scripts/lib/wic/help.py | 6 +++++
scripts/lib/wic/ksparser.py | 1 +
scripts/lib/wic/partition.py | 1 +
scripts/lib/wic/plugins/source/rootfs.py | 43 +++++++++++++++++++++++++++++++-
scripts/wic | 2 ++
5 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index e5347ec..9dab670 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -715,6 +715,12 @@ DESCRIPTION
partition table. It may be useful for
bootloaders.
+ --exclude-path: This option is specific to wic. It excludes the given
+ absolute path from the resulting image. If the path
+ ends with a slash, only the content of the directory
+ is omitted, not the directory itself. This option only
+ has an effect with the rootfs source plugin.
+
--extra-space: This option is specific to wic. It adds extra
space after the space filled by the content
of the partition. The final size can go
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 0894e2b..17b97fd 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -127,6 +127,7 @@ class KickStart():
part.add_argument('mountpoint', nargs='?')
part.add_argument('--active', action='store_true')
part.add_argument('--align', type=int)
+ part.add_argument('--exclude-path', nargs='+')
part.add_argument("--extra-space", type=sizetype, default=10*1024)
part.add_argument('--fsoptions', dest='fsopts')
part.add_argument('--fstype')
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index ac4c836..cba78a5 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -45,6 +45,7 @@ class Partition():
self.align = args.align
self.disk = args.disk
self.extra_space = args.extra_space
+ self.exclude_path = args.exclude_path
self.fsopts = args.fsopts
self.fstype = args.fstype
self.label = args.label
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index 425da8b..794ad69 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -26,10 +26,13 @@
#
import os
+import shutil
+
+from oe.path import copyhardlinktree
from wic import msger
from wic.pluginbase import SourcePlugin
-from wic.utils.oe.misc import get_bitbake_var
+from wic.utils.oe.misc import get_bitbake_var, exec_cmd
class RootfsPlugin(SourcePlugin):
"""
@@ -78,6 +81,44 @@ class RootfsPlugin(SourcePlugin):
real_rootfs_dir = cls.__get_rootfs_dir(rootfs_dir)
+ # Handle excluded paths.
+ if part.exclude_path is not None:
+ # We need a new rootfs directory we can delete files from. Copy to
+ # workdir.
+ new_rootfs = os.path.join(cr_workdir, "rootfs")
+
+ if os.path.lexists(new_rootfs):
+ shutil.rmtree(os.path.join(new_rootfs))
+
+ copyhardlinktree(real_rootfs_dir, new_rootfs)
+
+ real_rootfs_dir = new_rootfs
+
+ for orig_path in part.exclude_path:
+ path = orig_path
+ if os.path.isabs(path):
+ msger.error("Must be relative: --exclude-path=%s" % orig_path)
+
+ full_path = os.path.realpath(os.path.join(new_rootfs, path))
+
+ # Disallow climbing outside of parent directory using '..',
+ # because doing so could be quite disastrous (we will delete the
+ # directory).
+ if not full_path.startswith(new_rootfs):
+ msger.error("'%s' points to a path outside the rootfs" % orig_path)
+
+ if path.endswith(os.sep):
+ # Delete content only.
+ for entry in os.listdir(full_path):
+ full_entry = os.path.join(full_path, entry)
+ if os.path.isdir(full_entry) and not os.path.islink(full_entry):
+ shutil.rmtree(full_entry)
+ else:
+ os.remove(full_entry)
+ else:
+ # Delete whole directory.
+ shutil.rmtree(full_path)
+
part.rootfs_dir = real_rootfs_dir
part.prepare_rootfs(cr_workdir, oe_builddir, real_rootfs_dir, native_sysroot)
diff --git a/scripts/wic b/scripts/wic
index fe2c33f..f58843e 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -41,6 +41,8 @@ from distutils import spawn
scripts_path = os.path.abspath(os.path.dirname(__file__))
lib_path = scripts_path + '/lib'
sys.path.insert(0, lib_path)
+oe_lib_path = os.path.join(os.path.dirname(scripts_path), 'meta', 'lib')
+sys.path.insert(0, oe_lib_path)
bitbake_exe = spawn.find_executable('bitbake')
if bitbake_exe:
--
2.7.4
^ permalink raw reply related
* [PATCH v4 2/2] selftest/wic: Add tests for --exclude-dir option.
From: Kristian Amlie @ 2016-12-29 10:05 UTC (permalink / raw)
To: Burton, Ross; +Cc: OE-core
In-Reply-To: <1483005929-8231-1-git-send-email-kristian.amlie@mender.io>
Based partially on an earlier patch by Maciej Borzecki.
Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
---
meta/lib/oeqa/selftest/wic.py | 97 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index faac11e..9afa696 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -299,3 +299,100 @@ class Wic(oeSelfTest):
self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \
% image).status)
self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
+
+ def test_exclude_path(self):
+ """Test --exclude-path wks option."""
+
+ wks_file = 'temp.wks'
+ with open(wks_file, 'w') as wks:
+ rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal')
+ wks.write("""part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path usr
+part /usr --source rootfs --ondisk mmcblk0 --fstype=ext4 --rootfs-dir %s/usr
+part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --rootfs-dir %s/usr"""
+ % (rootfs_dir, rootfs_dir))
+ self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \
+ % wks_file).status)
+
+ os.remove(wks_file)
+ wicout = glob(self.resultdir + "%s-*direct" % 'temp')
+ self.assertEqual(1, len(wicout))
+
+ wicimg = wicout[0]
+
+ # verify partition size with wic
+ res = runCmd("parted -m %s unit b p 2>/dev/null" % wicimg)
+ self.assertEqual(0, res.status)
+
+ # parse parted output which looks like this:
+ # BYT;\n
+ # /var/tmp/wic/build/tmpfwvjjkf_-201611101222-hda.direct:200MiB:file:512:512:msdos::;\n
+ # 1:0.00MiB:200MiB:200MiB:ext4::;\n
+ partlns = res.output.splitlines()[2:]
+
+ self.assertEqual(3, len(partlns))
+
+ for part in [1, 2, 3]:
+ part_file = os.path.join(self.resultdir, "selftest_img.part%d" % part)
+ partln = partlns[part-1].split(":")
+ self.assertEqual(7, len(partln))
+ start = int(partln[1].rstrip("B")) / 512
+ length = int(partln[3].rstrip("B")) / 512
+ self.assertEqual(0, runCmd("dd if=%s of=%s skip=%d count=%d" %
+ (wicimg, part_file, start, length)).status)
+
+ # Test partition 1, should contain the normal root directories, except
+ # /usr.
+ res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part1"))
+ self.assertEqual(0, res.status)
+ files = [line.split('/')[5] for line in res.output.split('\n')]
+ self.assertIn("etc", files)
+ self.assertNotIn("usr", files)
+
+ # Partition 2, should contain common directories for /usr, not root
+ # directories.
+ res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part2"))
+ self.assertEqual(0, res.status)
+ files = [line.split('/')[5] for line in res.output.split('\n')]
+ self.assertNotIn("etc", files)
+ self.assertNotIn("usr", files)
+ self.assertIn("share", files)
+
+ # Partition 3, should contain the same as partition 2, including the bin
+ # directory, but not the files inside it.
+ res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3"))
+ self.assertEqual(0, res.status)
+ files = [line.split('/')[5] for line in res.output.split('\n')]
+ self.assertNotIn("etc", files)
+ self.assertNotIn("usr", files)
+ self.assertIn("share", files)
+ self.assertIn("bin", files)
+ res = runCmd("debugfs -R 'ls -p bin' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3"))
+ self.assertEqual(0, res.status)
+ files = [line.split('/')[5] for line in res.output.split('\n')]
+ self.assertIn(".", files)
+ self.assertIn("..", files)
+ self.assertEqual(2, len(files))
+
+ for part in [1, 2, 3]:
+ part_file = os.path.join(self.resultdir, "selftest_img.part%d" % part)
+ os.remove(part_file)
+
+ def test_exclude_path_errors(self):
+ """Test --exclude-path wks option error handling."""
+ wks_file = 'temp.wks'
+
+ rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal')
+
+ # Absolute argument.
+ with open(wks_file, 'w') as wks:
+ wks.write("part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path /usr")
+ self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal" \
+ % wks_file, ignore_status=True).status)
+ os.remove(wks_file)
+
+ # Argument pointing to parent directory.
+ with open(wks_file, 'w') as wks:
+ wks.write("part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path ././..")
+ self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal" \
+ % wks_file, ignore_status=True).status)
+ os.remove(wks_file)
--
2.7.4
^ permalink raw reply related
* Re: [PATCH v4 2/2] selftest/wic: Add tests for --exclude-dir option.
From: Kristian Amlie @ 2016-12-29 10:23 UTC (permalink / raw)
To: Burton, Ross; +Cc: OE-core
In-Reply-To: <1483005929-8231-3-git-send-email-kristian.amlie@mender.io>
Sorry, I forgot to rebase, I will repost.
--
Kristian
On 29/12/16 11:05, Kristian Amlie wrote:
> Based partially on an earlier patch by Maciej Borzecki.
>
> Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
> ---
> meta/lib/oeqa/selftest/wic.py | 97 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 97 insertions(+)
>
> diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
> index faac11e..9afa696 100644
> --- a/meta/lib/oeqa/selftest/wic.py
> +++ b/meta/lib/oeqa/selftest/wic.py
> @@ -299,3 +299,100 @@ class Wic(oeSelfTest):
> self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \
> % image).status)
> self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image)))
> +
> + def test_exclude_path(self):
> + """Test --exclude-path wks option."""
> +
> + wks_file = 'temp.wks'
> + with open(wks_file, 'w') as wks:
> + rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal')
> + wks.write("""part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path usr
> +part /usr --source rootfs --ondisk mmcblk0 --fstype=ext4 --rootfs-dir %s/usr
> +part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --rootfs-dir %s/usr"""
> + % (rootfs_dir, rootfs_dir))
> + self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \
> + % wks_file).status)
> +
> + os.remove(wks_file)
> + wicout = glob(self.resultdir + "%s-*direct" % 'temp')
> + self.assertEqual(1, len(wicout))
> +
> + wicimg = wicout[0]
> +
> + # verify partition size with wic
> + res = runCmd("parted -m %s unit b p 2>/dev/null" % wicimg)
> + self.assertEqual(0, res.status)
> +
> + # parse parted output which looks like this:
> + # BYT;\n
> + # /var/tmp/wic/build/tmpfwvjjkf_-201611101222-hda.direct:200MiB:file:512:512:msdos::;\n
> + # 1:0.00MiB:200MiB:200MiB:ext4::;\n
> + partlns = res.output.splitlines()[2:]
> +
> + self.assertEqual(3, len(partlns))
> +
> + for part in [1, 2, 3]:
> + part_file = os.path.join(self.resultdir, "selftest_img.part%d" % part)
> + partln = partlns[part-1].split(":")
> + self.assertEqual(7, len(partln))
> + start = int(partln[1].rstrip("B")) / 512
> + length = int(partln[3].rstrip("B")) / 512
> + self.assertEqual(0, runCmd("dd if=%s of=%s skip=%d count=%d" %
> + (wicimg, part_file, start, length)).status)
> +
> + # Test partition 1, should contain the normal root directories, except
> + # /usr.
> + res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part1"))
> + self.assertEqual(0, res.status)
> + files = [line.split('/')[5] for line in res.output.split('\n')]
> + self.assertIn("etc", files)
> + self.assertNotIn("usr", files)
> +
> + # Partition 2, should contain common directories for /usr, not root
> + # directories.
> + res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part2"))
> + self.assertEqual(0, res.status)
> + files = [line.split('/')[5] for line in res.output.split('\n')]
> + self.assertNotIn("etc", files)
> + self.assertNotIn("usr", files)
> + self.assertIn("share", files)
> +
> + # Partition 3, should contain the same as partition 2, including the bin
> + # directory, but not the files inside it.
> + res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3"))
> + self.assertEqual(0, res.status)
> + files = [line.split('/')[5] for line in res.output.split('\n')]
> + self.assertNotIn("etc", files)
> + self.assertNotIn("usr", files)
> + self.assertIn("share", files)
> + self.assertIn("bin", files)
> + res = runCmd("debugfs -R 'ls -p bin' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3"))
> + self.assertEqual(0, res.status)
> + files = [line.split('/')[5] for line in res.output.split('\n')]
> + self.assertIn(".", files)
> + self.assertIn("..", files)
> + self.assertEqual(2, len(files))
> +
> + for part in [1, 2, 3]:
> + part_file = os.path.join(self.resultdir, "selftest_img.part%d" % part)
> + os.remove(part_file)
> +
> + def test_exclude_path_errors(self):
> + """Test --exclude-path wks option error handling."""
> + wks_file = 'temp.wks'
> +
> + rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal')
> +
> + # Absolute argument.
> + with open(wks_file, 'w') as wks:
> + wks.write("part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path /usr")
> + self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal" \
> + % wks_file, ignore_status=True).status)
> + os.remove(wks_file)
> +
> + # Argument pointing to parent directory.
> + with open(wks_file, 'w') as wks:
> + wks.write("part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path ././..")
> + self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal" \
> + % wks_file, ignore_status=True).status)
> + os.remove(wks_file)
>
^ permalink raw reply
* Re: [PATCH v4 2/2] selftest/wic: Add tests for --exclude-dir option.
From: Kristian Amlie @ 2016-12-29 14:03 UTC (permalink / raw)
To: Burton, Ross; +Cc: OE-core
In-Reply-To: <b7a30224-1198-ac92-7f70-708196ca7814@mender.io>
Rebased patchset, otherwise identical to the last one:
* Removed e2tools recipe.
* Switched to using 'debugfs' instead of 'e2ls' in selftest.
--
Kristian
^ permalink raw reply
* [PATCH v5 1/2] wic: Add --exclude-path option to rootfs source plugin.
From: Kristian Amlie @ 2016-12-29 14:03 UTC (permalink / raw)
To: Burton, Ross; +Cc: OE-core
In-Reply-To: <1483020228-1267-1-git-send-email-kristian.amlie@mender.io>
It will omit the given path from the resulting partition, and if the
given path ends in a slash, it will only delete the content, and keep
the directory.
Since mkfs only accepts whole directories as input, we need to copy
the rootfs directory to the workdir so that we can selectively delete
files from it.
Since we want to use the copyhardlinktree() function, we need to put
the generic oe lib in the module search path.
Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
---
scripts/lib/wic/help.py | 6 +++++
scripts/lib/wic/ksparser.py | 1 +
scripts/lib/wic/partition.py | 1 +
scripts/lib/wic/plugins/source/rootfs.py | 43 +++++++++++++++++++++++++++++++-
scripts/wic | 2 ++
5 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
index daa11bf..4d48fb7 100644
--- a/scripts/lib/wic/help.py
+++ b/scripts/lib/wic/help.py
@@ -721,6 +721,12 @@ DESCRIPTION
partition table. It may be useful for
bootloaders.
+ --exclude-path: This option is specific to wic. It excludes the given
+ absolute path from the resulting image. If the path
+ ends with a slash, only the content of the directory
+ is omitted, not the directory itself. This option only
+ has an effect with the rootfs source plugin.
+
--extra-space: This option is specific to wic. It adds extra
space after the space filled by the content
of the partition. The final size can go
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 62c4902..56a12b0 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -130,6 +130,7 @@ class KickStart():
part.add_argument('mountpoint', nargs='?')
part.add_argument('--active', action='store_true')
part.add_argument('--align', type=int)
+ part.add_argument('--exclude-path', nargs='+')
part.add_argument("--extra-space", type=sizetype)
part.add_argument('--fsoptions', dest='fsopts')
part.add_argument('--fstype')
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index aa8f8a7..9c130c4 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -45,6 +45,7 @@ class Partition():
self.align = args.align
self.disk = args.disk
self.extra_space = args.extra_space
+ self.exclude_path = args.exclude_path
self.fsopts = args.fsopts
self.fstype = args.fstype
self.label = args.label
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index 425da8b..794ad69 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -26,10 +26,13 @@
#
import os
+import shutil
+
+from oe.path import copyhardlinktree
from wic import msger
from wic.pluginbase import SourcePlugin
-from wic.utils.oe.misc import get_bitbake_var
+from wic.utils.oe.misc import get_bitbake_var, exec_cmd
class RootfsPlugin(SourcePlugin):
"""
@@ -78,6 +81,44 @@ class RootfsPlugin(SourcePlugin):
real_rootfs_dir = cls.__get_rootfs_dir(rootfs_dir)
+ # Handle excluded paths.
+ if part.exclude_path is not None:
+ # We need a new rootfs directory we can delete files from. Copy to
+ # workdir.
+ new_rootfs = os.path.join(cr_workdir, "rootfs")
+
+ if os.path.lexists(new_rootfs):
+ shutil.rmtree(os.path.join(new_rootfs))
+
+ copyhardlinktree(real_rootfs_dir, new_rootfs)
+
+ real_rootfs_dir = new_rootfs
+
+ for orig_path in part.exclude_path:
+ path = orig_path
+ if os.path.isabs(path):
+ msger.error("Must be relative: --exclude-path=%s" % orig_path)
+
+ full_path = os.path.realpath(os.path.join(new_rootfs, path))
+
+ # Disallow climbing outside of parent directory using '..',
+ # because doing so could be quite disastrous (we will delete the
+ # directory).
+ if not full_path.startswith(new_rootfs):
+ msger.error("'%s' points to a path outside the rootfs" % orig_path)
+
+ if path.endswith(os.sep):
+ # Delete content only.
+ for entry in os.listdir(full_path):
+ full_entry = os.path.join(full_path, entry)
+ if os.path.isdir(full_entry) and not os.path.islink(full_entry):
+ shutil.rmtree(full_entry)
+ else:
+ os.remove(full_entry)
+ else:
+ # Delete whole directory.
+ shutil.rmtree(full_path)
+
part.rootfs_dir = real_rootfs_dir
part.prepare_rootfs(cr_workdir, oe_builddir, real_rootfs_dir, native_sysroot)
diff --git a/scripts/wic b/scripts/wic
index 1ad1666..4328ba5 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -41,6 +41,8 @@ from distutils import spawn
scripts_path = os.path.abspath(os.path.dirname(__file__))
lib_path = scripts_path + '/lib'
sys.path.insert(0, lib_path)
+oe_lib_path = os.path.join(os.path.dirname(scripts_path), 'meta', 'lib')
+sys.path.insert(0, oe_lib_path)
bitbake_exe = spawn.find_executable('bitbake')
if bitbake_exe:
--
2.7.4
^ permalink raw reply related
* [PATCH v5 2/2] selftest/wic: Add tests for --exclude-dir option.
From: Kristian Amlie @ 2016-12-29 14:03 UTC (permalink / raw)
To: Burton, Ross; +Cc: OE-core
In-Reply-To: <1483020228-1267-1-git-send-email-kristian.amlie@mender.io>
Based partially on an earlier patch by Maciej Borzecki.
Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
---
meta/lib/oeqa/selftest/wic.py | 97 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py
index 3db00a6..cfe7d30 100644
--- a/meta/lib/oeqa/selftest/wic.py
+++ b/meta/lib/oeqa/selftest/wic.py
@@ -322,6 +322,103 @@ class Wic(oeSelfTest):
self.assertEqual(0, status)
self.assertEqual(1, len(glob(self.resultdir + "%(wks)s-*.direct" % bbvars)))
+ def test_exclude_path(self):
+ """Test --exclude-path wks option."""
+
+ wks_file = 'temp.wks'
+ with open(wks_file, 'w') as wks:
+ rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal')
+ wks.write("""part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path usr
+part /usr --source rootfs --ondisk mmcblk0 --fstype=ext4 --rootfs-dir %s/usr
+part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --rootfs-dir %s/usr"""
+ % (rootfs_dir, rootfs_dir))
+ self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \
+ % wks_file).status)
+
+ os.remove(wks_file)
+ wicout = glob(self.resultdir + "%s-*direct" % 'temp')
+ self.assertEqual(1, len(wicout))
+
+ wicimg = wicout[0]
+
+ # verify partition size with wic
+ res = runCmd("parted -m %s unit b p 2>/dev/null" % wicimg)
+ self.assertEqual(0, res.status)
+
+ # parse parted output which looks like this:
+ # BYT;\n
+ # /var/tmp/wic/build/tmpfwvjjkf_-201611101222-hda.direct:200MiB:file:512:512:msdos::;\n
+ # 1:0.00MiB:200MiB:200MiB:ext4::;\n
+ partlns = res.output.splitlines()[2:]
+
+ self.assertEqual(3, len(partlns))
+
+ for part in [1, 2, 3]:
+ part_file = os.path.join(self.resultdir, "selftest_img.part%d" % part)
+ partln = partlns[part-1].split(":")
+ self.assertEqual(7, len(partln))
+ start = int(partln[1].rstrip("B")) / 512
+ length = int(partln[3].rstrip("B")) / 512
+ self.assertEqual(0, runCmd("dd if=%s of=%s skip=%d count=%d" %
+ (wicimg, part_file, start, length)).status)
+
+ # Test partition 1, should contain the normal root directories, except
+ # /usr.
+ res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part1"))
+ self.assertEqual(0, res.status)
+ files = [line.split('/')[5] for line in res.output.split('\n')]
+ self.assertIn("etc", files)
+ self.assertNotIn("usr", files)
+
+ # Partition 2, should contain common directories for /usr, not root
+ # directories.
+ res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part2"))
+ self.assertEqual(0, res.status)
+ files = [line.split('/')[5] for line in res.output.split('\n')]
+ self.assertNotIn("etc", files)
+ self.assertNotIn("usr", files)
+ self.assertIn("share", files)
+
+ # Partition 3, should contain the same as partition 2, including the bin
+ # directory, but not the files inside it.
+ res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3"))
+ self.assertEqual(0, res.status)
+ files = [line.split('/')[5] for line in res.output.split('\n')]
+ self.assertNotIn("etc", files)
+ self.assertNotIn("usr", files)
+ self.assertIn("share", files)
+ self.assertIn("bin", files)
+ res = runCmd("debugfs -R 'ls -p bin' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3"))
+ self.assertEqual(0, res.status)
+ files = [line.split('/')[5] for line in res.output.split('\n')]
+ self.assertIn(".", files)
+ self.assertIn("..", files)
+ self.assertEqual(2, len(files))
+
+ for part in [1, 2, 3]:
+ part_file = os.path.join(self.resultdir, "selftest_img.part%d" % part)
+ os.remove(part_file)
+
+ def test_exclude_path_errors(self):
+ """Test --exclude-path wks option error handling."""
+ wks_file = 'temp.wks'
+
+ rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal')
+
+ # Absolute argument.
+ with open(wks_file, 'w') as wks:
+ wks.write("part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path /usr")
+ self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal" \
+ % wks_file, ignore_status=True).status)
+ os.remove(wks_file)
+
+ # Argument pointing to parent directory.
+ with open(wks_file, 'w') as wks:
+ wks.write("part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path ././..")
+ self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal" \
+ % wks_file, ignore_status=True).status)
+ os.remove(wks_file)
+
@testcase(1496)
def test_bmap(self):
"""Test generation of .bmap file"""
--
2.7.4
^ permalink raw reply related
* [PATCH] sysroot-relativelinks: also consider links to dirs on the host
From: Christopher Larson @ 2016-12-29 18:06 UTC (permalink / raw)
To: openembedded-core; +Cc: Christopher Larson
From: Christopher Larson <chris_larson@mentor.com>
Dead symlinks, or symlinks to existing files will show up in 'files' of an
os.walk, but symlinks to existing directories show up in 'dirs', so we need to
consider both.
As one specific example, the symlink from /usr/lib/ssl/certs was left pointing
to /etc/ssl/certs rather than the relative path when the sdk was built on
hosts where the latter exists.
JIRA: SB-8374
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
---
scripts/sysroot-relativelinks.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/sysroot-relativelinks.py b/scripts/sysroot-relativelinks.py
index e44eba2..ffe2547 100755
--- a/scripts/sysroot-relativelinks.py
+++ b/scripts/sysroot-relativelinks.py
@@ -24,7 +24,7 @@ def handlelink(filep, subdir):
os.symlink(os.path.relpath(topdir+link, subdir), filep)
for subdir, dirs, files in os.walk(topdir):
- for f in files:
+ for f in dirs + files:
filep = os.path.join(subdir, f)
if os.path.islink(filep):
#print("Considering %s" % filep)
--
2.8.0
^ permalink raw reply related
* Re: [PATCH] sysroot-relativelinks: also consider links to dirs on the host
From: Christopher Larson @ 2016-12-29 18:23 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer; +Cc: Christopher Larson
In-Reply-To: <1483034769-15179-1-git-send-email-kergoth@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 803 bytes --]
On Thu, Dec 29, 2016 at 11:06 AM, Christopher Larson <kergoth@gmail.com>
wrote:
> From: Christopher Larson <chris_larson@mentor.com>
>
> Dead symlinks, or symlinks to existing files will show up in 'files' of an
> os.walk, but symlinks to existing directories show up in 'dirs', so we
> need to
> consider both.
>
> As one specific example, the symlink from /usr/lib/ssl/certs was left
> pointing
> to /etc/ssl/certs rather than the relative path when the sdk was built on
> hosts where the latter exists.
>
> JIRA: SB-8374
>
> Signed-off-by: Christopher Larson <chris_larson@mentor.com>
>
Erm, sorry about the JIRA:, remnant from our fork.
--
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
[-- Attachment #2: Type: text/html, Size: 1380 bytes --]
^ permalink raw reply
* [morty] apache2 does not build anymore
From: Piotr Lewicki @ 2016-12-30 10:09 UTC (permalink / raw)
To: openembedded-core
Hi there,
I have noticed that apache2 recipe is not building anymore because of
the wrong SRC_URI.
This is fixed by Derek Straka's patch sent to oe-devel in mail "[oe]
[meta-webserver][PATCH] apache2: always use the archive.apache.org to
ensure older releases are always available"
Whom should I contact to apply this patch to morty branch?
BR,
Piotr
^ permalink raw reply
* [morty] apache2 does not build anymore
From: Piotr Lewicki @ 2016-12-30 10:10 UTC (permalink / raw)
To: openembedded-core
Hi there,
I have noticed that apache2 recipe is not building anymore because of
the wrong SRC_URI.
This is fixed by Derek Straka's patch sent to oe-devel in mail "[oe]
[meta-webserver][PATCH] apache2: always use the archive.apache.org to
ensure older releases are always available"
Whom should I contact to apply this patch to morty branch?
BR,
Piotr
^ permalink raw reply
* [PATCH 0/1] Toaster support for Build Appliance
From: Juro Bystricky @ 2016-12-30 21:35 UTC (permalink / raw)
To: openembedded-core; +Cc: richard.purdie, jurobystricky
This patch contains several changes in order to allow to run Toaster in
the Build Appliance.
In particular, the Build Appliance now contains all (previously missing)
modules as specified in "bitbake/toaster-requirements.txt".
It was also not possible to install the modules manually, as the installation
program (pip3) was missing as well.
The Toaster web server can be now readily started by the command:
$ source toaster start webport=<IPADDR:PORT>
The attached README_VirtualBox_Toaster.txt explains the steps needed
to determine IPPARRD:PORT values based on the network adapter settings
(NAT or Bridged) for VirtualBox and the web server URL for host
web browser.
One caveat: For simplicity the Build Appliance recipe assumes pip3 is installed
on the build host.
Juro Bystricky (1):
build-appliance-image: support for Toaster
.../README_VirtualBox_Toaster.txt | 78 ++++++++++++++++++++++
.../images/build-appliance-image_15.0.0.bb | 18 ++++-
2 files changed, 93 insertions(+), 3 deletions(-)
create mode 100644 meta/recipes-core/images/build-appliance-image/README_VirtualBox_Toaster.txt
--
2.7.4
^ permalink raw reply
* [PATCH 1/1] build-appliance-image: support for Toaster
From: Juro Bystricky @ 2016-12-30 21:35 UTC (permalink / raw)
To: openembedded-core; +Cc: richard.purdie, jurobystricky
In-Reply-To: <1483133732-17872-1-git-send-email-juro.bystricky@intel.com>
Various changes needed to enable to run Toaster in the
Build Appliance:
1. Pre-install packages as specified by the file
"bitbake/toaster-requirements.txt"
2. Include pip3 in the image
3. Include tzdata in the image (needed by django)
4. Bump SRCREV to a commit with proper settings.py (ALLOWED_HOSTS)
for Django 1.8.16
5. Added README_VirtualBox_Toaster.txt to provide steps for
configuring VirtualBox network adapters (NAT or Bridged)
and steps to launch Toaster
[YOCTO#10767]
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
---
.../README_VirtualBox_Toaster.txt | 78 ++++++++++++++++++++++
.../images/build-appliance-image_15.0.0.bb | 18 ++++-
2 files changed, 93 insertions(+), 3 deletions(-)
create mode 100644 meta/recipes-core/images/build-appliance-image/README_VirtualBox_Toaster.txt
diff --git a/meta/recipes-core/images/build-appliance-image/README_VirtualBox_Toaster.txt b/meta/recipes-core/images/build-appliance-image/README_VirtualBox_Toaster.txt
new file mode 100644
index 0000000..a0aede2
--- /dev/null
+++ b/meta/recipes-core/images/build-appliance-image/README_VirtualBox_Toaster.txt
@@ -0,0 +1,78 @@
+
+Running Toaster in VirtualBox
+=============================
+
+Toaster is launched via the command in VM:
+
+ $ source toaster start webport=<IPADDR:PORT>
+
+The interaction with Toaster web server is done via a host internet
+browser.
+The particular steps depend on the actual networking being used
+by the VirtualBox.
+
+
+Bridged Network
+===============
+
+Find out your VM network IP address:
+
+ $ ifconfig
+
+IP address is listed under eth0 inet addr.
+It should be something like:
+ inet addr:192.168.1.18
+
+Launch the Toaster web server in VM:
+
+ $ source toaster start webport=192.168.1.18:8000
+
+Interact with the Toaster web server with your host browser using URL:
+
+ http://192.168.1.18:8000
+
+
+NAT Network
+===========
+Find out your VM network IP address:
+
+ $ ifconfig
+
+IP address is listed under eth0 inet addr.
+For NAT network it should be something like:
+ inet addr:10.0.2.15
+
+When using NAT network, the VM web server can be accessed using
+Port Forwarding.
+
+Using the VirtualBox GUI, navigate to:
+ Settings->Network->Adapter1
+
+You should set:
+ Attached to: NAT
+
+Select "Advanced", click on "Port Forwarding"
+
+This will open a new dialog box "Port Forwarding Rules".
+Create a new rule that looks like this:
+
+| Name | Protocol | Host IP | Host Port | Guest IP | Guest Port |
++-------+----------+---------+-----------+----------+------------+
+| Rule1 | TCP | | 8000 | | 8000 |
+------------------------------------------------------------------
+
+Now we can launch the Toaster web server in VM:
+
+ $ source toaster start webport=10.0.2.15:8000
+
+Interact with the Toaster web server with your host browser using URL:
+
+ http://127.0.0.1:8000
+
+
+
+
+
+
+
+
diff --git a/meta/recipes-core/images/build-appliance-image_15.0.0.bb b/meta/recipes-core/images/build-appliance-image_15.0.0.bb
index 5bb6555..34327e3 100644
--- a/meta/recipes-core/images/build-appliance-image_15.0.0.bb
+++ b/meta/recipes-core/images/build-appliance-image_15.0.0.bb
@@ -1,5 +1,5 @@
SUMMARY = "An image containing the build system itself"
-DESCRIPTION = "An image containing the build system that you can boot and run using either VMware Player or VMware Workstation."
+DESCRIPTION = "An image containing the build system that you can boot and run using either VirtualBox, VMware Player or VMware Workstation."
HOMEPAGE = "http://www.yoctoproject.org/documentation/build-appliance"
LICENSE = "MIT"
@@ -7,7 +7,8 @@ LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d
file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
IMAGE_INSTALL = "packagegroup-core-boot packagegroup-core-ssh-openssh packagegroup-self-hosted \
- kernel-dev kernel-devsrc connman connman-plugin-ethernet dhcp-client"
+ kernel-dev kernel-devsrc connman connman-plugin-ethernet dhcp-client \
+ tzdata python3-pip"
IMAGE_FEATURES += "x11-base package-management splash"
@@ -22,11 +23,12 @@ IMAGE_FSTYPES = "vmdk"
inherit core-image module-base
-SRCREV ?= "ee6ee913aae5ac55ccb9125e03d07d3a767e4157"
+SRCREV ?= "7c3a47ed8965c3a3eb90a9a4678d5caedbba6337"
SRC_URI = "git://git.yoctoproject.org/poky;branch=master \
file://Yocto_Build_Appliance.vmx \
file://Yocto_Build_Appliance.vmxf \
file://README_VirtualBox_Guest_Additions.txt \
+ file://README_VirtualBox_Toaster.txt \
"
BA_INCLUDE_SOURCES ??= "0"
@@ -54,6 +56,9 @@ fakeroot do_populate_poky_src () {
# Place the README_VirtualBox_Guest_Additions file in builders home folder.
cp ${WORKDIR}/README_VirtualBox_Guest_Additions.txt ${IMAGE_ROOTFS}/home/builder/
+ # Place the README_VirtualBox_Toaster file in builders home folder.
+ cp ${WORKDIR}/README_VirtualBox_Toaster.txt ${IMAGE_ROOTFS}/home/builder/
+
# Create a symlink, needed for out-of-tree kernel modules build
lnr ${IMAGE_ROOTFS}${KERNEL_SRC_PATH} ${IMAGE_ROOTFS}/lib/modules/${KERNEL_VERSION}/build
@@ -88,6 +93,13 @@ fakeroot do_populate_poky_src () {
# Use Clearlooks GTK+ theme
mkdir -p ${IMAGE_ROOTFS}/etc/gtk-2.0
echo 'gtk-theme-name = "Clearlooks"' > ${IMAGE_ROOTFS}/etc/gtk-2.0/gtkrc
+
+ # Install modules needed for toaster
+ export HOME=${IMAGE_ROOTFS}/home/builder
+ mkdir -p ${IMAGE_ROOTFS}/home/builder/.cache/pip
+ pip3 install --user -I -U -v -r ${IMAGE_ROOTFS}/home/builder/poky/bitbake/toaster-requirements.txt
+ chown -R builder.builder ${IMAGE_ROOTFS}/home/builder/.local
+ chown -R builder.builder ${IMAGE_ROOTFS}/home/builder/.cache
}
IMAGE_PREPROCESS_COMMAND += "do_populate_poky_src; "
--
2.7.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox