NAS542 bootloop after Debian/OMV (get a new firmware) (solved)

Options
2456710

Comments

  • Triu
    Triu Posts: 46  Freshman Member
    edited May 2019
    Options
    Unfortunately this gives me: "No such file or directory".
    Then i tried: "mount ramfs /mnt"
    But that shows me the Usage text again. "Usage: mount [<device> <fstype> <mountpoint>]"

  • Mijzelf
    Mijzelf Posts: 2,677  Guru Member
    Community MVP First Anniversary 10 Comments Friend Collector
    Options
    Bummer. I assume the /mnt directory exists?

    According to the barebox site barebox can also mount fat filesystems. Does a disk showup in /dev when you boot the box with a disk and/or usb stick inserted? And can it be mounted?
  • Triu
    Triu Posts: 46  Freshman Member
    edited May 2019
    Options
    O M G . I really forgot that. (Too much testing with reboot every 30sec and a hairdryer next to me.) Now something is right, cause i get no error. Instead i get only a new prompt line. Then i tftp into the /mnt folder. After that i used "bootm /mnt/uImage.521", this gets me the same ERROR: Out of memory.
    With USB, i formated a stick with fat32, plugged it in but i don't know how to find it. Dmesg and lsusb doesn't work on barebox. Couldn't find him in /env nor in /dev. I found something about automount here: https://www.barebox.org/doc/latest/user/automount.html
    My system tells me "unknown command 'automount'
    Seems this barebox.org/doc is outdated, or can barebox be adjusted? I mean could Zyxel make an own barebox with only the most necessary stuff they want?

  • Mijzelf
    Mijzelf Posts: 2,677  Guru Member
    Community MVP First Anniversary 10 Comments Friend Collector
    edited May 2019
    Options
    this gets me the same ERROR: Out of memory.

    Again? Does 'mount' show the ramfs is actually mounted? Does the 'meminfo' command show the available and used memory? Is the ramfs subtracted from the main memory?

    And does another uImage (for instance that Debian one) boot?

    can barebox be adjusted?

    AFAIK yes. The manual tells you can configure it with 'make menuconfig'. Which is also the way you can enable or disable applets in the Linux kernel or busybox.

    With USB, i formated a stick with fat32, plugged it in but i don't know how to find it.

    How about the usb command?



  • Triu
    Triu Posts: 46  Freshman Member
    edited May 2019
    Options
    The usb command doesn't work here (unkown command). I also couldn't find anything related to USB in the Command-List. Also meminfo doesn't work. I found the command "md" but it shows me:
    Barebox-C2K >/ md
    00000000: ffffffff ffffffff ffffffff ffffffff                ................
    00000010: ffffffff ffffffff ffffffff ffffffff                ................
    00000020: ffffffff ffffffff ffffffff ffffffff                ................
    00000030: ffffffff ffffffff ffffffff ffffffff                ................
    00000040: ffffffff ffffffff ffffffff ffffffff                ................
    00000050: ffffffff ffffffff ffffffff ffffffff                ................
    00000060: ffffffff dfffffff ffffffff ffffffff                ................
    00000070: ffffffff ffffffff ffffffff ffffffff                ................
    00000080: ffffffff ffffffff ffffffff ffffffff                ................
    00000090: ffffffff ffffffff ffffffff ffffffff                ................
    000000a0: ffffffff ffffffff ffffffff ffffffff                ................
    000000b0: ffffffff ffffffff ffffffff ffffffff                ................
    000000c0: ffffffff ffffffff ffffffff ffffffff                ................
    000000d0: ffffffff ffffffff ffffffff ffffffff                ................
    000000e0: ffffffff ffffffff ffffffff ffffffff                ................
    000000f0: ffffffff ffffffff ffffffff ffffffff                ................

    It does not change after mount a ramfs.

    With the output of devinfo i can see the new ramfs1 at the end of devices which wasn't there before.

    Barebox-C2K >/ devinfo
    devices:
    |----ramfs0
    |----devfs0
    |----mem0 (defaultenv)
    |----mem1 (mem)
    |----fast_uart0
    |----cs0
    |----c2k_i2c0
    |----eeprom0
    |----c2k_spi0
    |----S25FL064A0
    |----comcerto_spi10
    |----comcerto_spi20
    |----legerity0
    |----c2k_otp0
    |----c2000_eth0
    |----miidev0 (phy0)
    |----eth0
    |----c2000_eth1
    |----eth1
    |----cfi_flash0
    |----csi_flash0 (spi0, env0, spi0.uloader, spi0.barebox, spi0.env)
    |----comcerto_nand0
    |----nand0 (nand0, nand_oob0, self_raw, nand0.config, nand0.kernel1, nand0.rootfs1, nand0.kernel2, nand0.rootfs2, nand0.reserved)
    |----ramfs1

    drivers:
     fast_uart
         ramfs
         devfs
        miidev
     c2000_eth
    comcerto_nand
     cfi_flash
       c2k_spi
    c2k_fast_spi
     csi_flash
       c2k_i2c
       c2k_otp
           mem
        cramfs
    Also the mount command tells it is there: (before&after)
    Barebox-C2K >/ mount
    none on / type ramfs
    none on /dev type devfs
    Barebox-C2K >/ mk mnt
    Barebox-C2K >/ mount none ramfs /mnt
    Barebox-C2K >/ mount
    none on / type ramfs
    none on /dev type devfs
    none on /mnt type ramfs

    Seems i do not have to make a ramfs cause "/" is already one.

    I tried "mtest" but that tells me: "Usage: <start> <end>". But nothing worked: "mtest -start", "mtest start", "mtest 1", "mtest <start>" , "mtest".

    Then i copied a Debian uImage without "mount" and "/mnt" only with "tftp uImage1". After "bootm uImage1" it started booting, but ends up in a "Kernel panic error". Attached is the boot-log.

    At the beginning of the boot-log: "Memory: 44MB 960MB = 1004MB total" "Memory: 1012108k/1012108k available, 36468k reserved, 0K highmem". There should be enough memory, i think.

    Thank you for your help. Hope this NAS will work again.


  • Mijzelf
    Mijzelf Posts: 2,677  Guru Member
    Community MVP First Anniversary 10 Comments Friend Collector
    Options
    So de Debian kernel works, and the ZyXEL kernel gives an 'Out of memory'. I think the ZyXEL kernel is actually way bigger, as it includes the initramfs, and the Debian kernel doesn't. By writing a file to a ramdisk it's not known (to me) where it's located. When booting a uImage the payload has to be written to a physical address, 0x8000. If there is not enough room until the first barebox components, that could give an 'Out of memory'

    Output of"addpart /dev/ram0 8M@0x8000(kernelraw)" => "No such file or directory"
    /dev/ files:
    zero, defaultenv, mem, phy0, spi0, env0, nand0, nand_oob0, self_raw, self0, spi0.uloader, spi0.barebox, spi0.env, nand0.config, nand0.kernel1, nand0.rootfs1, nand0.kernel2, nand0.rootfs2, nand0.reserved, nand0.reserved.bb, nand0.rootfs2.bb, nand0.config.bb, nand0.rootfs1.bb, nand0.kernel1.bb, nand0.config.bb
    There is no ram0 in /dev. But there is a mem. I dunped the barebox partition in my 520, and run strings on it, and found it contains lots of scripts. In one of them I found this snippet:
    elif [ x$kernel_loc = xsata ]; then<br>&nbsp;&nbsp;&nbsp; addpart /dev/mem 3M@0x3008000(uImage)<br>&nbsp;&nbsp;&nbsp; sata read 3008000 1 5000<br>&nbsp;&nbsp;&nbsp; kdev="/dev/mem.uImage"<br>&nbsp;&nbsp;&nbsp; sata stop<br>
    So apparently it's also possible to use /dev/mem, and mem is available. (And I have no idea what the difference is between mem and ram0). When creating this partition(?) the physical address and size if given. So I suggest to repeat that commands with /dev/mem instead of /dev/ram0

  • Triu
    Triu Posts: 46  Freshman Member
    edited May 2019
    Options
    I tried this with both, the Debian/OMV uImage (uImage1) and with your uImage.521. Both outputs are attached. The uImage1 is the same as before, Kernel panic. The uImage.521 is doing more, tried this 2 times, both the same. Something with NAND Flash corrupt and ubiattach seems to me making this problems.
    (search for: "ubiattach: error!: cannot attach mtd7")
  • Mijzelf
    Mijzelf Posts: 2,677  Guru Member
    Community MVP First Anniversary 10 Comments Friend Collector
    Options
    Looks good. Did you get this using /dev/mem?

    mtd7 is rootfs2
    cat /proc/mtd<br>dev:&nbsp;&nbsp;&nbsp; size&nbsp;&nbsp; erasesize&nbsp; name<br>mtd0: 00040000 00010000 "uloader"<br>mtd1: 00080000 00010000 "barebox"<br>mtd2: 00040000 00010000 "env"<br>mtd3: 00a00000 00020000 "config"<br>mtd4: 00a00000 00020000 "kernel1"<br>mtd5: 06e00000 00020000 "rootfs1"<br>mtd6: 00a00000 00020000 "kernel2"<br>mtd7: 06e00000 00020000 "rootfs2"<br>mtd8: 00600000 00020000 "reserved"<br>mtd9: 06406000 0001f000 "ubi_rootfs1"<br>mtd10: 0045c000 0001f000 "ubi_config"

    So if kernel2 was never filled, rootfs2 isn't either.

    In your bootlog I see traces of the script /etc/init.d/rcS. This script contains the next snippet:
    # which kernel and system image partitions<br>CURR_BOOTFROM_UPDATED="0"<br>NEXT_BOOTFROM=`${INFO_PRINTENV} next_bootfrom | awk -F"=" '{print $2}'`<br>CURR_BOOTFROM=`${INFO_PRINTENV} curr_bootfrom | awk -F"=" '{print $2}'`<br>if [ "${NEXT_BOOTFROM}" != "${CURR_BOOTFROM}" ]; then<br>&nbsp;&nbsp;&nbsp; CURR_BOOTFROM="${NEXT_BOOTFROM}"<br>#&nbsp;&nbsp; ${INFO_SETENV} curr_bootfrom "${CURR_BOOTFROM}"<br>&nbsp;&nbsp;&nbsp; CURR_BOOTFROM_UPDATED="1"<br>fi<br>#CURR_BOOTFROM=`${INFO_PRINTENV} curr_bootfrom | awk -F"=" '{print $2}'`<br>if [ "${CURR_BOOTFROM}" = "1" ]; then<br>&nbsp;&nbsp;&nbsp; IMG_MTD=5<br>else<br>&nbsp;&nbsp;&nbsp; IMG_MTD=7<br>fi

    So if you exchanges the values of next_bootfrom and curr_bootfrom in the barebox environment, and boot the uImage.521 kernel, I'd expect an even better result.

  • Triu
    Triu Posts: 46  Freshman Member
    edited May 2019
    Options
    I have done everything (copy file to local) except bootm and then tried "cat /dev/mem" but this filled the whole screen with unreadable content and doesn*t stop. Or did i understand something wrong?

    Under /env there is a config file and a bin folder. The config file:
    #!/bin/sh

    # use 'dhcp' to do dhcp in barebox and in kernel
    # use 'none' if you want to skip kernel ip autoconfiguration
    ip=dhcp

    # or set your networking parameters here
    #eth0.ipaddr=192.168.2.22
    #eth0.netmask=255.255.255.0
    eth0.serverip=192.168.1.70
    #eth0.gateway=192.168.2.1
    #eth0.ethaddr=00:0A:0B:0C:0D:0E
    #eth1.ethaddr=00:1A:1B:1C:1D:1E
    #eth2.ethaddr=00:2A:2B:2C:2D:2E

    # can be either 'nfs', 'tftp' , 'nor' , 'nand' and 'sata'
    kernel_loc=nand
    #kernel_loc=nor
    #kernel_loc=sata
    # can be either 'net', 'nor' ,'initrd' , 'nand' and 'sata'
    rootfs_loc=nand
    #rootfs_loc=nor
    #rootfs_loc=sata

    # barebox images

    In the bin folder is this:

    update     update_rootfs     _update     update_uloader     b0     hush_hack     _update_help     init     update_barebox     b2      b1     boot     update_kernel
    in the boot file:
    #!/bin/sh

    . /env/config

    if [ x$1 = xnand ]; then
            rootfs_loc=nand
            kernel_loc=nand
    #elif [ x$1 = xnor ]; then
    #       rootfs_loc=nor
    #       kernel_loc=nor
    #elif [ x$1 = xsata ]; then
    #       rootfs_loc=sata
    #       kernel_loc=sata
    #elif [ x$1 = xnfs ]; then
    #       rootfs_loc=net
    #       kernel_loc=nfs
    elif [ x$1 = xtftp ]; then
            rootfs_loc=net
            kernel_loc=tftp
    fi

    if [ x$ip = xdhcp ]; then
            bootargs="$bootargs ip=dhcp"
    elif [ x$ip = xnone ]; then
            bootargs="$bootargs ip=none"

    in the init file:
    #!/bin/sh

    PATH=/env/bin
    export PATH

    . /env/config
    #if [ -e /dev/nor0 -a -n "$nor_parts" ]; then
    #       addpart /dev/nor0 $nor_parts
    #fi

    #if [ -e /dev/disk0 -a -n "$disk_parts" ]; then
    #       addpart /dev/disk0 $disk_parts
    #fi

    if [ -e /dev/spi0 -a -n "$spi_parts" ]; then
            addpart /dev/spi0 $spi_parts
    fi

    if [ -e /dev/nand0 -a -n "$nand_parts" ]; then
            addpart /dev/nand0 $nand_parts

            # Uh, oh, hush first expands wildcards and then starts executing
            # commands. What a bug!
            source /env/bin/hush_hack
    fi
    update file:
    #!/bin/sh

    if [ x$mode = xddr ]; then
            if [ -z "$part" -o -z "$address" -o -z "$size" ]; then
                    echo "define \$part, \$address and \$size"
                    exit 1
            fi
    else
            if [ -z "$part" -o -z "$image" ]; then
                    echo "define \$part and \$image"
                    exit 1
            fi
    fi

    if [ ! -e "$part" ]; then
            echo "Partition $part does not exist"
            exit 1
    fi

    if [ x$mode = xtftp ]; then
            if [ x$ip = xdhcp ]; then
                    dhcp
            fi

            ping $eth0.serverip
    update rootfs
    #!/bin/sh

    . /env/bin/update -t rootfs -d $1
    _update:
    #!/bin/sh

    if [ x$mode = xddr ]; then
            if [ -z "$part" -o -z "$address" -o -z "$size" ]; then
                    echo "define \$part, \$address and \$size"
                    exit 1
            fi
    else
            if [ -z "$part" -o -z "$image" ]; then
                    echo "define \$part and \$image"
                    exit 1
            fi
    fi

    if [ ! -e "$part" ]; then
            echo "Partition $part does not exist"
            exit 1
    fi

    if [ x$mode = xtftp ]; then
            if [ x$ip = xdhcp ]; then
                    dhcp
            fi

            ping $eth0.serverip
    update_uloader:
    #!/bin/sh

    . /env/bin/update -t uloader -d $1
    b0:
    #!/bin/sh

    . /env/config

    if [ x$1 = xnand ]; then
            rootfs_loc=nand
            kernel_loc=nand
    #elif [ x$1 = xnor ]; then
    #       rootfs_loc=nor
    #       kernel_loc=nor
    #elif [ x$1 = xsata ]; then
    #       rootfs_loc=sata
    #       kernel_loc=sata
    #elif [ x$1 = xnfs ]; then
    #       rootfs_loc=net
    #       kernel_loc=nfs
    elif [ x$1 = xtftp ]; then
            rootfs_loc=net
            kernel_loc=tftp
    fi

    if [ x$ip = xdhcp ]; then
            bootargs="$bootargs ip=dhcp"
    elif [ x$ip = xnone ]; then
            bootargs="$bootargs ip=none"
    hush_hack:
    nand -a /dev/nand0.*
    _update_help:
    #!/bin/sh

    echo "usage: update -t <kernel|rootfs|barebox|bareboxenv> -d <nor|nand> [-m tftp
    echo "update tools."
    echo ""
    echo "options"
    echo " -c     to check the crc32 for the image and flashed one"
    echo ""
    echo "default mode is tftp"
    echo "type update -t uloader -d <nor|nand> [-m tftp|xmodem|ddr] [-f imagename|-a
    echo "type update -t barebox -d <nor|nand> [-m tftp|xmodem|ddr] [-f imagename|-a
    echo "type update -t kernel -d <nor|nand> [-m tftp|xmodem|ddr] [-f imagename|-a
    echo "type update -t rootfs -d <nor|nand> [-m tftp|xmodem|ddr] [-f imagename|-a
    echo "type update -t bareboxenv -d <nor|nand> [-m tftp|xmodem|ddr] [-f imagename
     update_barebox:
    #!/bin/sh

    . /env/bin/update -t barebox -d $1
    b2:
    #!/bin/sh

    . /env/config
    next_bootfrom="2"

    if [ x$1 = xnand ]; then
            rootfs_loc=nand
            kernel_loc=nand
    #elif [ x$1 = xnor ]; then
    #       rootfs_loc=nor
    #       kernel_loc=nor
    #elif [ x$1 = xsata ]; then
    #       rootfs_loc=sata
    #       kernel_loc=sata
    #elif [ x$1 = xnfs ]; then
    #       rootfs_loc=net
    #       kernel_loc=nfs
    elif [ x$1 = xtftp ]; then
            rootfs_loc=net
            kernel_loc=tftp
    fi

    if [ x$ip = xdhcp ]; then
            bootargs="$bootargs ip=dhcp"
    elif [ x$ip = xnone ]; then
    b1:
    #!/bin/sh

    . /env/config
    next_bootfrom="1"

    if [ x$1 = xnand ]; then
            rootfs_loc=nand
            kernel_loc=nand
    #elif [ x$1 = xnor ]; then
    #       rootfs_loc=nor
    #       kernel_loc=nor
    #elif [ x$1 = xsata ]; then
    #       rootfs_loc=sata
    #       kernel_loc=sata
    #elif [ x$1 = xnfs ]; then
    #       rootfs_loc=net
    #       kernel_loc=nfs
    elif [ x$1 = xtftp ]; then
            rootfs_loc=net
            kernel_loc=tftp
    fi

    if [ x$ip = xdhcp ]; then
            bootargs="$bootargs ip=dhcp"
    elif [ x$ip = xnone ]; then
    update_kernel:
    #!/bin/sh

    . /env/bin/update -t kernel -d $1

    I couldn't find anything which could switch the kernel (something with IMG_MTD=5). I only found the settings for the image in b1 and b2, but no matter what will be choosen, they point to the same place, hmmm.





  • Mijzelf
    Mijzelf Posts: 2,677  Guru Member
    Community MVP First Anniversary 10 Comments Friend Collector
    Options
    Or did i understand something wrong?

    I think so. If you run printenv, it should show something like

    <p>...<br></p><p>next_bootfrom = 1</p><p><br></p><p>curr_bootfrom = 2<br></p>...
    Then run setenv:
    <div>setenv next_bootfrom 2</div><div><br></div><div>setenv curr_bootfrom 1</div><div><br></div><div>saveenv</div>
    and load@boot uImage.521

Consumer Product Help Center