On 07/12/2015 06:44 AM, Michael Neurohr wrote:
> Hi,
> 
> I'm trying to activate the Device Tree for Raspberry Pi builds.
> 
> Therefore I changed the flag
> 
> # CONFIG_BCM2709_DT is not set
> to
> CONFIG_BCM2709_DT=y
> 
> in
> 
> /home/mine/gitrepos/openwrt2/target/linux/brcm2708/bcm2709/config-default
> and
> /home/mine/gitrepos/openwrt2/target/linux/brcm2708/bcm2708/config-default
> 
> When building for BRCM2709/08 I'm getting the error
> 
> ==================================================================
>   LD      init/built-in.o
> drivers/built-in.o: In function `of_get_mac_address_mtd':
> /home/mine/gitrepos/openwrt2/build_dir/target-arm_cortex-a7+vfp_musl-1.1.10_eabi/linux-brcm2708_bcm2709/linux-3.18.17/drivers/of/of_net.c:106:
> undefined reference to `get_mtd_device_nm'
> /home/mine/gitrepos/openwrt2/build_dir/target-arm_cortex-a7+vfp_musl-1.1.10_eabi/linux-brcm2708_bcm2709/linux-3.18.17/drivers/of/of_net.c:110:
> undefined reference to `mtd_read'
> /home/mine/gitrepos/openwrt2/build_dir/target-arm_cortex-a7+vfp_musl-1.1.10_eabi/linux-brcm2708_bcm2709/linux-3.18.17/drivers/of/of_net.c:111:
> undefined reference to `put_mtd_device'
> make[5]: *** [vmlinux] Error 1
> make[5]: Leaving directory
> `/home/mine/gitrepos/openwrt2/build_dir/target-arm_cortex-a7+vfp_musl-1.1.10_eabi/linux-brcm2708_bcm2709/linux-3.18.17'
> 
> make[4]: ***
> [/home/mine/gitrepos/openwrt2/build_dir/target-arm_cortex-a7+vfp_musl-1.1.10_eabi/linux-brcm2708_bcm2709/linux-3.18.17/.image]
> Error 2
> make[4]: Leaving directory
> `/home/mine/gitrepos/openwrt2/target/linux/brcm2708'
> make[3]: *** [install] Error 2
> make[3]: Leaving directory `/home/mine/gitrepos/openwrt2/target/linux'
> make[2]: *** [target/linux/install] Error 2
> make[2]: Leaving directory `/home/mine/gitrepos/openwrt2'
> make[1]: ***
> [/home/mine/gitrepos/openwrt2/staging_dir/target-arm_cortex-a7+vfp_musl-1.1.10_eabi/stamp/.target_install]
> Error 2
> make[1]: Leaving directory `/home/mine/gitrepos/openwrt2'
> make: *** [world] Error 2
> ==================================================================
> 
> 
> Is it possible at all to activate the Device Tree for Raspberry builds
> at all?
> 
> I'm working on the master of git://openwrt.org/openwrt.git
> 
> Thanks,
> Michael

Somehow CONFIG_MTD is not activate in your config, please try the
attached patch t make OpenWrt still build in such cases.

Hauke

>From f98ce9c7abf1e13443d129aba0e01fe63265445f Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <ha...@hauke-m.de>
Date: Sun, 12 Jul 2015 13:39:30 +0200
Subject: [PATCH 2/2] kernel: fix build with CONFIG_MTD unset

of_get_mac_address_mtd() accesses functions behind CONFIG_MTD without
checking if it is available, deactivate this function if
of_get_mac_address_mtd is not available.

Signed-off-by: Hauke Mehrtens <ha...@hauke-m.de>
---
 .../patches-3.18/681-NET-add-of_get_mac_address_mtd.patch   | 13 +++++++++++--
 .../patches-4.0/681-NET-add-of_get_mac_address_mtd.patch    | 13 +++++++++++--
 .../patches-4.1/681-NET-add-of_get_mac_address_mtd.patch    | 13 +++++++++++--
 3 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/target/linux/generic/patches-3.18/681-NET-add-of_get_mac_address_mtd.patch b/target/linux/generic/patches-3.18/681-NET-add-of_get_mac_address_mtd.patch
index 8ce17fe..2603f11 100644
--- a/target/linux/generic/patches-3.18/681-NET-add-of_get_mac_address_mtd.patch
+++ b/target/linux/generic/patches-3.18/681-NET-add-of_get_mac_address_mtd.patch
@@ -23,11 +23,12 @@ Signed-off-by: John Crispin <blo...@openwrt.org>
  
  /**
   * of_get_phy_mode - Get phy mode for given device_node
-@@ -75,3 +76,43 @@ const void *of_get_mac_address(struct de
+@@ -75,3 +76,45 @@ const void *of_get_mac_address(struct de
  	return NULL;
  }
  EXPORT_SYMBOL(of_get_mac_address);
 +
++#ifdef CONFIG_MTD
 +int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac)
 +{
 +	struct device_node *mtd_np = NULL;
@@ -67,13 +68,21 @@ Signed-off-by: John Crispin <blo...@openwrt.org>
 +	return ret;
 +}
 +EXPORT_SYMBOL_GPL(of_get_mac_address_mtd);
++#endif
 --- a/include/linux/of_net.h
 +++ b/include/linux/of_net.h
-@@ -11,6 +11,7 @@
+@@ -11,6 +11,14 @@
  #include <linux/of.h>
  extern int of_get_phy_mode(struct device_node *np);
  extern const void *of_get_mac_address(struct device_node *np);
++#ifdef CONFIG_MTD
 +extern int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac);
++#else
++static inline int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac)
++{
++	return -ENOENT;
++}
++endif
  #else
  static inline int of_get_phy_mode(struct device_node *np)
  {
diff --git a/target/linux/generic/patches-4.0/681-NET-add-of_get_mac_address_mtd.patch b/target/linux/generic/patches-4.0/681-NET-add-of_get_mac_address_mtd.patch
index 8ce17fe..2603f11 100644
--- a/target/linux/generic/patches-4.0/681-NET-add-of_get_mac_address_mtd.patch
+++ b/target/linux/generic/patches-4.0/681-NET-add-of_get_mac_address_mtd.patch
@@ -23,11 +23,12 @@ Signed-off-by: John Crispin <blo...@openwrt.org>
  
  /**
   * of_get_phy_mode - Get phy mode for given device_node
-@@ -75,3 +76,43 @@ const void *of_get_mac_address(struct de
+@@ -75,3 +76,45 @@ const void *of_get_mac_address(struct de
  	return NULL;
  }
  EXPORT_SYMBOL(of_get_mac_address);
 +
++#ifdef CONFIG_MTD
 +int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac)
 +{
 +	struct device_node *mtd_np = NULL;
@@ -67,13 +68,21 @@ Signed-off-by: John Crispin <blo...@openwrt.org>
 +	return ret;
 +}
 +EXPORT_SYMBOL_GPL(of_get_mac_address_mtd);
++#endif
 --- a/include/linux/of_net.h
 +++ b/include/linux/of_net.h
-@@ -11,6 +11,7 @@
+@@ -11,6 +11,14 @@
  #include <linux/of.h>
  extern int of_get_phy_mode(struct device_node *np);
  extern const void *of_get_mac_address(struct device_node *np);
++#ifdef CONFIG_MTD
 +extern int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac);
++#else
++static inline int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac)
++{
++	return -ENOENT;
++}
++endif
  #else
  static inline int of_get_phy_mode(struct device_node *np)
  {
diff --git a/target/linux/generic/patches-4.1/681-NET-add-of_get_mac_address_mtd.patch b/target/linux/generic/patches-4.1/681-NET-add-of_get_mac_address_mtd.patch
index 6542898..ecbe75c 100644
--- a/target/linux/generic/patches-4.1/681-NET-add-of_get_mac_address_mtd.patch
+++ b/target/linux/generic/patches-4.1/681-NET-add-of_get_mac_address_mtd.patch
@@ -23,11 +23,12 @@ Signed-off-by: John Crispin <blo...@openwrt.org>
  
  /**
   * of_get_phy_mode - Get phy mode for given device_node
-@@ -80,3 +81,43 @@ const void *of_get_mac_address(struct de
+@@ -80,3 +81,45 @@ const void *of_get_mac_address(struct de
  	return of_get_mac_addr(np, "address");
  }
  EXPORT_SYMBOL(of_get_mac_address);
 +
++#ifdef CONFIG_MTD
 +int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac)
 +{
 +	struct device_node *mtd_np = NULL;
@@ -67,13 +68,21 @@ Signed-off-by: John Crispin <blo...@openwrt.org>
 +	return ret;
 +}
 +EXPORT_SYMBOL_GPL(of_get_mac_address_mtd);
++#endif
 --- a/include/linux/of_net.h
 +++ b/include/linux/of_net.h
-@@ -13,6 +13,7 @@
+@@ -13,6 +13,14 @@
  struct net_device;
  extern int of_get_phy_mode(struct device_node *np);
  extern const void *of_get_mac_address(struct device_node *np);
++#ifdef CONFIG_MTD
 +extern int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac);
++#else
++static inline int of_get_mac_address_mtd(struct device_node *np, unsigned char *mac)
++{
++	return -ENOENT;
++}
++endif
  extern struct net_device *of_find_net_device_by_node(struct device_node *np);
  #else
  static inline int of_get_phy_mode(struct device_node *np)
-- 
2.1.4

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to