From: Yang, Wenyou Date: Thu, 3 Aug 2017 08:45:42 +0800 Subject: [U-Boot] [PATCH] misc: Makefile: Add condition on build i2c_eeprom In-Reply-To: <20170802153130.GN16135@bill-the-cat> References: <20170802074758.2757-1-wenyou.yang@microchip.com> <20170802153130.GN16135@bill-the-cat> Message-ID: <7eb7a06c-acce-b9fe-c76f-a8d09ea35375@Microchip.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Tom, On 2017/8/2 23:31, Tom Rini wrote: > On Wed, Aug 02, 2017 at 03:47:58PM +0800, Wenyou Yang wrote: > >> The i2c_eeprom isn't always necessary when building for SPL, >> add the condition on build i2c_eeprom. >> >> Signed-off-by: Wenyou Yang >> --- >> >> drivers/misc/Makefile | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile >> index 10265c8fb4..ccc84c38fc 100644 >> --- a/drivers/misc/Makefile >> +++ b/drivers/misc/Makefile >> @@ -20,7 +20,13 @@ obj-$(CONFIG_CROS_EC_SPI) += cros_ec_spi.o >> endif >> obj-$(CONFIG_FSL_IIM) += fsl_iim.o >> obj-$(CONFIG_LED_STATUS_GPIO) += gpio_led.o >> +ifdef CONFIG_SPL_BUILD >> +ifneq ($(CONFIG_SPL_I2C_SUPPORT),) >> +obj-$(CONFIG_I2C_EEPROM) += i2c_eeprom.o >> +endif >> +else >> obj-$(CONFIG_I2C_EEPROM) += i2c_eeprom.o >> +endif >> obj-$(CONFIG_FSL_MC9SDZ60) += mc9sdz60.o >> obj-$(CONFIG_MXC_OCOTP) += mxc_ocotp.o >> obj-$(CONFIG_MXS_OCOTP) += mxs_ocotp.o > What's wrong with building this when not required? Build failure? If > so, we should add SPL_I2C_EEPROM and then the above becomes > obj-$(CONFIG_$(SPL_)I2C_EEPROM) += i2c_eeprom.o > or so. Thanks! Yes, build failure. if CONFIG_SPL_I2C_SUPPORT isn't enabled, it failed to build u-boot-spl with the following error. ---8<--- drivers/built-in.o: In function `i2c_eeprom_std_read': /home/wyang/work/linux4sam/u-boot-at91/drivers/misc/i2c_eeprom.c:36: undefined reference to `dm_i2c_read' scripts/Makefile.spl:333: recipe for target 'spl/u-boot-spl' failed --->8--- Add SPL_I2C_EEPROM is a good idea, I will send a patch. Thank you. Best Regards, Wenyou Yang