[PATCH] xyz-modem: Select CRC16

Daniel Palmer daniel at thingy.jp
Sun Jun 7 04:56:50 CEST 2026


CONFIG_LOADB causes the xyzModem code to get built and that code depends
on CONFIG_CRC16. If you don't have something else that selects CONFIG_CRC16
you can unselect it and then the final link will fail:

  LD      u-boot
/usr/bin/m68k-linux-gnu-ld.bfd: common/xyzModem.o: in function `xyzModem_get_hdr':
u-boot/common/xyzModem.c:388:(.text.xyzModem_get_hdr+0x17a): undefined reference to `crc16_ccitt'

Since SPL/TPL can also use the xyzModem code create a Kconfig symbol for
it, select CONFIG_CRC16 there and then select the new symbol from all of
the users.

Signed-off-by: Daniel Palmer <daniel at thingy.jp>
---
 cmd/Kconfig            | 1 +
 common/Kconfig         | 6 ++++++
 common/Makefile        | 3 +--
 common/spl/Kconfig     | 1 +
 common/spl/Kconfig.tpl | 1 +
 5 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index c71c6824a196..7e6044bad952 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1412,6 +1412,7 @@ config CMD_W1
 config CMD_LOADB
 	bool "loadb"
 	default y
+	select YMODEM
 	help
 	  Load a binary file over serial line.
 
diff --git a/common/Kconfig b/common/Kconfig
index 8e8c733aa295..5eafe05047dc 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -1274,3 +1274,9 @@ config IO_TRACE
 	  confirm that the driver behaves the same way before and after a code
 	  change. To add support for your architecture, add '#include
 	  <iotrace.h>' to the bottom of arch/<arch>/include/asm/io.h and test.
+
+config YMODEM
+	bool
+	select CRC16
+	help
+	  Enable xyzModem library code
diff --git a/common/Makefile b/common/Makefile
index d62ea34599ed..bd809e2f34e9 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -99,8 +99,7 @@ obj-$(CONFIG_$(PHASE_)LOG) += log.o
 obj-$(CONFIG_$(PHASE_)LOG_CONSOLE) += log_console.o
 obj-$(CONFIG_$(PHASE_)LOG_SYSLOG) += log_syslog.o
 obj-y += s_record.o
-obj-$(CONFIG_CMD_LOADB) += xyzModem.o
-obj-$(CONFIG_$(PHASE_)YMODEM_SUPPORT) += xyzModem.o
+obj-$(CONFIG_YMODEM) += xyzModem.o
 
 obj-$(CONFIG_$(PHASE_)AVB_VERIFY) += avb_verify.o
 obj-$(CONFIG_$(PHASE_)STACKPROTECTOR) += stackprot.o
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 5fa94098e498..2bd413cbdf12 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -1655,6 +1655,7 @@ config SPL_WATCHDOG
 config SPL_YMODEM_SUPPORT
 	bool "Support loading using Ymodem"
 	depends on SPL_SERIAL
+	select YMODEM
 	help
 	  While loading from serial is slow it can be a useful backup when
 	  there is no other option. The Ymodem protocol provides a reliable
diff --git a/common/spl/Kconfig.tpl b/common/spl/Kconfig.tpl
index a535b61ecd35..7ab4666d3705 100644
--- a/common/spl/Kconfig.tpl
+++ b/common/spl/Kconfig.tpl
@@ -336,6 +336,7 @@ config TPL_DM_SPI_FLASH
 config TPL_YMODEM_SUPPORT
 	bool "Support loading using Ymodem"
 	depends on TPL_SERIAL
+	select YMODEM
 	help
 	  While loading from serial is slow it can be a useful backup when
 	  there is no other option. The Ymodem protocol provides a reliable
-- 
2.53.0



More information about the U-Boot mailing list