Skip to contentSkip to conversation

A quick update

parisc-linux Alex deVries 3 participants 6 messages Jun 18, 1999 – Jun 21, 1999

lore
Share & tools
lore
#0 lore raw
Quoted 2 lines · John David Anglin

You probably want to use the same link options as Jason used for the IPL:
-N -R address.

Ah, okay.

Quoted 4 lines

After the kernel is built, take a look at where the sections start in SOM executable. Each section must be copied to its corresponding starting address in the LIF image. Space must be reserved for the bss data if there is a section after it that contains necessary data.

Should I be using objcopy to cut these sections out of my SOM executable and into the LIF image?

Two other problems I have:

1. The kernel doesn't build yet, it fails to link and dies with:

ld -e stext arch/parisc/kernel/head.o arch/parisc/kernel/init_task.o init/main.o init/version.o \
arch/parisc/kernel/kernel.o arch/parisc/mm/mm.o kernel/kernel.o

mm/mm.o fs/fs.o ipc/ipc.o \
        fs/filesystems.a \
        net/network.a \
        drivers/block/block.a drivers/char/char.a  drivers/net/net.a \
        /usr/src/linux/arch/parisc/lib/lib.a /usr/src/linux/lib/lib.a

/usr/src/linux/arch/parisc/lib/lib.a \
-o vmlinux
ld: Unsatisfied symbols:
swapper_pg_dir (data)
_stext (data)

I haven't yet figured out how to solve this.

2. The bootloader within the kernel tries to load the vmlinux into memory, but dies by returning -6 at the P0_BOOTDEV_iodc_io() call within bootdev_sread() in rom _interface.c. I should be able to figure out what's going on here...

- A

Signature · 3 lines
Alex deVries
Vice President of Engineering
The Puffin Group
#1 lore raw
Quoted 8 lines
Quoted 2 lines · John David Anglin

You probably want to use the same link options as Jason used for the IPL:
-N -R address.

Ah, okay.

Quoted 7 lines
Quoted 4 lines

After the kernel is built, take a look at where the sections start in SOM executable. Each section must be copied to its corresponding starting address in the LIF image. Space must be reserved for the bss data if there is a section after it that contains necessary data.

Should I be using objcopy to cut these sections out of my SOM executable and into the LIF image?

I don't think so. While I haven't checked all the options of objcopy, its basic function is to copy object modules from one file to another. If it understood the LIF format, it might work but I don't think it does. If I understand the situation, the LIF image gets loaded directly into memory. Thus, the code that builds the LIF image must simulate a loader, putting each section into it appropriate location in the image. You must assure when the kernel and ipl are linked that the relocation address of each section agrees with where it is placed in the LIF image so that all symbols are appropriately relocated. IPL doesn't do anything fancy. It looks like it just loads the kernel after itself into memory.

After linking, the executable files for the kernel and ipl each have a header that describe what kind object file they are. The header also has info about the sections in the executable. Ideally, the program that builds the LIF image would look at the headers in the ipl and kernel and build the LIF image. However, you can probably get away with using a simple program to copy the ipl and kernel files.

You must watch out for the size of the header on each file (file offset). The linker script for the ELF format kernel set the origin for .text to 0x8000. The corresponding option for the HP linker would be "-N -R 8000". When I do this, the file offset to the start of the $TEXT$ section (the first section in the file) is 0x28000. Thus, you want to copy starting from 0x28000 in vmlinux to 0x8000 in the LIF image.

The $BSS$ section is not in the executables since it loads as all zeros. However, since it is the last section in the executables you simply have to ensure that there is enough space between the kernel and ipl. You need enough space for the ipl bss data and its dynamically allocated stack.

Quoted 13 lines

Two other problems I have:

1. The kernel doesn't build yet, it fails to link and dies with:

ld -e stext arch/parisc/kernel/head.o arch/parisc/kernel/init_task.o init/main.o init/version.o \
arch/parisc/kernel/kernel.o arch/parisc/mm/mm.o kernel/kernel.o

mm/mm.o fs/fs.o ipc/ipc.o \
        fs/filesystems.a \
        net/network.a \
        drivers/block/block.a drivers/char/char.a  drivers/net/net.a \
        /usr/src/linux/arch/parisc/lib/lib.a /usr/src/linux/lib/lib.a
Quoted 5 lines

/usr/src/linux/arch/parisc/lib/lib.a \
-o vmlinux
ld: Unsatisfied symbols:
swapper_pg_dir (data)
_stext (data)

You want to export swapper_pg_dir in head.S. I think in init/main.c, you should change the declaration for _stext to "extern void _stext ();" and "&_stext" to "_stext". The linker thinks _stext is a reference to data rather than text. The other option would be to put the address label _stext into a an exported word in the data section of head.S. Main.c could then determine the start of text from this location.

Dave

Signature · 2 lines
J. David Anglin                                  [email protected]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)
#2 lore raw
Quoted 8 lines · John David Anglin

After linking, the executable files for the kernel and ipl each have a header that describe what kind object file they are. The header also has info about the sections in the executable. Ideally, the program that builds the LIF image would look at the headers in the ipl and kernel and build the LIF image. However, you can probably get away with using a simple program to copy the ipl and kernel files.

That all exists in the tools in linux/arch/parisc/hp/boot/boot_tools.

Quoted 8 lines

You must watch out for the size of the header on each file (file offset). The linker script for the ELF format kernel set the origin for .text to 0x8000. The corresponding option for the HP linker would be "-N -R 8000". When I do this, the file offset to the start of the $TEXT$ section (the first section in the file) is 0x28000. Thus, you want to copy starting from 0x28000 in vmlinux to 0x8000 in the LIF image.

Oh, okay. The linker stuff has all been sorted out (and is in CVS now).

So, here's how you can boot this bootloader:
- on HPUX, install gnu gcc and binutils
- check out the latest kernel tree
- do a 'make config ; make dep ; make vmlinux; make Image'
- boot linux/arch/parisc/hp/boot/Image

It should boot and end with:

Loading kernel...done.
Transferring control to the kernel. (At entry point 0x00008000)

and then hang completely.

The next step is to develop a small mini kernel that we can use to test the launching. It should just print "Hello world" to the screen using IODC. There's lots of example code in the bootloader, so this should be pretty simple.

- Alex "white water rafting this weekend, far away from PA RISC equipment" deVries

Signature · 3 lines
Alex deVries
Vice President of Engineering
The Puffin Group
#3 lore raw

[parisc-linux] Problems with createheader.sh script

When creating a LIF image, i get the following errors:

./boot_tools/createheader.sh boot_code/ipl ../../../../vmlinux ./boot_tools/createheader.sh: !: not found ./boot_tools/createheader.sh: !: not found (standard_in) 1: illegal character: J
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: illegal character: J
IPL address: 4096 kernel address: 49152
IPL size: 45056 Jun kernel size:
IPL entry: 4096 kernel entry: 32768
Header created.

I think the problem is lies with the cut command. The character position of file sizes in the 'ls -l' command varies. The hpux 9.01 ls position differs from that of GNU ls. I think it would be better to use awk to grab the file size info.

Signature · 2 lines
J. David Anglin                                  [email protected]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)
#4 lore raw

Re: [parisc-linux] Problems with createheader.sh script

Quoted 15 lines

When creating a LIF image, i get the following errors:

./boot_tools/createheader.sh boot_code/ipl ../../../../vmlinux ./boot_tools/createheader.sh: !: not found ./boot_tools/createheader.sh: !: not found (standard_in) 1: illegal character: J
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: illegal character: J
IPL address: 4096 kernel address: 49152
IPL size: 45056 Jun kernel size:
IPL entry: 4096 kernel entry: 32768
Header created.

Here is a patch which fixes the above problems. Note--there are still issues related to the kernel parameters which need to be resolved.

I also recommend stripping the kernel after the map is generated to reduce the size of the Image.

Signature · 75 lines
J. David Anglin                                  [email protected]
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)

*** createheader.sh.orig	Fri Jun 18 09:09:53 1999
--- createheader.sh	Mon Jun 21 14:26:19 1999
***************
*** 12,38 ****
  
  if [ $# != 2 ]; then
  	echo "Usage: createheader.sh ipl vmlinux"
  fi
  
! if ! [ -e ${ipl} ]; then
  	echo "Cannot open ${ipl}"
          exit 1
  fi
  
! if ! [ -e ${vmlinux} ]; then
  	echo "Cannot open ${vmlinux}"
          exit 1
  fi
  
  i_addr=4096
  
! if [ $arch = Linux ] ; then
! 	i_size=`ls -l ${ipl} |cut -c 36-42`
! 	k_size_initial=`ls -l ${vmlinux} |cut -c 36-42`
! elif [ $arch = HP-UX ]; then
!         i_size=`ls -l ${ipl} |cut -c 36-45`
! 	k_size_initial=`ls -l ${vmlinux} |cut -c 36-45`
! fi
  
  i_entry=4096
  k_addr=49152
--- 12,34 ----
  
  if [ $# != 2 ]; then
  	echo "Usage: createheader.sh ipl vmlinux"
+         exit 1
  fi
  
! if [ ! -r ${ipl} ]; then
  	echo "Cannot open ${ipl}"
          exit 1
  fi
  
! if [ ! -r ${vmlinux} ]; then
  	echo "Cannot open ${vmlinux}"
          exit 1
  fi
  
  i_addr=4096
  
! i_size=`ls -l ${ipl} |awk '{print $5}'`
! k_size_initial=`ls -l ${vmlinux} |awk '{print $5}'`
  
  i_entry=4096
  k_addr=49152
***************
*** 41,47 ****
  k_entry=32768
  
  echo "IPL address: ${i_addr}\tkernel address: ${k_addr} "
! echo "IPL size: ${i_size}\tkernel size: ${k_size} "
  echo "IPL entry: ${i_entry} \tkernel entry: ${k_entry}"
  ./boot_tools/mklifhdr hdr ${i_addr} ${i_size} ${i_entry} \
     ${k_addr} ${k_size} ${k_entry}
--- 37,43 ----
  k_entry=32768
  
  echo "IPL address: ${i_addr}\tkernel address: ${k_addr} "
! echo "IPL size: ${i_size}\t\tkernel size: ${k_size} "
  echo "IPL entry: ${i_entry} \tkernel entry: ${k_entry}"
  ./boot_tools/mklifhdr hdr ${i_addr} ${i_size} ${i_entry} \
     ${k_addr} ${k_size} ${k_entry}
#5 lore raw
In reply to Alex deVries

In message <[email protected]>you write:

Quoted 2 lines

Should I be using objcopy to cut these sections out of my SOM executable and into the LIF image?

No, I doubt objcopy knows about LIF (I've certainly never bothered to describe LIF to objcopy/bfd).

Utah's releases had code to do this kind of thing. Or you might be able to use the lif tools on hpux (ls /usr/bin/lif*).

jeff