All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host
@ 2018-06-01 16:46 Vicente Bergas
  2018-06-01 16:46 ` [U-Boot] [PATCH 1/4] add make_fit_atf in tools Vicente Bergas
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Vicente Bergas @ 2018-06-01 16:46 UTC (permalink / raw)
  To: u-boot

From: Vicente Bergas <vicencb@gmail.com>

This patch series remove the dependency on python and dtc from the host
for the Sapphire board.

It does not conform to the U-Boot coding style. It has been posted here for
informational purposes only. If there is interest in merging it, feel free
to modify it at will, it is in the public domain.

Vicente Bergas (4):
  [U-Boot] add make_fit_atf in tools
  [U-Boot] rockchip: rk3399: use make_fit_atf instead of make_fit_atf.py
  [U-Boot] rockchip: rk3399: disable CONFIG_SPL_OF_PLATDATA
  [U-Boot] rockchip: rk3399: set CONFIG_MKIMAGE_DTC_PATH

 configs/evb-rk3399_defconfig |   4 +-
 tools/Makefile               |   2 +
 tools/make_fit_atf.c         | 360 +++++++++++++++++++++++++++++++++++
 3 files changed, 364 insertions(+), 2 deletions(-)
 create mode 100644 tools/make_fit_atf.c

-- 
2.17.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 1/4]  add make_fit_atf in tools
  2018-06-01 16:46 [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host Vicente Bergas
@ 2018-06-01 16:46 ` Vicente Bergas
  2018-06-01 16:46 ` [U-Boot] [PATCH 2/4] rockchip: rk3399: use make_fit_atf instead of make_fit_atf.py Vicente Bergas
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Vicente Bergas @ 2018-06-01 16:46 UTC (permalink / raw)
  To: u-boot

From: Vicente Bergas <vicencb@gmail.com>

make_fit_atf generates an .its file based on U-Boot and ATF .elf files.
It also extracts all loadable sections from ATF.

It tries to somewhat mimic the behaviour of
arch/arm/mach-rockchip/make_fit_atf.py

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
---
 tools/Makefile       |   2 +
 tools/make_fit_atf.c | 360 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 362 insertions(+)
 create mode 100644 tools/make_fit_atf.c

diff --git a/tools/Makefile b/tools/Makefile
index 5dd33ed4d5..a282f04f63 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -56,6 +56,8 @@ mkenvimage-objs := mkenvimage.o os_support.o lib/crc32.o
 hostprogs-y += dumpimage mkimage
 hostprogs-$(CONFIG_FIT_SIGNATURE) += fit_info fit_check_sign
 
+hostprogs-$(CONFIG_SPL_ATF) += make_fit_atf
+
 hostprogs-$(CONFIG_CMD_BOOTEFI_SELFTEST) += file2include
 
 FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o
diff --git a/tools/make_fit_atf.c b/tools/make_fit_atf.c
new file mode 100644
index 0000000000..91101aaf8a
--- /dev/null
+++ b/tools/make_fit_atf.c
@@ -0,0 +1,360 @@
+// SPDX-License-Identifier: 0BSD
+
+#include <errno.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static char const *dtb_basename (char const *path) {
+  enum { FILE_SEPARATOR = '/' };
+  size_t ln = strlen(path);
+  if (!ln || path[ln - 1] == FILE_SEPARATOR) {
+    fprintf(stderr, "dtb file name error '%s'.\n", path);
+    return NULL;
+  }
+  char const *base = path + ln - 1;
+  while (base > path && *base != FILE_SEPARATOR) --base;
+  if (*base == FILE_SEPARATOR) ++base;
+  return base;
+}
+
+/*
+  http://www.sco.com/developers/gabi/latest/ch4.intro.html
+  http://www.sco.com/developers/gabi/latest/ch4.eheader.html
+  http://www.sco.com/developers/gabi/latest/ch4.sheader.html
+  http://www.sco.com/developers/gabi/latest/ch5.pheader.html
+*/
+enum { EI_MAG0, EI_MAG1, EI_MAG2, EI_MAG3, EI_CLASS, EI_DATA, EI_VERSION, EI_NIDENT = 16 };
+enum { ELFMAG0 = 0x7F, ELFMAG1 = 'E', ELFMAG2 = 'L', ELFMAG3 = 'F' };
+enum { ELFCLASSNONE, ELFCLASS32, ELFCLASS64 };
+enum { ELFDATANONE, ELFDATA2LSB, ELFDATA2MSB };
+enum { ET_NONE, ET_REL, ET_EXEC, ET_DYN, ET_CORE };
+enum { EM_NONE, EM_ARM = 40, EM_AARCH64 = 183 };
+enum { EV_NONE, EV_CURRENT };
+enum { PT_NULL, PT_LOAD, PT_DYNAMIC, PT_INTERP, PT_NOTE, PT_SHLIB, PT_PHDR, PT_TLS };
+enum { SHT_NULL, SHT_PROGBITS, SHT_SYMTAB, SHT_STRTAB, SHT_RELA, SHT_HASH, SHT_DYNAMIC, SHT_NOTE, SHT_NOBITS };
+enum { SHF_ALLOC = 2 };
+typedef struct {
+  uint8_t  e_ident[EI_NIDENT];
+  uint16_t e_type;
+  uint16_t e_machine;
+  uint32_t e_version;
+  uint64_t e_entry;
+  uint64_t e_phoff;
+  uint64_t e_shoff;
+  uint32_t e_flags;
+  uint16_t e_ehsize;
+  uint16_t e_phentsize;
+  uint16_t e_phnum;
+  uint16_t e_shentsize;
+  uint16_t e_shnum;
+  uint16_t e_shstrndx;
+} Elf64_Ehdr;
+typedef struct {
+  uint32_t p_type;
+  uint32_t p_flags;
+  uint64_t p_offset;
+  uint64_t p_vaddr;
+  uint64_t p_paddr;
+  uint64_t p_filesz;
+  uint64_t p_memsz;
+  uint64_t p_align;
+} Elf64_Phdr;
+typedef struct {
+  uint32_t sh_name;
+  uint32_t sh_type;
+  uint64_t sh_flags;
+  uint64_t sh_addr;
+  uint64_t sh_offset;
+  uint64_t sh_size;
+  uint32_t sh_link;
+  uint32_t sh_info;
+  uint64_t sh_addralign;
+  uint64_t sh_entsize;
+} Elf64_Shdr;
+
+static FILE *elf_open(char const *file_name, Elf64_Ehdr *eh) {
+  FILE *f = fopen(file_name, "rb");
+  if (!f) {
+    fprintf(stderr, "Error openning '%s': %s.\n", file_name, strerror(errno));
+    return 0;
+  }
+  if (fread(eh, EI_NIDENT, 1, f) != 1) {
+    if (feof(f)) {
+      fprintf(stderr, "Not ELF file.\n");
+      return 0;
+    }
+    fprintf(stderr, "Error reading '%s'.\n", file_name);
+    return 0;
+  }
+  if (
+    eh->e_ident[EI_MAG0] != ELFMAG0 ||
+    eh->e_ident[EI_MAG1] != ELFMAG1 ||
+    eh->e_ident[EI_MAG2] != ELFMAG2 ||
+    eh->e_ident[EI_MAG3] != ELFMAG3
+  ) {
+    fprintf(stderr, "Not ELF file.\n");
+    return 0;
+  }
+  if (
+    eh->e_ident[EI_CLASS]   != ELFCLASS64  ||
+    eh->e_ident[EI_DATA]    != ELFDATA2LSB ||
+    eh->e_ident[EI_VERSION] != EV_CURRENT
+  ) {
+    fprintf(stderr, "Only version %u 64-bit little-endian ELF files supported.\n", EV_CURRENT);
+    return 0;
+  }
+  if (!*(uint8_t *)&(uint32_t){1}) {
+    fprintf(stderr, "Only little-endian hosts supported.\n");
+    return 0;
+  }
+  if (fread(((void *)eh) + EI_NIDENT, sizeof(*eh) - EI_NIDENT, 1, f) != 1) {
+    fprintf(stderr, "Error reading '%s'.\n", file_name);
+    return 0;
+  }
+
+  if (
+    eh->e_version   != EV_CURRENT         ||
+    eh->e_ehsize    != sizeof(Elf64_Ehdr) ||
+    eh->e_phentsize != sizeof(Elf64_Phdr) ||
+    eh->e_shentsize != sizeof(Elf64_Shdr)
+  ) {
+    fprintf(stderr, "Unexpected ELF file.\n");
+    return 0;
+  }
+  if (eh->e_machine != EM_AARCH64) {
+    fprintf(stderr, "Only arm64 supported.\n");
+    return 0;
+  }
+  return f;
+}
+
+enum { GOTO_EH, GOTO_PH, GOTO_SH };
+static int elf_goto(char const *file_name, FILE *elf, Elf64_Ehdr const *eh, unsigned where) {
+  uint64_t seek = 0;
+  switch (where) {
+  case GOTO_EH: break;
+  case GOTO_PH: seek = eh->e_phoff; break;
+  case GOTO_SH: seek = eh->e_shoff; break;
+  }
+  if (fseek(elf, seek, SEEK_SET)) {
+    fprintf(stderr, "Error seeking '%s'.\n", file_name);
+    return -1;
+  }
+  return 0;
+}
+
+static int elf_next_ph(char const *file_name, FILE *elf, Elf64_Phdr *ph) {
+  if (fread(ph, sizeof(Elf64_Phdr), 1, elf) != 1) {
+    fprintf(stderr, "Error reading '%s'.\n", file_name);
+    return -1;
+  }
+  return 0;
+}
+
+static int elf_next_sh(char const *file_name, FILE *elf, Elf64_Shdr *sh) {
+  if (fread(sh, sizeof(Elf64_Shdr), 1, elf) != 1) {
+    fprintf(stderr, "Error reading '%s'.\n", file_name);
+    return -1;
+  }
+  return 0;
+}
+
+int main(int argc, char **argv) {
+  Elf64_Ehdr eh;
+  Elf64_Phdr ph;
+  Elf64_Shdr sh;
+  FILE      *fi;
+  FILE      *fo         = stdout;
+  char      *uboot      = "u-boot";
+  char      *bl31       = "bl31.elf";
+  void      *buffer     = 0;
+  size_t     buffer_len = 0;
+  uint64_t   addr;
+  int        cnt;
+
+  if (!argc) { return -1; }
+  --argc; ++argv;
+
+  while (argc) {
+    if (argv[0][0] != '-') { break; }
+    char opt = argv[0][1];
+    --argc; ++argv;
+    if (argv[-1][2]) {
+err_option:
+      fprintf(stderr, "Error with option '%s'.\n", argv[-1]);
+usage:
+      fprintf(stderr, "make_fit_atf [-h] [-o out_file] [-u u_boot_file] [-b bl31_file] dtb_file[s]\n");
+      return -1;
+    }
+    switch (opt) {
+    default : goto err_option;
+    case 'h': goto usage;
+    case 'u': uboot = argv[0]; break;
+    case 'b': bl31  = argv[0]; break;
+    case 'o':
+      if (fo != stdout) {
+        fprintf(stderr, "Maximum one -o option.\n");
+        return -1;
+      }
+      fo = fopen(argv[0], "w");
+      if (!fo) {
+        fprintf(stderr, "Could not open '%s' for writing: %s.\n", argv[0], strerror(errno));
+        return -1;
+      }
+    }
+    --argc; ++argv;
+  }
+
+  fi = elf_open(uboot, &eh);
+  if (!fi) { return -1; }
+  if (elf_goto(uboot, fi, &eh, GOTO_PH)) { return -1; }
+  cnt = 0;
+  for (unsigned i = 0; i < eh.e_phnum; ++i) {
+    if (elf_next_ph(uboot, fi, &ph)) { return -1; }
+    if (ph.p_type != PT_LOAD) { continue; }
+    if (ph.p_vaddr != ph.p_paddr) {
+      fprintf(stderr, "Virtual address not supported.\n");
+      return -1;
+    }
+    addr = ph.p_vaddr;
+    ++cnt;
+  }
+  if (cnt != 1) {
+    fprintf(stderr, "Only one loadable segment expected.\n");
+    return -1;
+  }
+  fclose(fi);
+
+  fprintf(fo,
+    "/dts-v1/;\n"
+    "\n"
+    "/ {\n"
+    "  description = \"Configuration to load ATF before U-Boot\";\n"
+    "  #address-cells = <1>;\n"
+    "\n"
+    "  images {\n"
+    "    uboot {\n"
+    "      description = \"U-Boot\";\n"
+    "      data = /incbin/(\"u-boot-nodtb.bin\");\n"
+    "      type = \"standalone\";\n"
+    "      os = \"U-Boot\";\n"
+    "      arch = \"arm64\";\n"
+    "      compression = \"none\";\n"
+    "      load = <0x%08lX>;\n"
+    "    };\n"
+    , addr
+  );
+
+  fi = elf_open(bl31, &eh);
+  if (!fi) { return -1; }
+  if (elf_goto(bl31, fi, &eh, GOTO_SH)) { return -1; }
+  cnt = 0;
+  int fw_entry = -1;
+  for (unsigned i = 0; i < eh.e_shnum; ++i) {
+    if (elf_next_sh(bl31, fi, &sh)) { return -1; }
+    if (sh.sh_type != SHT_PROGBITS || !(sh.sh_flags & SHF_ALLOC)) { continue; }
+    ++cnt;
+    fprintf(fo,
+      "    atf%u {\n"
+      "      description = \"ARM Trusted Firmware\";\n"
+      "      data = /incbin/(\"bl31_0x%08lX.bin\");\n"
+      "      type = \"firmware\";\n"
+      "      arch = \"arm64\";\n"
+      "      os = \"arm-trusted-firmware\";\n"
+      "      compression = \"none\";\n"
+      "      load = <0x%08lX>;\n"
+      , cnt
+      , sh.sh_addr
+      , sh.sh_addr
+    );
+    if (sh.sh_addr <= eh.e_entry && eh.e_entry < sh.sh_addr + sh.sh_size) {
+      fprintf(fo, "      entry = <0x%08lX>;\n", eh.e_entry);
+      fw_entry = cnt;
+    }
+    fprintf(fo, "    };\n");
+
+    if (1) {
+      if (buffer_len < sh.sh_size) {
+        if (buffer_len) { free(buffer); }
+        buffer_len = sh.sh_size;
+        buffer     = malloc(buffer_len);
+        if (!buffer) {
+          fprintf(stderr, "%s.\n", strerror(errno));
+          return -1;
+        }
+      }
+      long   current = ftell(fi);
+      int    sk      = fseek(fi, sh.sh_offset, SEEK_SET);
+      size_t ln      = fread(buffer, sh.sh_size, 1, fi);
+      int    sk2     = fseek(fi, current, SEEK_SET);
+      if (current < 0 || sk || ln != 1 || sk2) {
+        fprintf(stderr, "Could not read '%s': %s.\n", bl31, strerror(errno));
+        return -1;
+      }
+
+      char fname[32];
+      sprintf(fname, "bl31_0x%08lX.bin", sh.sh_addr);
+      FILE *f = fopen(fname, "wb");
+      if (f) {
+        ln = fwrite(buffer, sh.sh_size, 1, f);
+        fclose(f);
+      }
+      if (!f || ln != 1) {
+        fprintf(stderr, "Could not write to '%s': %s.\n", fname, strerror(errno));
+        return -1;
+      }
+    }
+  }
+  fclose(fi);
+
+  for (int j = 0; j < argc; ++j) {
+    fprintf(fo,
+      "    fdt%d {\n"
+      "      description = \"%s\";\n"
+      "      data = /incbin/(\"%s\");\n"
+      "      type = \"flat_dt\";\n"
+      "      compression = \"none\";\n"
+      "    };\n"
+      , j + 1
+      , dtb_basename(argv[j])
+      , argv[j]
+    );
+  }
+  fprintf(fo, "  };\n" );
+
+  if (argc) {
+    fprintf(fo,
+      "  configurations {\n"
+      "    default = \"config1\";\n"
+    );
+    for (int j = 0; j < argc; ++j) {
+      fprintf(fo,
+        "    config%d {\n"
+        "      description = \"%s\";\n"
+        , j + 1
+        , dtb_basename(argv[j])
+      );
+      if (fw_entry >= 0) {
+        fprintf(fo, "      firmware = \"atf%d\";\n", fw_entry);
+      }
+      fprintf(fo, "      loadables = \"uboot\"");
+      for (int i = 1; i <= cnt; ++i) {
+        if (i != fw_entry) {
+          fprintf(fo, ",\"atf%u\"", i);
+        }
+      }
+      fprintf(fo,
+        ";\n"
+        "      fdt = \"fdt%u\";\n"
+        "    };\n"
+        , j + 1
+      );
+    }
+    fprintf(fo, "  };\n");
+  }
+
+  fprintf(fo, "};\n");
+  return 0;
+}
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 2/4] rockchip: rk3399: use make_fit_atf instead of make_fit_atf.py
  2018-06-01 16:46 [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host Vicente Bergas
  2018-06-01 16:46 ` [U-Boot] [PATCH 1/4] add make_fit_atf in tools Vicente Bergas
@ 2018-06-01 16:46 ` Vicente Bergas
  2018-06-01 16:46 ` [U-Boot] [PATCH 3/4] rockchip: rk3399: disable CONFIG_SPL_OF_PLATDATA Vicente Bergas
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Vicente Bergas @ 2018-06-01 16:46 UTC (permalink / raw)
  To: u-boot

From: Vicente Bergas <vicencb@gmail.com>

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
---
 configs/evb-rk3399_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig
index 05ad0da336..69a4cc2239 100644
--- a/configs/evb-rk3399_defconfig
+++ b/configs/evb-rk3399_defconfig
@@ -11,7 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-evb"
 CONFIG_DEBUG_UART=y
 CONFIG_FIT=y
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/make_fit_atf.py"
+CONFIG_SPL_FIT_GENERATOR="tools/make_fit_atf"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 3/4] rockchip: rk3399: disable CONFIG_SPL_OF_PLATDATA
  2018-06-01 16:46 [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host Vicente Bergas
  2018-06-01 16:46 ` [U-Boot] [PATCH 1/4] add make_fit_atf in tools Vicente Bergas
  2018-06-01 16:46 ` [U-Boot] [PATCH 2/4] rockchip: rk3399: use make_fit_atf instead of make_fit_atf.py Vicente Bergas
@ 2018-06-01 16:46 ` Vicente Bergas
  2018-06-13  3:51   ` Kever Yang
  2018-06-01 16:46 ` [U-Boot] [PATCH 4/4] rockchip: rk3399: set CONFIG_MKIMAGE_DTC_PATH Vicente Bergas
  2018-06-13  3:57 ` [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host Kever Yang
  4 siblings, 1 reply; 10+ messages in thread
From: Vicente Bergas @ 2018-06-01 16:46 UTC (permalink / raw)
  To: u-boot

From: Vicente Bergas <vicencb@gmail.com>

It has been tested with this option disabled and it works fine.
The benefit of doing so is that this is the last dependency on python to
build U-Boot for the Sapphire board.

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
---
 configs/evb-rk3399_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig
index 69a4cc2239..3f87722866 100644
--- a/configs/evb-rk3399_defconfig
+++ b/configs/evb-rk3399_defconfig
@@ -27,7 +27,6 @@ CONFIG_CMD_USB=y
 CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
-CONFIG_SPL_OF_PLATDATA=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_REGMAP=y
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 4/4] rockchip: rk3399: set CONFIG_MKIMAGE_DTC_PATH
  2018-06-01 16:46 [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host Vicente Bergas
                   ` (2 preceding siblings ...)
  2018-06-01 16:46 ` [U-Boot] [PATCH 3/4] rockchip: rk3399: disable CONFIG_SPL_OF_PLATDATA Vicente Bergas
@ 2018-06-01 16:46 ` Vicente Bergas
  2018-06-13  3:52   ` Kever Yang
  2018-06-13  3:57 ` [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host Kever Yang
  4 siblings, 1 reply; 10+ messages in thread
From: Vicente Bergas @ 2018-06-01 16:46 UTC (permalink / raw)
  To: u-boot

From: Vicente Bergas <vicencb@gmail.com>

U-Boot has a built-in dtc. Using it removes one dependency from the host.

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
---
 configs/evb-rk3399_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig
index 3f87722866..d1540ad6d1 100644
--- a/configs/evb-rk3399_defconfig
+++ b/configs/evb-rk3399_defconfig
@@ -27,6 +27,7 @@ CONFIG_CMD_USB=y
 CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
+CONFIG_MKIMAGE_DTC_PATH="scripts/dtc/dtc"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_REGMAP=y
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 3/4] rockchip: rk3399: disable CONFIG_SPL_OF_PLATDATA
  2018-06-01 16:46 ` [U-Boot] [PATCH 3/4] rockchip: rk3399: disable CONFIG_SPL_OF_PLATDATA Vicente Bergas
@ 2018-06-13  3:51   ` Kever Yang
  0 siblings, 0 replies; 10+ messages in thread
From: Kever Yang @ 2018-06-13  3:51 UTC (permalink / raw)
  To: u-boot

Hi Vicente,


On 06/02/2018 12:46 AM, Vicente Bergas wrote:
> From: Vicente Bergas <vicencb@gmail.com>
>
> It has been tested with this option disabled and it works fine.
> The benefit of doing so is that this is the last dependency on python to
> build U-Boot for the Sapphire board.
I just not understand why remove the dependency on python is so important,
there already many modules depend on python.
The most important is I would like to enable "CONFIG_SPL_OF_PLATDATA"
instead
of remove it. Yes, it works fine without it, but I believe it works
better/faster with it.

Thanks,
- Kever
>
> Signed-off-by: Vicente Bergas <vicencb@gmail.com>
> ---
>  configs/evb-rk3399_defconfig | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig
> index 69a4cc2239..3f87722866 100644
> --- a/configs/evb-rk3399_defconfig
> +++ b/configs/evb-rk3399_defconfig
> @@ -27,7 +27,6 @@ CONFIG_CMD_USB=y
>  CONFIG_CMD_TIME=y
>  CONFIG_SPL_OF_CONTROL=y
>  CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
> -CONFIG_SPL_OF_PLATDATA=y
>  CONFIG_ENV_IS_IN_MMC=y
>  CONFIG_NET_RANDOM_ETHADDR=y
>  CONFIG_REGMAP=y

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 4/4] rockchip: rk3399: set CONFIG_MKIMAGE_DTC_PATH
  2018-06-01 16:46 ` [U-Boot] [PATCH 4/4] rockchip: rk3399: set CONFIG_MKIMAGE_DTC_PATH Vicente Bergas
@ 2018-06-13  3:52   ` Kever Yang
  0 siblings, 0 replies; 10+ messages in thread
From: Kever Yang @ 2018-06-13  3:52 UTC (permalink / raw)
  To: u-boot

Hi Vicente,


On 06/02/2018 12:46 AM, Vicente Bergas wrote:
> From: Vicente Bergas <vicencb@gmail.com>
>
> U-Boot has a built-in dtc. Using it removes one dependency from the host.
>
> Signed-off-by: Vicente Bergas <vicencb@gmail.com>

Looks good to me, thanks.
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>  configs/evb-rk3399_defconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig
> index 3f87722866..d1540ad6d1 100644
> --- a/configs/evb-rk3399_defconfig
> +++ b/configs/evb-rk3399_defconfig
> @@ -27,6 +27,7 @@ CONFIG_CMD_USB=y
>  CONFIG_CMD_TIME=y
>  CONFIG_SPL_OF_CONTROL=y
>  CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
> +CONFIG_MKIMAGE_DTC_PATH="scripts/dtc/dtc"
>  CONFIG_ENV_IS_IN_MMC=y
>  CONFIG_NET_RANDOM_ETHADDR=y
>  CONFIG_REGMAP=y

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host
  2018-06-01 16:46 [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host Vicente Bergas
                   ` (3 preceding siblings ...)
  2018-06-01 16:46 ` [U-Boot] [PATCH 4/4] rockchip: rk3399: set CONFIG_MKIMAGE_DTC_PATH Vicente Bergas
@ 2018-06-13  3:57 ` Kever Yang
  2018-06-18 20:07   ` Vicente Bergas
  4 siblings, 1 reply; 10+ messages in thread
From: Kever Yang @ 2018-06-13  3:57 UTC (permalink / raw)
  To: u-boot

Hi Vicente,

    Could you share why you don't want to use python, can convert the
script to C?

Thanks,
- Kever
On 06/02/2018 12:46 AM, Vicente Bergas wrote:
> From: Vicente Bergas <vicencb@gmail.com>
>
> This patch series remove the dependency on python and dtc from the host
> for the Sapphire board.
>
> It does not conform to the U-Boot coding style. It has been posted here for
> informational purposes only. If there is interest in merging it, feel free
> to modify it at will, it is in the public domain.
>
> Vicente Bergas (4):
>   [U-Boot] add make_fit_atf in tools
>   [U-Boot] rockchip: rk3399: use make_fit_atf instead of make_fit_atf.py
>   [U-Boot] rockchip: rk3399: disable CONFIG_SPL_OF_PLATDATA
>   [U-Boot] rockchip: rk3399: set CONFIG_MKIMAGE_DTC_PATH
>
>  configs/evb-rk3399_defconfig |   4 +-
>  tools/Makefile               |   2 +
>  tools/make_fit_atf.c         | 360 +++++++++++++++++++++++++++++++++++
>  3 files changed, 364 insertions(+), 2 deletions(-)
>  create mode 100644 tools/make_fit_atf.c
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host
  2018-06-13  3:57 ` [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host Kever Yang
@ 2018-06-18 20:07   ` Vicente Bergas
  2018-06-18 20:14     ` Dr. Philipp Tomsich
  0 siblings, 1 reply; 10+ messages in thread
From: Vicente Bergas @ 2018-06-18 20:07 UTC (permalink / raw)
  To: u-boot

On Wed, 13 Jun 2018 11:51:13 +0800, kever.yang at rock-chips.com wrote:
>(snip)
>I just not understand why remove the dependency on python is so important,
>there already many modules depend on python.

On Wed, 13 Jun 2018 11:57:48 +0800, kever.yang at rock-chips.com wrote:
>(snip)
> Could you share why you don't want to use python, can convert the
>script to C?

Hi Kever,
there are several reasons, here are the ones I can think of:
 1.- Python is a ~100MB weight dependency.
 2.- Because of (1) I don not have it installed by default.
 3.- My Linux distribution of choice defaults to python3 but
     u-boot requires 'python' to be python2.
 4.- "Shall use C language whenever possible."
     http://www.denx.de/wiki/U-Boot/DesignRequirements
 5.- It is not just a dependency on what needs to be installed
     on the host, is also a dependency on which programming
     languages u-boot's contributors need to know about.
     So, it can be considered an entry barrier.

I don not have strong feelings on this getting merged and certainly
will not get upset if it does not. It is entirely your decision.

I have submitted this patch series mostly "for your information" and
because Philipp thought that it "looks worthwhile":
On Fri, 1 Jun 2018 00:37:17 +0200, philipp.tomsich at
theobroma-systems.com wrote:
>(snip)
>> On 1 Jun 2018, at 00:28, Vicente Bergas <vicencb@gmail.com> wrote:
>(snip)
>> SPL_FIT_GENERATOR and SPL_OF_PLATDATA require python.
>> In order to remove this dependency:
>> 1.- I have written a C version for SPL_FIT_GENERATOR.
>> 2.- Disabled SPL_OF_PLATDATA, it just works.
>>
>> MKIMAGE_DTC_PATH requires dtc in the PATH.
>> In order to remove this dependency, I have changed it to use the built-in one.
>>
>> If there is interest in those changes, I can post the full patch.
>
>Please submit a patch--it certainly looks worthwhile.

Regards,
  Vicenç.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host
  2018-06-18 20:07   ` Vicente Bergas
@ 2018-06-18 20:14     ` Dr. Philipp Tomsich
  0 siblings, 0 replies; 10+ messages in thread
From: Dr. Philipp Tomsich @ 2018-06-18 20:14 UTC (permalink / raw)
  To: u-boot

Vicente,

> On 18 Jun 2018, at 22:07, Vicente Bergas <vicencb@gmail.com> wrote:
> 
> On Wed, 13 Jun 2018 11:51:13 +0800, kever.yang at rock-chips.com wrote:
>> (snip)
>> I just not understand why remove the dependency on python is so important,
>> there already many modules depend on python.
> 
> On Wed, 13 Jun 2018 11:57:48 +0800, kever.yang at rock-chips.com wrote:
>> (snip)
>> Could you share why you don't want to use python, can convert the
>> script to C?
> 
> Hi Kever,
> there are several reasons, here are the ones I can think of:
> 1.- Python is a ~100MB weight dependency.
> 2.- Because of (1) I don not have it installed by default.
> 3.- My Linux distribution of choice defaults to python3 but
>     u-boot requires 'python' to be python2.
> 4.- "Shall use C language whenever possible."
>     http://www.denx.de/wiki/U-Boot/DesignRequirements
> 5.- It is not just a dependency on what needs to be installed
>     on the host, is also a dependency on which programming
>     languages u-boot's contributors need to know about.
>     So, it can be considered an entry barrier.

Given that most of the recent FDT infrastructure (e.g. tools/dtoc) and
binman are Python, the overall opinion on Python seems to have
changed (and no-one bothered to update the Wiki).

That said: the original python-implementation (i.e. the .py tool in
the rockchip subdirectory) is a bit unfortunate as well, as any processing
of binaries to build a final bootable image should nowadays be included
in binman.

> I don not have strong feelings on this getting merged and certainly
> will not get upset if it does not. It is entirely your decision.
> 
> I have submitted this patch series mostly "for your information" and
> because Philipp thought that it "looks worthwhile”:

Just for the record: I want to have this patch in the mailing-list archive,
so it is archived and can be found by anyone working on this aspect
of our bootup in the future.

I still stand by my initial assessment that it’s worthwhile to not lose this
info and make sure it’s archived ;-)

Thanks,
Philipp.

> On Fri, 1 Jun 2018 00:37:17 +0200, philipp.tomsich at
> theobroma-systems.com wrote:
>> (snip)
>>> On 1 Jun 2018, at 00:28, Vicente Bergas <vicencb@gmail.com> wrote:
>> (snip)
>>> SPL_FIT_GENERATOR and SPL_OF_PLATDATA require python.
>>> In order to remove this dependency:
>>> 1.- I have written a C version for SPL_FIT_GENERATOR.
>>> 2.- Disabled SPL_OF_PLATDATA, it just works.
>>> 
>>> MKIMAGE_DTC_PATH requires dtc in the PATH.
>>> In order to remove this dependency, I have changed it to use the built-in one.
>>> 
>>> If there is interest in those changes, I can post the full patch.
>> 
>> Please submit a patch--it certainly looks worthwhile.
> 
> Regards,
>  Vicenç.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-06-18 20:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-01 16:46 [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host Vicente Bergas
2018-06-01 16:46 ` [U-Boot] [PATCH 1/4] add make_fit_atf in tools Vicente Bergas
2018-06-01 16:46 ` [U-Boot] [PATCH 2/4] rockchip: rk3399: use make_fit_atf instead of make_fit_atf.py Vicente Bergas
2018-06-01 16:46 ` [U-Boot] [PATCH 3/4] rockchip: rk3399: disable CONFIG_SPL_OF_PLATDATA Vicente Bergas
2018-06-13  3:51   ` Kever Yang
2018-06-01 16:46 ` [U-Boot] [PATCH 4/4] rockchip: rk3399: set CONFIG_MKIMAGE_DTC_PATH Vicente Bergas
2018-06-13  3:52   ` Kever Yang
2018-06-13  3:57 ` [U-Boot] [PATCH 0/4] rockchip: Reduce prerequisites from the host Kever Yang
2018-06-18 20:07   ` Vicente Bergas
2018-06-18 20:14     ` Dr. Philipp Tomsich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.