Post Go back to editing

uboot loaded but doesn't boot

I have a custom board with a SC589 and I've modified the ezkit uboot code and the board boots up fine and I can run through the entire "loading Uboot for the first time" process without a hitch.  It detects my serial flash, dhcp works like a charm.  and  I can execute the update command in uboot and it all seems to go ok but when I power cycle the board I see nothing on the serial terminal.  Environment variables persist across debug sessions.

I'm at a loss as to what could be causing this.

  • I got past the above error by using saveenv command after executing "run update" rather then the save command.  On power-up it happily starts uboot with network and sdcard support.  Now I have a new problem, when it tries to load my kernal image it says "Bad Linux ARM zImage magic!".  I simply followed the instructions for building adsp-sc5xx-minimal and starting it from an sd card so I'm lost now on how this happened and how to fix it.  Help would be appreciated, I'm so close to having it running.

  • Hi Andnan,

    Please provide the below details to assist you better.

    Output of printenv and bootcmd.
    bootargs in case if you stop at u-boot and give custom command.
    Full log of u-boot.

    Hope you are following the below document to build and boot the board
    wiki.analog.com/.../linuxdsp

    Thanks
    Vignesh R

  • I can provide the details but due to the lag in my post and any response I continued trying to get it working a changed directions.

    I am following the document to build the board but I am porting to a custom board.  I followed the yocto recommendation and created a new layer then used devtool to do my mods and successfully got u-boot running with network, serial flash and sd card support.  DHCP and TFTP worked like a champ to get my u-boot port done.

    NOTE:  There is a flaw in the  recipe for u-boot-adi

    do_compile_prepend()
    {
        #Use U-boot's FDT header files, not Linux's (in case they are different)
        cp ${WORKDIR}/git/include/libfdt_env.h ${WORKDIR}/recipe-sysroot-native/usr/include/libfdt_env.h cp
        ${WORKDIR}/git/include/libfdt.h ${WORKDIR}/recipe-sysroot-native/usr/include/libfdt.h
        #Add arm-poky-linux-gnueabi-ldr in to path
        export PATH=$PATH:${WORKDIR}
    }

    The issue is with the assumption that the file will be relative to the ${WORKDIR} folder.  My recient experience is that the code gets moved into your workspace directory during the devtool modification process and the code can't be found.  I needed to change it to use a hard link to the code folder and then it worked.  I'm no yocto expert but this should be changed so it does not rely on the ${WORKDIR} folder.  BTW, how are you updating the files without using devtool?  If you do my hack fix,  remember to change it back when you update your recipe with your changes. 

    Now I'm trying to do the same thing with the linux-adi recipe and I'm having trouble.  I did a clean install of the yocto source using the documentation and successfully built the linux-adi recipe.  At this point I should be able to run

    $/devtool modify linux-adi 

    and have a copy of the source in my workspace directory to make my changes but it throws an error.

    andrew@KernelDev:~/yocto/build$ devtool modify linux-adi
    NOTE: Starting bitbake server...
    NOTE: Creating workspace layer in /home/andrew/yocto/build/workspace
    Parsing recipes: 100% |##########################################| Time: 0:01:01
    Parsing of 2119 .bb files complete (0 cached, 2119 parsed). 3071 targets, 118 skipped, 0 masked, 0 errors.
    NOTE: Resolving any missing task queue dependencies

    Build Configuration:
    BB_VERSION = "1.40.0"
    BUILD_SYS = "x86_64-linux"
    NATIVELSBSTRING = "universal"
    TARGET_SYS = "arm-poky-linux-gnueabi"
    MACHINE = "adsp-sc589-ezkit"
    DISTRO = "poky"
    DISTRO_VERSION = "2.6.2"
    TUNE_FEATURES = "arm armv7a vfp thumb neon callconvention-hard"
    TARGET_FPU = "hard"
    meta
    meta-poky
    meta-yocto-bsp = "HEAD:50f33d3bfebcbfb1538d932fb487cfd789872026"
    meta-adi-adsp-sc5xx
    meta-adi-external-toolchain = "HEAD:ad2203c11723b07727589a8eebe33f3129cc236a"
    meta-oe
    meta-python
    meta-networking = "HEAD:4cd3a39f22a2712bfa8fc657d09fe2c7765a4005"
    workspace = "<unknown>:<unknown>"

    Initialising tasks: 100% |#######################################| Time: 0:00:00
    Sstate summary: Wanted 0 Found 0 Missed 0 Current 46 (0% match, 100% complete)
    NOTE: Executing SetScene Tasks
    NOTE: Executing RunQueue Tasks
    ERROR: Could not generate configuration queue for adsp-sc589-ezkit.
    ERROR: Function failed: do_kernel_metadata (log file is located at /home/andrew/yocto/build/tmp/work/adsp_sc589_ezkit-poky-linux-gnueabi/linux-adi/4.19-r0/devtooltmp-5owtpxq6/temp/log.do_kernel_metadata.20833)
    ERROR: Logfile of failure stored in: /home/andrew/yocto/build/tmp/work/adsp_sc589_ezkit-poky-linux-gnueabi/linux-adi/4.19-r0/devtooltmp-5owtpxq6/temp/log.do_kernel_metadata.20833
    Log data follows:
    | DEBUG: Executing python function extend_recipe_sysroot
    | NOTE: Direct dependencies are ['/home/andrew/yocto/sources/poky/meta/recipes-kernel/kern-tools/kern-tools-native_git.bb:do_populate_sysroot']
    | NOTE: Installed into sysroot: []
    | NOTE: Skipping as already exists in sysroot: ['kern-tools-native', 'quilt-native']
    | DEBUG: Python function extend_recipe_sysroot finished
    | DEBUG: Executing shell function do_kernel_metadata
    | ERROR. input file "feature/cfg/nfs.cfg" does not exist
    | ERROR: could not process input files: /home/andrew/yocto/build/tmp/work/adsp_sc589_ezkit-poky-linux-gnueabi/linux-adi/4.19-r0/devtooltmp-5owtpxq6/workdir/defconfig feature/cfg/nfs.cfg feature/cfg/wireless.cfg feature/cfg/cpufreq.cfg feature/cfg/crypto.cfg feature/snd_ezkit.scc
    | See /tmp/tmp.gJWoBziYhu for details
    | ERROR: Could not generate configuration queue for adsp-sc589-ezkit.
    | WARNING: exit code 1 from a shell command.
    | ERROR: Function failed: do_kernel_metadata (log file is located at /home/andrew/yocto/build/tmp/work/adsp_sc589_ezkit-poky-linux-gnueabi/linux-adi/4.19-r0/devtooltmp-5owtpxq6/temp/log.do_kernel_metadata.20833)
    NOTE: Tasks Summary: Attempted 348 tasks of which 342 didn't need to be rerun and 1 failed.
    ERROR: Extracting source for linux-adi failed
    andrew@KernelDev:~/yocto/build$

    What am I doing wrong?

  • Here is my u-boot session log including my environment variables


    U-Boot 2015.01 ADI-YOCTO-1.0.0 (Sep 01 2021 - 19:01:09)

    CPU: ADSP ADSP-SC589-0.1 (Detected Rev: 1.1) (spi flash boot)
    VCO: 900 MHz, Cclk0: 450 MHz, Sclk0: 112.500 MHz, Sclk1: 112.500 MHz, DCLK: 450 MHz
    OCLK: 225 MHz
    Watchdog enabled
    I2C: ready
    DRAM: 224 MiB
    MMC: SC5XX SDH: 0
    SF: Detected W25Q128JV with page size 256 Bytes, erase size 4 KiB, total 16 MiB
    In: serial
    Out: serial
    Err: serial
    other init
    Net: dwmac.3100c000
    Hit any key to stop autoboot: 0
    Nautel # printenv
    addip=set bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:eth0:off
    autoload=no
    baudrate=115200
    bootargs=root=/dev/mtdblock2 rw rootfstype=jffs2 clkin_hz=(50000000) earlyprintk=serial,uart0,57600 console=ttySC0,115200 mem=224M
    bootcmd=run sdcardboot
    bootdelay=5
    dnsip=192.168.2.1
    dtbaddr=0xC4000000
    dtbfile=sc589-ezkit.dtb
    ethact=dwmac.3100c000
    ethaddr=02:80:ad:20:31:e8
    fileaddr=c2000000
    filesize=522a8
    gatewayip=192.168.2.1
    hostname="sc58x"
    initramaddr=0xC5000000
    initramfile=ramdisk.cpio.xz.u-boot
    ipaddr=192.168.2.63
    loadaddr=0xC2000000
    loads_echo=1
    nc=set ncip ${serverip};set stdin nc;set stdout nc;set stderr nc
    netmask=255.255.255.0
    nfsargs=set bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath},tcp,nfsvers=3 clkin_hz=(50000000) earlyprintk=serial,uart0,57600 console=ttySC0,115200 mem=224M
    nfsboot=tftp ${loadaddr} ${nfsfile};tftp ${dtbaddr} ${dtbfile};run nfsargs;run addip;bootz ${loadaddr} - ${dtbaddr}
    nfsfile=zImage
    norboot=tftp ${loadaddr} ${ramfile};tftp ${dtbaddr} ${dtbfile};run ramargs;run addip;bootz ${loadaddr} - ${dtbaddr}
    ramargs=set bootargs root=/dev/mtdblock2 rw rootfstype=jffs2 clkin_hz=(50000000) earlyprintk=serial,uart0,57600 console=ttySC0,115200 mem=224M
    ramboot=tftp ${loadaddr} ${ramfile};tftp ${dtbaddr} ${dtbfile};tftp ${initramaddr} ${initramfile};run ramargs;run addip;bootz ${loadaddr} ${initramaddr} ${dtbaddr}
    ramboot_emmc=mmc rescan;mmc dev 0 0;ext2load mmc 0:1 ${loadaddr} /boot/${ramfile};ext2load mmc 0:1 ${dtbaddr} /boot/${dtbfile};ext2load mmc 0:1 ${initramaddr} /boot/${initramfile};run sdcardargs;run addip;bootz ${loadaddr} ${initramaddr} ${dtbaddr}
    ramfile=zImage
    rootpath=/romfs
    sdcardargs=set bootargs root=/dev/mmcblk0p1 rw rootfstype=ext2 clkin_hz=(50000000) earlyprintk=serial,uart0,57600 console=ttySC0,115200 mem=224M
    sdcardboot=mmc rescan;mmc dev 0 0;ext2load mmc 0:1 ${loadaddr} /boot/${ramfile};ext2load mmc 0:1 ${dtbaddr} /boot/${dtbfile};run sdcardargs;bootz ${loadaddr} - ${dtbaddr}
    serveraddr=f0:1f:af:2d:c6:e1
    serverip=192.168.2.62
    stderr=serial
    stdin=serial
    stdout=serial
    ubootfile=u-boot-sc589-ezkit.ldr
    update=tftp ${loadaddr} ${ubootfile};sf probe 2:1;sf erase 0 0x80000;sf write ${loadaddr} 0 ${filesize}

    Environment size: 2300/8188 bytes
    Nautel # run nfsboot
    Speed: 100, full duplex
    Using dwmac.3100c000 device
    TFTP from server 192.168.2.62; our IP address is 192.168.2.63
    Filename 'zImage'.
    Load address: 0xc2000000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #############################
             1.7 MiB/s
    done
    Bytes transferred = 4231784 (409268 hex)
    Speed: 100, full duplex
    Using dwmac.3100c000 device
    TFTP from server 192.168.2.62; our IP address is 192.168.2.63
    Filename 'sc589-ezkit.dtb'.
    Load address: 0xc4000000
    Loading: ##
             1.5 MiB/s
    done
    Bytes transferred = 21512 (5408 hex)
    Bad Linux ARM zImage magic!
    Nautel #

  • Hi Andnan,

    I got reproduced the devtool modify issue from my end, I am analysing the issue and will get back.

    Have you crossed the "Bad Linux ARM zImage magic!" error, or you are trying to make a modification in kernel with devtool to solve magic error.
    If so please try do changes in tmp/work/adsp_sc589_ezkit-poky-linux-gnueabi/linux-adi/*/git and build using "bitbake linux-adi -f -c compile" to test the images.


    Thanks
    Vignesh R

  • I haven't gotten past the issue and was intending to add some additional debug output using the devtool approach.  I started with modifying the source in tmp/work/adsp_sc589_ezkit-poky-linux-gnueabi/linux-adi/*/git but with mixed results.  My research into yocto says that approach is frouned upon.  Devtool is the way to go, it keeps things clean.

  • I have some new info regarding the zImage magic problem.  To start, I'm using the stock linux image for the sc589-ezkit and I expect errors but I should be getting past the magic number issue. 

    Using u-boot I load the zImage to the correct address (0xc2000000) and I can see the file when I dump the memory in u-boot.  So far so good.  Now I load the .dtb file to 0xc4000000 and it also appears to be correct.  Another step forward.  Now when I try to boot, I get the zImage error, and this is were it gets interesting.  If I dump the memory at the zImage address, it has the .dtb file.  The .dtb file is also at 0xc4000000.  After some testing, writing to 0xc2000000 and 0xc4000000 writes to the same address.  If I change the write address to 0xc8000000 for the zImage it will start to boot the kernal (past the zImage magic number problem) but still fails to boot.  I believe the root cause of the issue is a short or open on the address bus on the PCB since writes to 0xc2000000 and 0xc4000000 both end up writing to the same spot in memory but 0xc8000000 works fine.  If there is another cause or if you agree with my theory, please let me know.  I'd also like to get the devtool issue resolved since it is the proper way to do kernel modifications.

  • I'm still waiting for an answer to this question and can't move forward with modifying the kernel using devtool until it is.  Please provide an update.

  • This one is solved, the PCB implemented a different memory chip then the one in the schematic.  All fixed up, now gotta get the yocto linux devtool problem resolved.

  • Hey andnan!

    I was wondering how you created the u-boot files for your custom board? Do you have a brief list of steps that I can follow?

    Cheers,
    Yan