From: Robert P. J. Day Date: Wed, 18 May 2016 13:53:39 -0400 (EDT) Subject: [U-Boot] where is the best place to set the fdt's MAC address? Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de on current board, the MAC address to be used is stored in a well-known address in flash, so it's no big deal to read those six bytes, then set that property in the DTB before handing it off to the kernel. i'm wondering, though, where the "best" place is to do that. first, in "common/image-fdt.c", i see this routine, which gives me a few options: int image_setup_libfdt(bootm_headers_t *images, void *blob, int of_size, struct lmb *lmb) { ulong *initrd_start = &images->initrd_start; ulong *initrd_end = &images->initrd_end; int ret = -EPERM; int fdt_ret; if (fdt_root(blob) < 0) { printf("ERROR: root node setup failed\n"); goto err; } if (fdt_chosen(blob) < 0) { printf("ERROR: /chosen node create failed\n"); goto err; } if (arch_fixup_fdt(blob) < 0) { printf("ERROR: arch-specific fdt fixup failed\n"); goto err; } if (IMAGE_OF_BOARD_SETUP) { fdt_ret = ft_board_setup(blob, gd->bd); if (fdt_ret) { printf("ERROR: board-specific fdt fixup failed: %s\n", fdt_strerror(fdt_ret)); goto err; } } if (IMAGE_OF_SYSTEM_SETUP) { fdt_ret = ft_system_setup(blob, gd->bd); if (fdt_ret) { printf("ERROR: system-specific fdt fixup failed: %s\n", fdt_strerror(fdt_ret)); goto err; } } fdt_fixup_ethernet(blob); ... snip ... now, since this is a board-specific setting, i'm just guessing i'd define CONFIG_OF_BOARD_SETUP, then define ft_board_setup() and put it in there -- the code looks pretty straightforward. but then i looked a bit further down and saw the call to fdt_fixup_ethernet() and thought, hmmmmmm, is *that* where i want to do it? i'm pretty sure i can whip together the code that grabs the MAC address and sets the corresponding property in the DTB, i'm just curious as to *where* that should be done. thanks muchly. rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ========================================================================