Re: [oe] [meta-initramfs][PATCH] kexec-tools-klibc: implement the --no-dtb option for older mips kernels

2018-12-17 Thread Andrea Adami
On Mon, Dec 17, 2018 at 5:59 PM Khem Raj  wrote:
>
> Can you rebase it on master-next please
Sure, sorry
Cheers
Andrea


> On Mon, Dec 17, 2018 at 2:35 AM Andrea Adami  wrote:
> >
> > Fix borrowed from LEDE-DEV.
> >
> > Signed-off-by: Andrea Adami 
> > ---
> >  .../140-mips_disable_devicetree_support.patch | 163 ++
> >  .../kexec/kexec-tools-klibc_git.bb|   8 +-
> >  2 files changed, 169 insertions(+), 2 deletions(-)
> >  create mode 100644 
> > meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
> >
> > diff --git 
> > a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
> >  
> > b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
> > new file mode 100644
> > index 0..b3ef3c82d
> > --- /dev/null
> > +++ 
> > b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
> > @@ -0,0 +1,163 @@
> > +From 5ea7cd78cd252ffd3a9f3fbc8dc795d6e1596084 Mon Sep 17 00:00:00 2001
> > +From: Andrea Adami 
> > +Date: Mon, 17 Dec 2018 11:25:20 +0100
> > +Subject: [PATCH] kexec-tools: fix non-device tree devices on mips
> > +
> > +Add additional argument '--no-dtb' which disables device tree
> > +search in currently loaded kernel.
> > +
> > +Taken from LEDE-DEV:
> > +https://patchwork.ozlabs.org/patch/852961/
> > +
> > +Rebased for kexec-tools 2.0.18
> > +Removed ppc change (unwanted ?)
> > +
> > +Signed-off-by: Konstantin Kuzov 
> > +Signed-off-by: Andrea Adami 
> > +---
> > + kexec/arch/mips/include/arch/options.h |  4 +-
> > + kexec/arch/mips/kexec-elf-mips.c   | 58 ++
> > + kexec/arch/mips/kexec-mips.c   |  4 ++
> > + kexec/arch/mips/kexec-mips.h   |  1 +
> > + 4 files changed, 39 insertions(+), 28 deletions(-)
> > +
> > +diff --git a/kexec/arch/mips/include/arch/options.h 
> > b/kexec/arch/mips/include/arch/options.h
> > +index 416e224..18d2811 100644
> > +--- a/kexec/arch/mips/include/arch/options.h
> >  b/kexec/arch/mips/include/arch/options.h
> > +@@ -5,6 +5,7 @@
> > + #define OPT_APPEND(OPT_ARCH_MAX+0)
> > + #define OPT_DTB   (OPT_ARCH_MAX+1)
> > + #define OPT_RAMDISK   (OPT_ARCH_MAX+2)
> > ++#define OPT_NO_DTB(OPT_ARCH_MAX+3)
> > +
> > + /* Options relevant to the architecture (excluding loader-specific ones),
> > +  * in this case none:
> > +@@ -14,7 +15,8 @@
> > +   {"command-line", 1, 0, OPT_APPEND}, \
> > +   {"append",   1, 0, OPT_APPEND}, \
> > +   {"dtb", 1, 0, OPT_DTB }, \
> > +-  {"initrd",  1, 0, OPT_RAMDISK },
> > ++  {"initrd",  1, 0, OPT_RAMDISK }, \
> > ++  {"no-dtb",  0, 0, OPT_NO_DTB },
> > +
> > +
> > + #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""
> > +diff --git a/kexec/arch/mips/kexec-elf-mips.c 
> > b/kexec/arch/mips/kexec-elf-mips.c
> > +index 849a7ba..5c0e535 100644
> > +--- a/kexec/arch/mips/kexec-elf-mips.c
> >  b/kexec/arch/mips/kexec-elf-mips.c
> > +@@ -141,35 +141,37 @@ int elf_mips_load(int argc, char **argv, const char 
> > *buf, off_t len,
> > +   else
> > +   cmdline_addr = 0;
> > +
> > +-  /* MIPS systems that have been converted to use device tree
> > +-   * passed through UHI will use commandline in the DTB and
> > +-   * the DTB passed as a separate buffer. Note that
> > +-   * CMDLINE_PREFIX is skipped here intentionally, as it is
> > +-   * used only in the legacy method */
> > +-
> > +-  if (arch_options.dtb_file) {
> > +-  dtb_buf = slurp_file(arch_options.dtb_file, _length);
> > +-  } else {
> > +-  create_flatten_tree(_buf, _length, cmdline_buf + 
> > strlen(CMDLINE_PREFIX));
> > +-  }
> > +
> > +-  if (arch_options.initrd_file) {
> > +-  initrd_buf = slurp_file(arch_options.initrd_file, 
> > _size);
> > ++  if (!arch_options.no_dtb) {
> > ++  /* MIPS systems that have been converted to use device tree
> > ++   * passed through UHI will use commandline in the DTB and
> > ++   * the DTB passed as a separate buffer. Note that
> > ++   * CMDLINE_PREFIX is skipped here intentionally, as it is
> > ++   * used only in the legacy method */
> > ++
> > ++  if (arch_options.dtb_file) {
> > ++  dtb_buf = slurp_file(arch_options.dtb_file, 
> > _length);
> > ++  } else {
> > ++  create_flatten_tree(_buf, _length, 
> > cmdline_buf + strlen(CMDLINE_PREFIX));
> > ++  }
> > +
> > +-  /* Create initrd entries in dtb - although at this time
> > +-   * they would not point to the correct location */
> > +-  dtb_set_initrd(_buf, _length, initrd_buf, 
> > initrd_buf + initrd_size);
> > ++  if (arch_options.initrd_file) {
> > ++  initrd_buf = slurp_file(arch_options.initrd_file, 
> > 

Re: [oe] [meta-initramfs][PATCH] kexec-tools-klibc: implement the --no-dtb option for older mips kernels

2018-12-17 Thread Khem Raj
Can you rebase it on master-next please
On Mon, Dec 17, 2018 at 2:35 AM Andrea Adami  wrote:
>
> Fix borrowed from LEDE-DEV.
>
> Signed-off-by: Andrea Adami 
> ---
>  .../140-mips_disable_devicetree_support.patch | 163 ++
>  .../kexec/kexec-tools-klibc_git.bb|   8 +-
>  2 files changed, 169 insertions(+), 2 deletions(-)
>  create mode 100644 
> meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
>
> diff --git 
> a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
>  
> b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
> new file mode 100644
> index 0..b3ef3c82d
> --- /dev/null
> +++ 
> b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
> @@ -0,0 +1,163 @@
> +From 5ea7cd78cd252ffd3a9f3fbc8dc795d6e1596084 Mon Sep 17 00:00:00 2001
> +From: Andrea Adami 
> +Date: Mon, 17 Dec 2018 11:25:20 +0100
> +Subject: [PATCH] kexec-tools: fix non-device tree devices on mips
> +
> +Add additional argument '--no-dtb' which disables device tree
> +search in currently loaded kernel.
> +
> +Taken from LEDE-DEV:
> +https://patchwork.ozlabs.org/patch/852961/
> +
> +Rebased for kexec-tools 2.0.18
> +Removed ppc change (unwanted ?)
> +
> +Signed-off-by: Konstantin Kuzov 
> +Signed-off-by: Andrea Adami 
> +---
> + kexec/arch/mips/include/arch/options.h |  4 +-
> + kexec/arch/mips/kexec-elf-mips.c   | 58 ++
> + kexec/arch/mips/kexec-mips.c   |  4 ++
> + kexec/arch/mips/kexec-mips.h   |  1 +
> + 4 files changed, 39 insertions(+), 28 deletions(-)
> +
> +diff --git a/kexec/arch/mips/include/arch/options.h 
> b/kexec/arch/mips/include/arch/options.h
> +index 416e224..18d2811 100644
> +--- a/kexec/arch/mips/include/arch/options.h
>  b/kexec/arch/mips/include/arch/options.h
> +@@ -5,6 +5,7 @@
> + #define OPT_APPEND(OPT_ARCH_MAX+0)
> + #define OPT_DTB   (OPT_ARCH_MAX+1)
> + #define OPT_RAMDISK   (OPT_ARCH_MAX+2)
> ++#define OPT_NO_DTB(OPT_ARCH_MAX+3)
> +
> + /* Options relevant to the architecture (excluding loader-specific ones),
> +  * in this case none:
> +@@ -14,7 +15,8 @@
> +   {"command-line", 1, 0, OPT_APPEND}, \
> +   {"append",   1, 0, OPT_APPEND}, \
> +   {"dtb", 1, 0, OPT_DTB }, \
> +-  {"initrd",  1, 0, OPT_RAMDISK },
> ++  {"initrd",  1, 0, OPT_RAMDISK }, \
> ++  {"no-dtb",  0, 0, OPT_NO_DTB },
> +
> +
> + #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""
> +diff --git a/kexec/arch/mips/kexec-elf-mips.c 
> b/kexec/arch/mips/kexec-elf-mips.c
> +index 849a7ba..5c0e535 100644
> +--- a/kexec/arch/mips/kexec-elf-mips.c
>  b/kexec/arch/mips/kexec-elf-mips.c
> +@@ -141,35 +141,37 @@ int elf_mips_load(int argc, char **argv, const char 
> *buf, off_t len,
> +   else
> +   cmdline_addr = 0;
> +
> +-  /* MIPS systems that have been converted to use device tree
> +-   * passed through UHI will use commandline in the DTB and
> +-   * the DTB passed as a separate buffer. Note that
> +-   * CMDLINE_PREFIX is skipped here intentionally, as it is
> +-   * used only in the legacy method */
> +-
> +-  if (arch_options.dtb_file) {
> +-  dtb_buf = slurp_file(arch_options.dtb_file, _length);
> +-  } else {
> +-  create_flatten_tree(_buf, _length, cmdline_buf + 
> strlen(CMDLINE_PREFIX));
> +-  }
> +
> +-  if (arch_options.initrd_file) {
> +-  initrd_buf = slurp_file(arch_options.initrd_file, 
> _size);
> ++  if (!arch_options.no_dtb) {
> ++  /* MIPS systems that have been converted to use device tree
> ++   * passed through UHI will use commandline in the DTB and
> ++   * the DTB passed as a separate buffer. Note that
> ++   * CMDLINE_PREFIX is skipped here intentionally, as it is
> ++   * used only in the legacy method */
> ++
> ++  if (arch_options.dtb_file) {
> ++  dtb_buf = slurp_file(arch_options.dtb_file, 
> _length);
> ++  } else {
> ++  create_flatten_tree(_buf, _length, 
> cmdline_buf + strlen(CMDLINE_PREFIX));
> ++  }
> +
> +-  /* Create initrd entries in dtb - although at this time
> +-   * they would not point to the correct location */
> +-  dtb_set_initrd(_buf, _length, initrd_buf, initrd_buf 
> + initrd_size);
> ++  if (arch_options.initrd_file) {
> ++  initrd_buf = slurp_file(arch_options.initrd_file, 
> _size);
> +
> +-  initrd_base = add_buffer(info, initrd_buf, initrd_size,
> +-  initrd_size, sizeof(void *),
> +-  _ALIGN_UP(kernel_addr + kernel_size + 
> dtb_length,
> +-  pagesize), 

[oe] [meta-initramfs][PATCH] kexec-tools-klibc: implement the --no-dtb option for older mips kernels

2018-12-17 Thread Andrea Adami
Fix borrowed from LEDE-DEV.

Signed-off-by: Andrea Adami 
---
 .../140-mips_disable_devicetree_support.patch | 163 ++
 .../kexec/kexec-tools-klibc_git.bb|   8 +-
 2 files changed, 169 insertions(+), 2 deletions(-)
 create mode 100644 
meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch

diff --git 
a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
 
b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
new file mode 100644
index 0..b3ef3c82d
--- /dev/null
+++ 
b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
@@ -0,0 +1,163 @@
+From 5ea7cd78cd252ffd3a9f3fbc8dc795d6e1596084 Mon Sep 17 00:00:00 2001
+From: Andrea Adami 
+Date: Mon, 17 Dec 2018 11:25:20 +0100
+Subject: [PATCH] kexec-tools: fix non-device tree devices on mips
+
+Add additional argument '--no-dtb' which disables device tree
+search in currently loaded kernel.
+
+Taken from LEDE-DEV:
+https://patchwork.ozlabs.org/patch/852961/
+
+Rebased for kexec-tools 2.0.18
+Removed ppc change (unwanted ?)
+
+Signed-off-by: Konstantin Kuzov 
+Signed-off-by: Andrea Adami 
+---
+ kexec/arch/mips/include/arch/options.h |  4 +-
+ kexec/arch/mips/kexec-elf-mips.c   | 58 ++
+ kexec/arch/mips/kexec-mips.c   |  4 ++
+ kexec/arch/mips/kexec-mips.h   |  1 +
+ 4 files changed, 39 insertions(+), 28 deletions(-)
+
+diff --git a/kexec/arch/mips/include/arch/options.h 
b/kexec/arch/mips/include/arch/options.h
+index 416e224..18d2811 100644
+--- a/kexec/arch/mips/include/arch/options.h
 b/kexec/arch/mips/include/arch/options.h
+@@ -5,6 +5,7 @@
+ #define OPT_APPEND(OPT_ARCH_MAX+0)
+ #define OPT_DTB   (OPT_ARCH_MAX+1)
+ #define OPT_RAMDISK   (OPT_ARCH_MAX+2)
++#define OPT_NO_DTB(OPT_ARCH_MAX+3)
+ 
+ /* Options relevant to the architecture (excluding loader-specific ones),
+  * in this case none:
+@@ -14,7 +15,8 @@
+   {"command-line", 1, 0, OPT_APPEND}, \
+   {"append",   1, 0, OPT_APPEND}, \
+   {"dtb", 1, 0, OPT_DTB }, \
+-  {"initrd",  1, 0, OPT_RAMDISK },
++  {"initrd",  1, 0, OPT_RAMDISK }, \
++  {"no-dtb",  0, 0, OPT_NO_DTB },
+ 
+ 
+ #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""
+diff --git a/kexec/arch/mips/kexec-elf-mips.c 
b/kexec/arch/mips/kexec-elf-mips.c
+index 849a7ba..5c0e535 100644
+--- a/kexec/arch/mips/kexec-elf-mips.c
 b/kexec/arch/mips/kexec-elf-mips.c
+@@ -141,35 +141,37 @@ int elf_mips_load(int argc, char **argv, const char 
*buf, off_t len,
+   else
+   cmdline_addr = 0;
+ 
+-  /* MIPS systems that have been converted to use device tree
+-   * passed through UHI will use commandline in the DTB and
+-   * the DTB passed as a separate buffer. Note that
+-   * CMDLINE_PREFIX is skipped here intentionally, as it is
+-   * used only in the legacy method */
+-
+-  if (arch_options.dtb_file) {
+-  dtb_buf = slurp_file(arch_options.dtb_file, _length);
+-  } else {
+-  create_flatten_tree(_buf, _length, cmdline_buf + 
strlen(CMDLINE_PREFIX));
+-  }
+ 
+-  if (arch_options.initrd_file) {
+-  initrd_buf = slurp_file(arch_options.initrd_file, _size);
++  if (!arch_options.no_dtb) {
++  /* MIPS systems that have been converted to use device tree
++   * passed through UHI will use commandline in the DTB and
++   * the DTB passed as a separate buffer. Note that
++   * CMDLINE_PREFIX is skipped here intentionally, as it is
++   * used only in the legacy method */
++
++  if (arch_options.dtb_file) {
++  dtb_buf = slurp_file(arch_options.dtb_file, 
_length);
++  } else {
++  create_flatten_tree(_buf, _length, cmdline_buf 
+ strlen(CMDLINE_PREFIX));
++  }
+ 
+-  /* Create initrd entries in dtb - although at this time
+-   * they would not point to the correct location */
+-  dtb_set_initrd(_buf, _length, initrd_buf, initrd_buf + 
initrd_size);
++  if (arch_options.initrd_file) {
++  initrd_buf = slurp_file(arch_options.initrd_file, 
_size);
+ 
+-  initrd_base = add_buffer(info, initrd_buf, initrd_size,
+-  initrd_size, sizeof(void *),
+-  _ALIGN_UP(kernel_addr + kernel_size + 
dtb_length,
+-  pagesize), 0x0fff, 1);
++  /* Create initrd entries in dtb - although at this time
++   * they would not point to the correct location */
++  dtb_set_initrd(_buf, _length, initrd_buf, 
initrd_buf + initrd_size);
+ 
+-  /* Now that the buffer for initrd is