Go to previous topic
Go to next topic
Last Post 19 Jul 2006 10:31 AM by  peter.barada@logicpd.com
linux not starting on Coldfire M5475EVB
 14 Replies
Author Messages
coldfire@metacom.co.za
New Member
New Member
Posts:


--
05 Jan 2006 09:02 AM
    Hi,

    I keep having problems starting linux from the yaffs-rootfs-m5475cfe-evb.img. When I type "load elf /flash/boot/vmlinux" I get the following:
    warning: guessing combined program header size as as 73904
    loaded 1262508 @ 0x000c0000 Ram
    md5sum of _loaded_ portion of the file:
    ff7adf835c62b4ec4c1b0636df8c8a80 - addr: 000c0000 len: 001343ac
    file loaded


    User and code flash are erased at this point. I have been successful with loading and executing linux with romfs but I do need to have a writable fs.

    When I view the "faulty" elf image the size of the program headers is 32 bytes. The weird thing is that when I run exec in losh then losh just hangs if CONFIG_BLK_DEV_INITRD is not set. If CONFIG_BLK_DEV_INITRD=y then linux starts and gives the following output:

    Linux version 2.4.26 (root@linux) (gcc version 3.4.3) #3 Thu Jan 5 17:05:30 SAST
    2006
    starting up linux rev 0.2: startmem 0xc0230000, size 61MB
    Flex CS0: ff800000 007f0001 00101180
    Flex CS1: e0000000 07ff0001 00101180
    Flex CS4: 40000000 0fff0001 00104580
    Flex CS5: 50000000 0fff0001 00101d80
    On node 0 totalpages: 8192
    zone(0): 1024 pages.
    zone(1): 7168 pages.
    zone(2): 0 pages.
    Kernel command line: root=/dev/mtdblock/2 rootfstype=yaffs rw
    Have no hardware time clock, returning ToD as 00:00:00 on 1 Jan 1970
    *** LINE 1111 *** FORMAT=4
    Current process id is 0
    BAD KERNEL TRAP: 00000000
    PC: [<c00dd564>]
    SR: 2704 SP: c022df88 a2: c022c000
    d0: 00000001 d1: 00000000 d2: c01eba40 d3: 00000001
    d4: 00000000 d5: 00000000 a0: c01b3344 a1: c01b2148
    Process swapper (pid: 0, stackpage=c022e000)
    Fault Status=0x0:Normal
    Stack from c022dfbc:
    c0221634 00000000 00000084 00000000 c022dfd8 c01b3300 00000000 c022dffc
    00000001 00000000 c01eba40 c01eba40 c022dffc c021ec34 00049550 c01e2948
    00000000 30c01019 10c070f2 4a816602 42802600 2003242e ffa4262e ffa84e5e
    4e754e56 00002f0b 2f02266e 00087001 c0ae000c 661c4a6b 00086716 302b0008
    2f0061ff 000395dc 588f72f3 4a806600 00a02f0b 61ff0000 bf602f0b 61ffffff
    c1a07001 c0ae000c 508f6718 7001c0ab 00286610 2f0b61ff ffffbd20 588f72f0
    Call Trace:
    [<c01955a5>] [<c019566f>] [<c01939c4>] [<c01939da>]
    [<c0195386>] [<c019568c>] [<c019569b>] [<c01956fc>]
    Code: f55c 2005 4cee 38fc ffd8 4e5e 4e75 4e56 ffcc 48d7
    Kernel panic: Attempted to kill the idle task!
    In idle task - not syncing


    Here is the vmlinux elf file:
    ELF Header:
    Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
    Class: ELF32
    Data: 2's complement, big endian
    Version: 1 (current)
    OS/ABI: UNIX - System V
    ABI Version: 0
    Type: EXEC (Executable file)
    Machine: MC68000
    Version: 0x1
    Entry point address: 0xc0000
    Start of program headers: 52 (bytes into file)
    Start of section headers: 1283084 (bytes into file)
    Flags: 0x2000000, ColdFire
    Size of this header: 52 (bytes)
    Size of program headers: 32 (bytes)
    Number of program headers: 4
    Size of section headers: 40 (bytes)
    Number of section headers: 19
    Section header string table index: 18


    or

    architecture: m68k, flags 0x00000102:
    EXEC_P, D_PAGED
    start address 0x000c0000

    Program Header:
    LOAD off 0x00000300 vaddr 0xc01e2300 paddr 0xc01e2300 align 2**13
    filesz 0x00000000 memsz 0x00039c4c flags rwx
    LOAD off 0x00002000 vaddr 0xc00c0000 paddr 0x000c0000 align 2**13
    filesz 0x001222fc memsz 0x001222fc flags rwx
    LOAD off 0x00125f50 vaddr 0xc021bf50 paddr 0x0021bf50 align 2**13
    filesz 0x000120b0 memsz 0x000120b0 flags rwx
    STACK off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**2
    filesz 0x00000000 memsz 0x00000000 flags rwx
    private flags = 2000000: [ColdFire]


    All the source code and crosscompiler tools where downloaded from logicpd.

    hope to hear from someone,

    Jurgen
    jpinakis
    New Member
    New Member
    Posts:


    --
    13 Jan 2006 12:41 AM
    Hello Jurgen,

    Did you ever find out what is going wrong with your BSP? I have the same problem running the Logic Linux demo - haven't quite gotten to the point of building my own one yet. I'd be very grateful if you or anyone else could shed some light on it.

    Cheers,

    james
    coldfire@metacom.co.za
    New Member
    New Member
    Posts:


    --
    13 Jan 2006 12:53 AM
    Hi James,

    no, I haven't had any response from logic. I am trying some other channels but haven't found a solution yet.

    regards,

    Jurgen
    jpinakis
    New Member
    New Member
    Posts:


    --
    13 Jan 2006 02:15 AM
    Thanks Jurgen. I've tried tinkering with a lot of things but none of them make any difference. If even the provided Linux demo doesn't work then what hope do I have for building my own? I'd be interested to hear if anyone has actually been able to build and deploy a Linux BSP as the small amount of traffic here suggests that we might be the only people trying to do this

    Please post here if you have any joy with Logic.

    james
    jpinakis
    New Member
    New Member
    Posts:


    --
    16 Jan 2006 01:31 AM
    I built my own image today and got the same result when I tried to run it on the board. Here's my output:

    Linux version 2.4.26 (jpinakis@qrssrv01) (gcc version 3.4.3) #5 Mon Jan 16 15:27
    :04 WST 2006
    starting up linux rev 0.2: startmem 0xc022e000, size 61MB
    Flex CS0: ff800000 007f0001 00100d80
    Flex CS1: e0000000 07ff0001 00100d80
    Flex CS4: 40000000 0fff0001 00103580
    Flex CS5: 50000000 0fff0001 00101580
    On node 0 totalpages: 8192
    zone(0): 1024 pages.
    zone(1): 7168 pages.
    zone(2): 0 pages.
    Kernel command line: root=/dev/mtdblock/2 rootfstype=yaffs rw
    Have no hardware time clock, returning ToD as 00:00:00 on 1 Jan 1970
    *** ILLEGAL INSTRUCTION *** FORMAT=4
    Current process id is 0
    BAD KERNEL TRAP: 00000000
    PC: [<c0047128>]
    SR: 2704 SP: c022bf80 a2: c022a000
    d0: 00000001 d1: 00000000 d2: c01eb5b0 d3: 00000001
    d4: 00000000 d5: 00000000 a0: c01b2f10 a1: c01b1d40
    Process swapper (pid: 0, stackpage=c022c000)
    Fault Status=0x0:Normal
    Stack from c022bfb4:
    c00470d4 c00dd3ae c021f322 00000000 00000084 00000000 c022bfd8 c01b2ecc
    00000000 c022bffc 00000001 00000000 c01eb5b0 c01eb5b0 c022bffc c021cc34
    00067564 c01e24bc 00000000
    Call Trace:
    [<c00dd3ae>]
    Code: 00a3 46e2 eafa 2a2f 9151 214a d051 19de 902d a2a0
    Kernel panic: Attempted to kill the idle task!
    In idle task - not syncing

    Anyone out there got any ideas? We'd really like to start looking into using this processor for development and are being held up by this.

    james
    peter.barada@logicpd.com
    New Member
    New Member
    Posts:72


    --
    17 Jan 2006 12:07 PM
    > Anyone out there got any ideas? We'd really like to start looking into using this
    > processor for development and are being held up by this.

    1) Which SOM are you using?
    2) Which config are you using?
    3) Have you customized the config?
    4) Which version of LoLo is on the board?

    The error looks valid(i.e.0x00a3 is an invalid opcode for ColdFire, but the traceback doesn't look right). Could you also respond with the output from the following:

    [LinuxBSP-22012005]$ m68k-linux-addr2line -e linux/vmlinux 0xc0047128 0xc00dd3ae
    jpinakis
    New Member
    New Member
    Posts:


    --
    17 Jan 2006 07:28 PM
    Posted By peterb on 17 Jan 2006 0:7 PM
    > Anyone out there got any ideas? We''d really like to start looking into using this
    > processor for development and are being held up by this.

    1) Which SOM are you using?




    We have the M5485EVB.

    Quote:
    2) Which config are you using?


    config-m5485cfe-evb-yaffs

    Quote:
    3) Have you customized the config?


    No, we're just using the default one.

    Quote:
    4) Which version of LoLo is on the board?


    Version 2.0.5-MCF5485_10 0001

    Quote:
    The error looks valid(i.e.0x00a3 is an invalid opcode for ColdFire, but the traceback doesn't look right). Could you also respond with the output from the following:

    [LinuxBSP-22012005]$ m68k-linux-addr2line -e linux/vmlinux 0xc0047128 0xc00dd3ae


    LinuxBSP-22012005$ /opt/logicpd/ColdFire/m68k-linux/gcc-3.4
    .3-glibc-2.3.5/bin/m68k-linux-addr2line -e linux-2.4.26/vmlinux 0xc0047128 0xc00dd3ae
    ??:0
    /home/NT1/jpinakis/LinuxBSP-22012005/linux-2.4.26/mm/slab.c:391

    LinuxBSP-22012005$
    jpinakis
    New Member
    New Member
    Posts:


    --
    17 Jan 2006 07:48 PM
    After I read the post from Logic, I wondered if the version of LoLo didn't have something to do with it, so I downgraded to version 2.0.2. The linux image then booted properly! No idea why, but perhaps that's something Logic could look at.

    james
    coldfire@metacom.co.za
    New Member
    New Member
    Posts:


    --
    18 Jan 2006 04:21 AM
    Hi,

    that sounds like great news to me. Where can I pick up that Logicloader version? Can you send it to me ?

    kind regards,

    Jurgen
    Email: jurgen@metacom.co.za
    Anonymous
    Posts:


    --
    18 Jan 2006 02:59 PM
    You can download this on the product downloads page for your kit under the "LogicLoader Bootloader" category. You're going to want to make sure that you're registered for this product first.

    Thanks,
    peter.barada@logicpd.com
    New Member
    New Member
    Posts:72


    --
    03 Feb 2006 11:38 AM
    The issue turns out that the download buffer used by LoLo to hold the elf file was moved up in memory between version 2.0.2 and 2.0.5, and this was not an issue for the romfs image(since in that case is just one *giant* segment that has relocatable code at the beginning), but the vmlinux in the yaffs rootfs has a hole in the middle(where the .bss segment is located), and that hole causes LoLo to incorrectly choose to copy down in memory the 2nd segment of the ELF file, and accidentally overwrite a portion of the first segment. Hence the failure.

    I've updated the LoLo development tree, and this fix will show up in the next version of LoLo.
    alaemmer@htwg-konstanz.de
    New Member
    New Member
    Posts:


    --
    30 Mar 2006 12:41 PM
    I upgraded to the latest version of logicloader (2.0.6), but the bug is still there. When will we get a fixed version?

    André Lämmer
    peter.barada@logicpd.com
    New Member
    New Member
    Posts:72


    --
    05 Apr 2006 10:17 AM
    Here's a workaround you can use to load the YAFFS kernel from the root filesystem and boot it.

    1) build/install the root filesystem.

    2) On your linux development host, create a raw binary file of the linux kernel(note its name is vmlinux-absolute), adjusting the load addresses of each segment so the start of the raw file lines up with the start of the kernel (at address 0xc0000) (note the backslashes to break up the command line into something readable):

    [peter@fast LinuxBSP-22012005]$ /opt/logicpd/ColdFire/m68k-linux/gcc-3.4.3-glibc-2.3.5/bin/m68k-linux-objcopy -O binary \
    --change-section-lma .text-0xc0000 \
    --change-section-lma .text.exit-0xc0000 \
    --change-section-lma .rodata-0xc0000 \
    --change-section-lma .kstrtab-0xc0000 \
    --change-section-lma __ex_table-0xc0000 \
    --change-section-lma __ksymtab-0xc0000 \
    --change-section-lma .data-0xc0000 \
    --change-section-lma .exitcall.exit-0xc0000 \
    --change-section-lma .data.cacheline_aligned-0xc0000 \
    --change-section-lma .text.init-0xc0000 \
    --change-section-lma .data.init-0xc0000 \
    --change-section-lma .setup.init-0xc0000 \
    --change-section-lma .initcall.init-0xc0000 \
    --change-section-lma init_task-0xc0000 \
    linux-2.4.26/vmlinux-absolute linux-2.4.26/vmlinux.bin

    3) Copy this to your tftpserver root (mines on a different machine called 'pogo'):

    [peter@fast LinuxBSP-22012005]$ scp linux-2.4.26/vmlinux.bin peter@pogo:/tftpboot/

    4) On the board, mount the root filesystem:

    losh> add-yaffs flash nor 0xe0000000 0x01000000
    losh> mount yaffs /flash

    5) bring up the ethernet port (I use DHCP):

    losh> ifconfig sm0 dhcp

    6) Copy the binary kernel file from the tftpserver over to the root filesystem in /boot:

    losh> cp /tftp/192.168.3.3:vmlinux.bin /flash/boot/vmlinux.bin

    7) Find out the size of /boot/vmlinux.bin (since its required for the 'load raw' command):

    losh> ls /flash/boot/vmlinux.bin
    : vmlinux.bin 1490944

    8) using the size returned (in my case 1490944), load the binary kernel to address 0xc0000:

    losh> load raw 0xc0000 1490944 /flash/boot/vmlinux.bin
    loading from /flash/boot/vmlinux.bin:
    loading raw binary to 0x000c0000 (ram) len 0016c000:
    ......................................................................................................................................................................................md5sum of _loaded_ portion of the file:
    c64877998e8e6fe84ef9216f67b7d68a - addr: 000c0000 len: 0016c000
    file loaded

    9) execute it:

    losh> exec
    Linux version 2.4.26 (peter@fast) (gcc version 3.4.3) #1 Mon Apr 3 09:36:22 EDT
    2006
    starting up linux rev 0.2: startmem 0xc022e000, size 61MB
    Flex CS0: ff800000 007f0001 00100d80
    Flex CS1: e0000000 07ff0001 00100d80
    Flex CS4: 40000000 0fff0001 00103580
    Flex CS5: 50000000 0fff0001 00101580
    On node 0 totalpages: 8192
    zone(0): 1024 pages.
    zone(1): 7168 pages.
    zone(2): 0 pages.
    Kernel command line: root=/dev/mtdblock/2 rootfstype=yaffs rw
    Have no hardware time clock, returning ToD as 00:00:00 on 1 Jan 1970
    Calibrating delay loop... 199.88 BogoMIPS
    Memory: 62880k/65536k available (968k kernel code, 1632k data, 56k init)
    ...

    I have a fix for the corrupted elf file, and it will be in the next release of LoLo.
    alaemmer@htwg-konstanz.de
    New Member
    New Member
    Posts:


    --
    19 Jul 2006 02:39 AM
    Posted By peterb on 5 Apr 2006 10:17 AM
    Here''s a workaround you can use to load the YAFFS kernel from the root filesystem and boot it.

    1) build/install the root filesystem.




    Is the bug now fixed in the latest lolo?

    André
    peter.barada@logicpd.com
    New Member
    New Member
    Posts:72


    --
    19 Jul 2006 10:31 AM
    Yes, LoLo 2.0.8 has the fix to allow you to exec the kernel from the yaffs image:

    *****************************************************************

    LogicLoader

    (c) Copyright 2002-2005, Logic Product Development, Inc.
    All Rights Reserved.
    Version 2.0.8-MCF5475_10 0001

    *****************************************************************

    losh> erase 0xe0000000 0x01000000
    unlocking flash blocks
    erasing flash: 100%
    locking flash blocks
    erased '/dev/flash1' start=0x0: len=0x1000000 bytes
    losh> ifconfig sm0 dhcp
    WARNING -- valid config block not found - using default MAC address
    Starting DHCP on sm0
    losh> load raw 0xe0000000 9830400 /tftp/192.168.3.3:yaffs-rootfs-m5475cfe-evb.img
    loading from /tftp/192.168.3.3:yaffs-rootfs-m5475cfe-evb.img:
    loading raw binary to 0xe0000000 (flash) len 00960000:
    ....ignoring rest of file...done
    file loaded to ram buffer, destined for flash addr: 0xe0000000
    losh> burn
    burning 9830400 bytes from 00200000 to /dev/flash1
    unlocking flash blocks
    erasing flash: 100%
    burning flash: 100%
    locking flash blocks
    burn good (9830400 bytes)
    losh> add-yaffs flash nor 0xe0000000 0x01000000
    add-yaffs: inserted: start 0xe0000000 - len 0x1000000
    losh> mount yaffs /flash
    Mounting a YAFFS partition.

    ---------------------------------------------------
    Starting YAFFS file system:
    Current YAFFS partition table:
    0: flash 00000000 - 0000007f ( 0)
    1: <NULL>
    2: <NULL>
    3: <NULL>
    YAFFS initialized.
    ---------------------------------------------------

    losh> load elf /flash/boot/vmlinux
    loading from /flash/boot/vmlinux:
    ........................................................................................................................................................................
    ELF section 1: buffer address: 0x00202000 dest: 0x000c0000
    ELF section 2: buffer address: 0x00339000 dest: 0x00237000
    warning: guessing combined program header size as 1270540
    loaded 1356556 @ 0x000c0000 Ram
    file loaded
    losh> exec
    rec_check: 0xc024c000
    Linux version 2.4.26 (peter@thunk) (gcc version 3.4.3) #11 Thu Jul 13 18:50:50 EDT 2006
    starting up linux rev 0.2: startmem 0xc024e000, size 61MB
    Flex CS0: ff800000 007f0001 00101180
    Flex CS1: e0000000 07ff0001 00101180
    Flex CS4: 40000000 0fff0001 00104580
    Flex CS5: 50000000 0fff0001 00101d80
    On node 0 totalpages: 8192
    zone(0): 1024 pages.
    zone(1): 7168 pages.
    zone(2): 0 pages.
    Kernel command line: root=/dev/mtdblock/2 rootfstype=yaffs rw
    Have no hardware time clock, returning ToD as 00:00:00 on 1 Jan 1970


    ---