Some questions about sh-lilo

Fabio Giovagnini <[email protected]> Wed, 27 Oct 2004 10:44:58 +0000
Newsgroups gmane.linux.ports.sh.devel,gmane.linux.ports.sh.general
Organization Walbro Italy
Message-ID <[email protected]>
Hi All, I have some question about sh-lilo and sh-ip+g

1) How to set the sh-lilo offset address
for now I'm using a resident bood loder of my board; so I load directly in ram 
sh-ipl+g for booting using b. My sh-ipl+g is configured like following:

#define CONFIG_LITTLE_ENDIAN	1
#define CONFIG_LSH7760_10		1
#define CONFIG_SCIF		1
#define CONFIG_IDE			1 // ide
#define CONFIG_DIRECT_COMPACT_FLASH		1 // ide
#define CONFIG_MEMORY_SIZE	0x02000000
#define CONFIG_ROM_START	0xac0c0000
#define CONFIG_ROM_LENGTH	0x8000
#define CONFIG_RAM_START	0xac0c8000
#define CONFIG_RAM_BOOT		(CONFIG_RAM_START+0x200000)
#define CONFIG_IO_BASE		0xa4200000


if I understand good, in boot() function of sh-ipl+g I read:
static void
boot (void)
{
  register long __sc0 __asm__ ("r0") = 2; /* READ SECTORS */
  register long __sc4 __asm__ ("r4") = (long) 0;
  register long __sc5 __asm__ ("r5") = (long) 0;
  register long __sc6 __asm__ ("r6") = (long) CONFIG_RAM_BOOT;
  register long __sc7 __asm__ ("r7") = (long) 1;

  putString ("Enter boot()...\n");
  asm volatile  ("trapa	#0x3F"
		 : "=z" (__sc0)
		 : "0" (__sc0), "r" (__sc4), "r" (__sc5), "r" (__sc6), 
		   "r" (__sc7)
		 : "memory");

  if (__sc0 < 0)
    putString ("MBR read error\n");
  else {
    //putString ((char*)CONFIG_RAM_BOOT);
    asm volatile ("jmp @r0; nop"
		  : : "z" (CONFIG_RAM_BOOT));
	}
}

so I read the first sector of my cf compact flash to CONFIG_RAM_BOOT ram area 
and I jump to such an address. In my case CONFIG_RAM_BOOT = 0xac2c8000.
When I compile sh-lilo I read:

sh4-linux-gcc -I. -O2 -g -ml -m3 -pipe -traditional -c first.S
sh4-linux-ld -EL -e start first.o -o first.exe -Ttext 0x8c200000
sh4-linux-objcopy -S first.exe -O binary first.bin
sh4-linux-gcc -I. -O2 -g -ml -m3 -Wall -pipe -fpic -c second.c
sh4-linux-gcc -I. -O2 -g -ml -m3 -Wall -pipe -fpic -c string.c
sh4-linux-ld -T second.lds -EL second.o string.o -o second.exe -Ttext 
0x8c201000
sh4-linux-objcopy -R .comment -S second.exe -O binary second.bin
cat first.bin second.bin >boot.b

How can I execute code likned to be executed at 0x8c200000 if I move it 
at0xac2c8000?


2) target lilo.conf file
I'm using the target lilo.conf file:

linear
boot=/dev/hde
disk=/dev/hde
	bios=0x80
vga=normal
delay=30
image=/boot/zImage
install=/boot/boot.b
	label=2.6.8-sh
	root=/dev/hda1
	read-only
	append="console=ttySC1,115200"

and the following target /dev directory:
# ls -l
lrwxrwxrwx    1 root     root            6 ott 13 19:24 console -> ttySC1
brw-r--r--    1 root     root       3,   0 ott 26 23:20 hda
brw-r--r--    1 root     root       3,   1 ott 26 23:20 hda1
brw-r--r--    1 root     root      33,   0 ott 26 23:13 hde
brw-r--r--    1 root     root      33,   1 ott 26 23:13 hde1
crw-r--r--    1 root     root       1,   1 ott  8 17:04 mem
crw-r--r--    1 root     root       1,   3 ott  8 17:05 null
brw-r--r--    1 root     root       1,   0 ott  8 17:06 ram0
brw-r--r--    1 root     root       1,   1 ott  8 17:06 ram1
crw-r--r--    1 root     root     204,   8 ott  8 17:07 ttyS0
crw-r--r--    1 root     root     204,   9 ott  8 17:07 ttyS1
crw-r--r--    1 root     root     204,  10 ott  8 17:08 ttyS2
crw-r--r--    1 root     root     204,   8 ott 13 19:08 ttySC0
crw-r--r--    1 root     root     204,   9 ott 13 19:08 ttySC1
crw-r--r--    1 root     root     204,  10 ott 13 19:09 ttySC2
crw-r--r--    1 root     root       1,   5 ott  8 17:05 zero

I'm using lilo:
# lilo -V
LILO version 22.4.1

I'm mounting /dev/hde1 (my cf) under /mnt/cf
so when I execute 
lilo -r /mnt/cf
I have a warning message about linear line and successfull lilo installation 
regardless in /mnt/cf/boot I previusly copied boot.b or not. The result is 
always the production by lilo in /mnt/cf/boot of a file called boot.2100 and 
a file called map. Why this?
Obviusly the board do not boot.


Thanks a lot

Fabio


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click