[Letux-kernel] LX16 boot process
H. Nikolaus Schaller
hns at goldelico.com
Thu Jan 2 14:47:14 CET 2025
Hi,
> Am 02.01.2025 um 13:08 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>
> b) the fdt command(s) are available in source code:
>
> https://git.goldelico.com/?p=letux-uboot.git;a=blob;f=common/cmd_fdt.c;h=edefd77733177f23068e775af45d9e02c6aef4e2;hb=69066a3dc7099aaf4804423e9176c63488cd33b5
>
> But they are not enabled/configured/available. This is likely the reason why we do not use this...
>
I now tried to enable the fdt command by
1) checking out https://git.goldelico.com/?p=letux-uboot.git;a=shortlog;h=refs/heads/ingenic-x1600-v2
2) modifying
diff --git a/include/configs/halley6.h b/include/configs/halley6.h
index 19c18d2e4b7..2889ac1fa38 100644
--- a/include/configs/halley6.h
+++ b/include/configs/halley6.h
@@ -372,6 +372,9 @@
#endif
#define CONFIG_CMD_MISC /* Misc functions like sleep etc*/
#define CONFIG_CMD_MMC /* MMC/SD support */
+#if 1
+#define CONFIG_OF_LIBFDT /* fdt */
+#endif
#define CONFIG_CMD_NET /* networking support */
#define CONFIG_CMD_PING
#define CONFIG_CMD_RUN /* run command in env variable */
But I get a compile error:
3) compiling
make[1]: Entering directory '/Volumes/CaseSensitive/u-boot/arch/mips/cpu'
make[1]: Nothing to be done for 'u-boot.lds'.
make[1]: Leaving directory '/Volumes/CaseSensitive/u-boot/arch/mips/cpu'
mipsel-linux-gnu-gcc -E -g -Os -ffunction-sections -fdata-sections -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0x80100000 -DCONFIG_SPL_TEXT_BASE=0x80001000 -DCONFIG_SPL_PAD_TO=26624 -I/Volumes/CaseSensitive/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /Users/hns/Documents/Projects/QuantumSTEP/System/Library/Frameworks/System.framework/Versions/x86_64-apple-darwin23/8-Jessie/mipsel/usr/bin/../lib/gcc/mipsel-linux-gnu/4.9.1/include -pipe -DCONFIG_MIPS -D__MIPS__ -G 0 -EL -msoft-float -std=gnu89 -fpic -mabicalls -march=mips32r2 -mabi=32 -DCONFIG_32BIT -mno-branch-likely -include /Volumes/CaseSensitive/u-boot/include/u-boot/u-boot.lds.h -DCPUDIR=arch/mips/cpu/xburst -ansi -D__ASSEMBLY__ -P - </Volumes/CaseSensitive/u-boot/arch/mips/cpu/u-boot.lds >u-boot.lds
cd /Volumes/CaseSensitive/u-boot && mipsel-linux-gnu-ld.bfd -G 0 -static -n -nostdlib -EL -m elf32ltsmip -T u-boot.lds --gc-sections -pie -Bstatic -Ttext 0x80100000 arch/mips/cpu/xburst/start.o --start-group api/libapi.o arch/mips/cpu/xburst/libxburst.o arch/mips/cpu/xburst/x1600/libx1600.o arch/mips/lib/libmips.o common/libcommon.o disk/libdisk.o drivers/bios_emulator/libatibiosemu.o drivers/block/libblock.o drivers/crypto/libcrypto.o drivers/dfu/libdfu.o drivers/dma/libdma.o drivers/fpga/libfpga.o drivers/gpio/libgpio.o drivers/hwmon/libhwmon.o drivers/i2c/libi2c.o drivers/input/libinput.o drivers/misc/libmisc.o drivers/mmc/libmmc.o drivers/mtd/libmtd.o drivers/mtd/nand/libnand.o drivers/mtd/onenand/libonenand.o drivers/mtd/spi/libspi_flash.o drivers/mtd/ubi/libubi.o drivers/net/libnet.o drivers/net/phy/libphy.o drivers/pci/libpci.o drivers/pcmcia/libpcmcia.o drivers/power/battery/libbattery.o drivers/power/fuel_gauge/libfuel_gauge.o drivers/power/libpower.o drivers/power/pmic/libpmic.o drivers/pwm/libpwm.o drivers/regulator/libregulator.o drivers/rtc/librtc.o drivers/serial/libserial.o drivers/sound/libsound.o drivers/spi/libspi.o drivers/tpm/libtpm.o drivers/twserial/libtws.o drivers/usb/eth/libusb_eth.o drivers/usb/gadget/libusb_gadget.o drivers/usb/host/libusb_host.o drivers/usb/musb-new/libusb_musb-new.o drivers/usb/musb/libusb_musb.o drivers/usb/phy/libusb_phy.o drivers/usb/ulpi/libusb_ulpi.o drivers/video/libvideo.o drivers/watchdog/libwatchdog.o fs/cbfs/libcbfs.o fs/cramfs/libcramfs.o fs/ext4/libext4fs.o fs/fat/libfat.o fs/fdos/libfdos.o fs/jffs2/libjffs2.o fs/libfs.o fs/reiserfs/libreiserfs.o fs/sandbox/libsandboxfs.o fs/ubifs/libubifs.o fs/yaffs2/libyaffs2.o fs/zfs/libzfs.o lib/libfdt/libfdt.o lib/libgeneric.o lib/lzma/liblzma.o lib/lzo/liblzo.o lib/rsa/librsa.o lib/zlib/libz.o net/libnet.o post/libpost.o test/libtest.o board/ingenic/halley6/libhalley6.o --end-group /Volumes/CaseSensitive/u-boot/arch/mips/lib/libgcc.o -Map u-boot.map -o u-boot
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), arch/mips/cpu/xburst/libxburst.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), arch/mips/cpu/xburst/x1600/libx1600.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), arch/mips/lib/libmips.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), common/libcommon.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), disk/libdisk.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), drivers/gpio/libgpio.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), drivers/input/libinput.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), drivers/mmc/libmmc.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), drivers/net/libnet.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), drivers/pcmcia/libpcmcia.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), drivers/rtc/librtc.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), drivers/serial/libserial.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), drivers/spi/libspi.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), fs/ext4/libext4fs.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), fs/fat/libfat.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), fs/libfs.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), lib/libfdt/libfdt.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), lib/libgeneric.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), lib/lzo/liblzo.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), lib/zlib/libz.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), net/libnet.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), board/ingenic/halley6/libhalley6.o uses -msoft-float
mipsel-linux-gnu-ld.bfd: Warning: u-boot uses -mhard-float (set by arch/mips/cpu/xburst/start.o), /Volumes/CaseSensitive/u-boot/arch/mips/lib/libgcc.o uses -msoft-float
arch/mips/lib/libmips.o: In function `boot_prep_linux':
bootm.c:(.text.boot_prep_linux+0x58): undefined reference to `image_setup_linux'
Makefile:640: recipe for target 'u-boot' failed
make: *** [u-boot] Error 1
image_setup_linux is defined as expected. So I think it is a linker error (maybe a bad order of files and libs).
But while trying to test a workaround, I recognised that we
do not even need the fdt command in u-boot. Its use is to
modify the loaded DTB by an u-boot script.
Loading is much simpler and could be like this:
setenv devicetree ingenic/lx16
setenv kernel /uImage
setenv m 0
setenv p 1
setenv bootaddr 0x80a00000 # @10 MB
setenv bootscr 0x81e00000 # @30 MB
setenv fdtaddr 0x81f00000 # @31 MB (before end of X1600 32 MB RAM)
# allow to overwrite boot args (incl. m and p)
#if fatload mmc ${m}:${p} ${bootscr} bootargs.scr # Letux kernel provides this for GTA04 only...
#then
# source ${bootscr}
#fi
fatload mmc ${m}:${p} ${fdtaddr} ${devicetree}.dtb
fatload mmc ${m}:${p} ${bootaddr} ${kernel}
bootm ${bootaddr} - ${fdtaddr}
Well, running this on the u-boot console ends up in:
## Booting kernel from Legacy Image at 80a00000 ...
Image Name: Linux-6.13.0-rc5-letux-lx16+
Image Type: MIPS Linux Kernel Image (gzip compressed)
Data Size: 5605998 Bytes = 5.3 MiB
Load Address: 80010000
Entry Point: 80938b54
Verifying Checksum ... OK
## Flattened Device Tree blob at 81f00000
Booting using the fdt blob at 0x81f00000
Uncompressing Kernel Image ... OK
Starting kernel ...
[ 0.000000] Linux version 6.13.0-rc5-letux-lx16+ (hns at iMac.local) (mipsel-linux-gnu-gcc (GCC) 6.3.0, GNU ld (GNU Binutils) 2.27) #864 PREEMPT Thu Jan 2 11:44:39 CET 2025
[ 0.000000] CPU0 revision is: 00d00000 (Ingenic XBurst)
[ 0.000000] FPU revision is: 00b70000
[ 0.000000] MIPS: machine is Letux LX16
[ 0.000000] earlycon: x1600_uart0 at MMIO 0x10032000 (options '')
[ 0.000000] printk: legacy bootconsole [x1600_uart0] enabled
[ 0.000000] printk: debug: ignoring loglevel setting.
[ 0.000000] Kernel sections are not in the memory maps
[ 0.000000] Wasting 576 bytes for tracking 16 unused pages
[ 0.000000] Kernel panic - not syncing: early_init_dt_alloc_memory_arch: Failed to allocate 19918 bytes align=0x40
[ 0.000000] Rebooting in 10 seconds..
[ 0.000000] Reboot failed -- System halted
After pressing the Reset button and letting u-boot timeout the kernel boots.
Or breaking into u-boot console and doing "run bootcmd" works.
## Booting kernel from Legacy Image at 80a00000 ...
Image Name: Linux-6.13.0-rc5-letux-lx16+
Image Type: MIPS Linux Kernel Image (gzip compressed)
Data Size: 5605998 Bytes = 5.3 MiB
Load Address: 80010000
Entry Point: 80938b54
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
Starting kernel ...
[ 0.000000] Linux version 6.13.0-rc5-letux-lx16+ (hns at iMac.local) (mipsel-linux-gnu-gcc (GCC) 6.3.0, GNU ld (GNU Binutils) 2.27) #864 PREEMPT Thu Jan 2 11:44:39 CET 2025
[ 0.000000] CPU0 revision is: 00d00000 (Ingenic XBurst)
[ 0.000000] FPU revision is: 00b70000
[ 0.000000] MIPS: machine is Letux LX16
[ 0.000000] earlycon: x1600_uart0 at MMIO 0x10032000 (options '')
[ 0.000000] printk: legacy bootconsole [x1600_uart0] enabled
[ 0.000000] printk: debug: ignoring loglevel setting.
[ 0.000000] User-defined physical RAM map overwrite
[ 0.000000] Reserved memory: created DMA memory pool at 0x02000000, size 0 MiB
[ 0.000000] OF: reserved mem: initialized node reserved_mem at 2000000, compatible id shared-dma-pool
[ 0.000000] OF: reserved mem: 0x02000000..0x0201ffff (128 KiB) map non-reusable reserved_mem at 2000000
[ 0.000000] cma: Failed to reserve 32 MiB on node -1
[ 0.000000] Primary instruction cache 16kiB, VIPT, 8-way, 64 sets, linesize 32 bytes.
[ 0.000000] Primary data cache 16kiB, VIPT, 8-way, 64 sets, linesize 32 bytes.
[ 0.000000] Unified secondary cache 128kiB, VIPT, 8-way, 512 sets, linesize 32 bytes.
So what is the difference between the above command sequence and
fatload mmc 0 0x80a00000 /uImage
bootm 0x80a00000
It appears as if a bootm with only 1 argument (i.e. no fdt) works.
So something is broken in either u-boot passing the FDT base or in
kernel - even if the uImage is compiled with appended DTB which
IMHO should ignore the FDT passed by u-boot.
Any ideas || suggestions?
BR,
Nikolaus
More information about the Letux-kernel
mailing list