questions booting Linux on a mpc8247
Hi all. I am trying to load Linux on a board with a mpc8247 processor using u-boot-1.1.4 and I'm running into a problems booting a multi-boot image (Linux kernel + ram disk).
I can load the image via TFTP, but it hangs when I try to run bootm. I searched in Google, but I couldn't find anything related to what I'm seeing so I'm hoping I can get some help from the u-boot community. What I see here is that u-boot gets a 0x200 exception because it is trying to load the ram disk image to memory out of range. My board has 128M of memory. Here is a snippet:
U-Boot 1.1.4 (May 10 2006 - 11:38:41)
MPC8247 Reset Status: Check Stop, External Soft, External Hard
MPC8247 Clock Configuration
- Bus-to-Core Mult 4x, VCO Div 2, 60x Bus Freq 25-75 , Core Freq 100-300
- dfbrg 1, corecnf 0x1a, busdf 5, cpmdf 1, plldf 0, pllmf 5
- vco_out 399999996, scc_clk 99999999, brg_clk 24999999 - cpu_clk 266666664, cpm_clk 199999998, bus_clk 66666666
- pci_clk 66666666
CPU: MPC8247 (HiP7 Rev 14, Mask 1.0 1K50M) at 266.666 MHz Board: MPC 8247 I2C: ready DRAM: 128 MB FLASH: 512 kB
Using default environment
In: serial Out: serial Err: serial Net: FCC1 ETHERNET IDE: Bus 0: OK
Device 0: Model: TOSHIBA THNCF256MMA Firm: 3.10 Ser#: STCB52M6300ZC49843C5
Type: Removable Hard Disk
Capacity: 244.5 MB = 0.2 GB (500736 x 512)
Type "run flash_nfs" to mount root filesystem over NFS
=> tftp
Using FCC1 ETHERNET device
TFTP from server 172.16.86.50; our IP address is 172.16.86.177 Filename 'jim/uImage'.
Load address: 0x100000
Loading: #################################################################
...
done
Bytes transferred = 7326900 (6fccb4 hex)
=> bootm
## Booting image at 00100000 ...
Image Name: Linux with ramdisk Created: 2006-05-10 22:01:21 UTC Image Type: PowerPC Linux Multi-File Image (uncompressed) Data Size: 7326836 Bytes = 7 MB Load Address: 00000000 Entry Point: 00000000 Contents: Image 0: 2559077 Bytes = 2.4 MB Image 1: 4767744 Bytes = 4.5 MB
Verifying Checksum ... OK
OK
Loading Ramdisk to 84344000, end 07f74064 ...
It verifies the image correctly, but the board hangs with a 0x200 exception trying to load the ram disk at 0x84344000 which is out of range. I don't know how u-boot calculates where it stores the kernel and ram disk at the moment (this is all magic to me). If I create an image where I specify the load address, say 16M (0x01000000), it is able to load the ram disk ok but hangs shortly with exception 0x200.
I generate the multi-boot image by running the following mkimage command:
$ ./u-boot-1.1.4/tools/mkimage -A ppc -O Linux -T multi -C none -n 'Linux with ramdisk' -d vmlinux:rootfs.powerpc.ext2 uImage.img
Unfortunately, I haven't figured out how to debug u-boot after it copies the code from rom to memory so progress has slowed. I am using Vision Probe to debug. I can debug the code prior to copying itself into memory, but I lose symbols once it relocates to memory. Does anyone have any advice on how to tackle this? I saw the GDB serial debug tutorial, but I don't have another serial port unfortunately.
I also have a question regarding tool chain. I am using uClibC's buildroot to build a compiler toolchain. At the moment, I am using gcc 3.4.2 and Linux 2.4.31. I tried using gcc 4.0.2 initially, but I had a problem with it trying to generate the proper code for building u-boot. It appears that u-boot is using register r29 as a global pointer and we had the following code in ./cpu/mpc8260/cpu_init.c:
void cpu_init_f (volatile immap_t * immr)
{
DECLARE_GLOBAL_DATA_PTR;
...
/* Pointer is writable since we allocated a register for it */
gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
}For the PPC, DECLARE_GLOBAL_DATA_PTR is defined as:
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r29")
As far as I can tell, the above statement is trying to assign r29 the value of CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET which is basically an offset in the PPC's internal memory for storing global data structure. However, gcc 4.0.2 would not generate code that sets r29 correctly. I temporarily worked around it by adding a couple of lines in start.S:
/* Hack to initialize R29 since cpu_init_f code isn't working. */
lis r29,(CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@h
ori r29, r29, (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET)@lIs anyone using gcc 4.x to build? I reverted to gcc 3.4.2 just to be on the safe side. Also, I noticed that Linux 2.6.x kernel doesn't have much support for embedded mpc82xx so I ended up using Linux 2.4.31 which is the most current version that works with uClibC's buildroot. Is there anyone doing embedded PPC development based on 2.6 kernel and gcc 4.x? I sure would like to hear your inputs.
Lastly, is there anyone working on a TIPC implementation in u-boot? I read the white paper on TIPC and it would seem like a nice solution to have on a distributed/embedded cluster environment such as a chassis where there is a single control card with multiple dummy line cards (flashless) on a custom backplane.
Any help or pointers would be greatly appreciated. Thanks in advance. --
Jim
Jim Fridlund <[email protected]> wrote:
[snip]
Quoted 2 lines
I can load the image via TFTP, but it hangs when I try to run bootm. I searched in Google, but I
If you can boot kernel via NFS, the problem must be your bootargs settings in u-boot. Try to type the cmdline to here for check.
Regards,
Sam
___________________________________________________________
????????-3.5G???20M???
http://cn.mail.yahoo.com
Hi Sam,
Ultimately, I would like to load a multi-boot image kernel + ram disk in a single file off the compact flash (IDE) drive. At the moment, I just got the IDE driver working. I had some problems with endian issue as my IDE interface is basically implemented as a CPLD. Even though I'm a big endian system, the IDE registers are little endian so I had to add special CFG arguments to get the IDE to recognize the drive. I'm also having problems trying to access the DOS file system. This is something I can pursue once I get linux bootstrapped though.
When I started with u-boot, I looked at the various boards in the list. I used IDS8247 as a reference since it was the same PPC8247. I realize I probably don't have the boot parameters set up correctly (I don't have NVRAM environment), but I figure I should still be allowed to boot.
Here is my hardcoded info in the board specific header:
#define CONFIG_EXTRA_ENV_SETTINGS \
"netdev=eth0\0" \
"nfsargs=setenv bootargs root=/dev/nfs rw " \
"nfsroot=${serverip}:${rootpath}\0" \
"ramargs=setenv bootargs root=/dev/ram rw " \
"console=ttyS0,57600\0" \
"addip=setenv bootargs ${bootargs} " \"ip=172.16.86.177:172.16.86.50:172.16.86.254:255.255.255.0"
\
":jim-r100:eth0:off panic=1\0" \
"flash_nfs=run nfsargs addip;" \
"bootm ${kernel_addr}\0" \
"flash_self=run ramargs addip;" \
"bootm ${kernel_addr} ${ramdisk_addr}\0" \
"net_nfs=tftp 200000 ${bootfile};run nfsargs addip;bootm\0" \
"rootpath=/opt/eldk/ppc_82xx\0" \
"bootfile=jim/uImage\0" \
"kernel_addr=ff800000\0" \
"ramdisk_addr=ffa00000\0" \
"ethaddr=00:01:47:01:02:03\0" \
"ipaddr=172.16.86.177\0" \
"serverip=172.16.86.50\0" \
"verify=y\0" \
""#define CONFIG_BOOTCOMMAND "run flash_self"
Thanks.
--
Jim
Quoted 12 lines · Sam Song
Jim Fridlund <[email protected]> wrote:
[snip]Quoted 2 lines
I can load the image via TFTP, but it hangs when I try to run bootm. I searched in Google, but I
If you can boot kernel via NFS, the problem must be your bootargs settings in u-boot. Try to type the cmdline to here for check.
Regards,
Sam
Quoted 3 lines · Jim Fridlund
"ramargs=setenv bootargs root=/dev/ram rw "
\
"console=ttyS0,57600\0" Well, pls try
=> tftp 200000
=> setenv kernel_addr 200000
=> tftp 1200000 <ramdisk>
=> setenv ramdisk_addr 1200000
=> run flash_self
You cannot boot kernel at 0x100000.
Best regards,
Sam
___________________________________________________________
??????-3.5G???20M??
http://cn.mail.yahoo.com/
Hi Sam,
I'm a little closer. ;-) The Vision Probe failed
trying to run code at PC=0x00000000.
=> printenv
bootcmd=run flash_self
baudrate=57600
loads_echo=1
preboot=echo;echo Type "run flash_nfs" to mount root filesystem over NFS;echo
netdev=eth0
nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} ramargs=setenv bootargs root=/dev/ram rw console=ttyS0,57600 addip=setenv bootargs ${bootargs} ip=172.16.86.177:172.16.86.50:172.16.86.254:255.255.255.0:jim-r100:eth0:off panic=1
flash_nfs=run nfsargs addip;bootm ${kernel_addr}
flash_self=run ramargs;bootm ${kernel_addr} ${ramdisk_addr} net_nfs=tftp 200000 ${bootfile};run nfsargs addip;bootm rootpath=/opt/eldk/ppc_82xx
bootfile=jim/uImage
kernel_addr=20000
ramdisk_addr=1200000
ethaddr=00:01:47:01:02:03
ipaddr=172.16.86.177
serverip=172.16.86.50
verify=y
stdin=serial
stdout=serial
stderr=serial
ethact=FCC1 ETHERNET
bootcount=49
Environment size: 798/65532 bytes
=> tftp 20000 jim/uImage.img
Using FCC1 ETHERNET device
TFTP from server 172.16.86.50; our IP address is 172.16.86.177 Filename 'jim/uImage.img'.
Load address: 0x20000
Loading: #################################################################
...
done
Bytes transferred = 2559141 (270ca5 hex)
=> tftp 1200000 jim/ram.img
Using FCC1 ETHERNET device
TFTP from server 172.16.86.50; our IP address is 172.16.86.177 Filename 'jim/ram.img'.
Load address: 0x1200000
Loading: #################################################################
...
done
Bytes transferred = 4767808 (48c040 hex)
=> run flash_self
## Booting image at 00020000 ...
Image Name: Linux Created: 2006-05-11 5:12:04 UTC Image Type: PowerPC Linux Kernel Image (uncompressed) Data Size: 2559077 Bytes = 2.4 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
OK
## Loading RAMDisk Image at 01200000 ...
Image Name: Ramdisk Created: 2006-05-11 5:13:09 UTC Image Type: PowerPC Linux RAMDisk Image (uncompressed) Data Size: 4767744 Bytes = 4.5 MB
Load Address: 00000000
Entry Point: 00000000
Verifying Checksum ... OK
Loading Ramdisk to 07ae7000, end 07f73000 ... OK
This is the disassembled output at address 0 from the Vision probe.
$00000000 dc.l 0x7f454c46 $00000004 dc.l 0x1020100 $00000008 dc.l 0x0 $0000000C dc.l 0x0 $00000010 dc.l 0x20014 $00000014 dc.l 0x1 $00000018 lfs F0,0x0(R0) $0000001C dc.l 0x34 $00000020 dc.l 0x1e8634 $00000024 dc.l 0x0 $00000028 dc.l 0x340020 $0000002C dc.l 0x20028 $00000030 dc.l 0x1b0018
It doesn't look like valid code and it sure
does not match the code that I'm expecting from
the vmlinux ELF image.
$ ${CROSS_COMPILE}objdump -d vmlinux | head -20vmlinux: file format elf32-powerpc
Disassembly of section .text:
c0000000 <_start>:
c0000000: 60 00 00 00 nop c0000004: 60 00 00 00 nop c0000008: 60 00 00 00 nop
c000000c <__start>:
c000000c: 7c 7f 1b 78 mr r31,r3 c0000010: 7c 9e 23 78 mr r30,r4 c0000014: 7c bd 2b 78 mr r29,r5 c0000018: 7c dc 33 78 mr r28,r6 c000001c: 7c fb 3b 78 mr r27,r7 c0000020: 3b 00 00 00 li r24,0 c0000024: 48 1c 5c 21 bl c01c5c44 <early_init> c0000028: 48 00 37 11 bl c0003738 <mmu_off>
For sure, the code at address 0 doesn't match
code at c0000000. So, I'm still probably not
doing something correctly in u-boot.
$ ${CROSS_COMPILE}nm --numeric-sort vmlinux | head -20
w __start___kallsyms
w __stop___kallsyms
00000005 a LG_CACHELINE_BYTES
0000000c a Hash_bits
0000001f a CACHELINE_MASK
00000020 a CACHELINE_BYTES
0003ffc0 a Hash_msk
c0000000 T _start
c0000000 T _stext
c000000c T __start
c000002c t __after_mmu_off
c0000064 t turn_on_mmu
c00000c4 T __secondary_hold
c0000100 t Reset
c0000190 t i0x100
c0000200 t MachineCheck
c0000290 t i0x200
c0000300 t DataAccess
c00003bc t i0x300
c0000400 t InstructionAccessI'm a couple steps closer though. So, is multi-image boot not supported?
Thanks again for your help.
--
Jim
Quoted 24 lines · Sam Song
Quoted 3 lines · Jim Fridlund
"ramargs=setenv bootargs root=/dev/ram rw " \ "console=ttyS0,57600\0"Well, pls try
=> tftp 200000
=> setenvkernel_addr200000
=> tftp 1200000 <ramdisk>
=> setenvramdisk_addr1200000
=> runflash_selfYou cannot boot kernel at
0x100000.Best regards,
Sam
___________________________________________________________
??????-3.5G???20M??
http://cn.mail.yahoo.com/
Quoted 5 lines · Jim Fridlund
$00000000 dc.l 0x7f454c46 $00000004 dc.l 0x1020100 $00000008 dc.l 0x0 $0000000C dc.l 0x0 $00000010 dc.l 0x20014
Quoted 8 lines
$00000014 dc.l 0x1 $00000018 lfs F0,0x0(R0) $0000001C dc.l 0x34 $00000020 dc.l 0x1e8634 $00000024 dc.l 0x0 $00000028 dc.l 0x340020 $0000002C dc.l 0x20028 $00000030 dc.l 0x1b0018
I just realized that the byte patterns above matches exactly what my vmlinux ELF image. Here is the hex dump:
00000000 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 .ELF............
00000010 00 02 00 14 00 00 00 01 c0 00 00 00 00 00 00 34 ...............4
00000020 00 1e 86 34 00 00 00 00 00 34 00 20 00 02 00 28 ...4.....4. ...(
00000030 00 1b 00 18 00 00 00 01 00 01 00 00 c0 00 00 00
................
00000040 c0 00 00 00 00 1d 60 b4 00 20 8c 3c 00 00 00 07 ......`.. .<....
00000050 00 01 00 00 64 74 e5 51 00 00 00 00 00 00 00 00 ....dt.Q........
00000060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 07
................
So, u-boot appears to have extracted the image correctly and relocated it to address 0, but I'm thinking I probably need to install a pure binary instead of an ELF image? Does u-boot understand ELF or does it only expect a pure binary?
Thanks again!
--
Jim
Quoted 4 lines · In message <[email protected]> you wrote:
I just realized that the byte patterns above matches exactly what my vmlinux ELF image. Here is the hex dump:
Which means you did you build the image correctly. RTFM.
Quoted 1 line
So, u-boot appears to have extracted the image correctly
Yes, U-Boot works fine, but it cannot fix operator errors.
Quoted 2 lines
Does u-boot understand ELF or does it only expect a pure binary?
RTFM!
Best regards,
Wolfgang Denk
Signature · 5 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de If it happens once, it's a bug. If it happens twice, it's a feature. If it happens more than twice, it's a design philosophy.
Quoted 5 lines · --- Wolfgang Denk
Quoted 2 lines · Jim Fridlund
Does u-boot understand ELF or does it only expect
a pure binary?RTFM!
Pls try the binary image instead. U-Boot can boot binary image by default.It locates at arch/ppc/boot/images/ in kernel code. I just noticed that you used ELF kernel. Wrong way...
Regards,
Sam
___________________________________________________________
????????-3.5G???20M???
http://cn.mail.yahoo.com
Quoted 3 lines · In message <[email protected]> you wrote:
I'm a little closer. ;-) The Vision Probe failed
trying to run code at PC=0x00000000.
Maybe you try again after disconnecting your Vision Probe.
Quoted 2 lines
I'm a couple steps closer though. So, is multi-image boot not supported?
Of course it is. It's working fine here.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Physician: One upon whom we set our hopes when ill and our dogs when well. - Ambrose Bierce
Quoted 2 lines · In message <[email protected]> you wrote:
You cannot boot kernel at
0x100000.
You can, if it's small enough.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "A verbal contract isn't worth the paper it's printed on." - Samuel Goldwyn
Quoted 4 lines · --- Wolfgang Denk
Quoted 1 line
You cannot boot kernel at
0x100000.You can, if it's small enough.
Thanks for this correction. Well, for kernel
boot address, 0x200000 is a better choice than0x100000 usually.
Sam
___________________________________________________________
????????-3.5G???20M???
http://cn.mail.yahoo.com
Quoted 3 lines · In message <[email protected]> you wrote:
I can load the image via TFTP, but it hangs when I try to run bootm. I searched in Google, but I couldn't find anything
Maybe reading the FAQ helps?
See http://www.denx.de/wiki/view/DULG/LinuxUncompressingError
Quoted 5 lines
related to what I'm seeing so I'm hoping I can get some help from the u-boot community. What I see here is that u-boot gets a
0x200exception because it is trying to load the ram disk image to memory out of range. My board has 128M of memory. Here is a snippet:
Yes, this is a consequence of the image overwriting itself.
Quoted 7 lines
I also have a question regarding tool chain. I am using uClibC's buildroot to build a compiler toolchain. At the moment, I am using gcc 3.4.2 and Linux 2.4.31. I tried using gcc 4.0.2 initially, but I had a problem with it trying to generate the proper code for building u-boot. It appears that u-boot is using register r29 as a global pointer and we had the following code in
./cpu/mpc8260/cpu_init.c:
Please use current U-Boot code, where such issues have been fixed.
Quoted 1 line
Is anyone using gcc 4.x to build? I reverted to gcc 3.4.2 just to
Yes, we do. ELDK 4.0 uses gcc-4.0, and this works fine.
Quoted 2 lines
Is there anyone doing embedded PPC development based on 2.6 kernel and gcc 4.x? I sure would like to hear your inputs.
ELDK-4.0 is based on a 2.6 kernel, and includes support for a couple of MPC82xx boards.
Quoted 1 line
Lastly, is there anyone working on a TIPC implementation in u-boot?
No. U-Boot isa boot loader, not an OS.
Best regards,
Wolfgang Denk
Signature · 8 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Software entities are more complex for their size than perhaps any
other human construct because no two parts are alike. If they are, we
make the two similar parts into a subroutine -- open or closed. In
this respect, software systems differ profoundly from computers,
buildings, or automobiles, where repeated elements abound.
- Fred Brooks, Jr.