2003-03-20 22:46:43

by ravikumar.chakaravarthy

[permalink] [raw]
Subject: RE: Loading and executing kernel from a non-standard address usin g SY SLINUX

I tweaked the SYSLINUX boot loader and kernel to load and execute the kernel from 0x200000 (physical address). However when I try to load the kernel using the SYSLINUX bootloader to an address 0xdf000000(physical address) it doesn't work!!
I want to know if the following should work.

1. Should the syslinux be able to copy to the address DI=(0xdf000000). I think bcopy function in (SYSLINUX sources) does this.. Though the bcopy is done in the 32-bit mode, SOMETIMES it fails for this physical address). bcopy is called in runkernel.inc.
2. Will I have any problem in the setup.S code in arch/i386/boot or head.S in arch/i386/boot/compressed because of this copy to 0xdf000000?? At times when it gets past step 1, it fails in malloc in arch/i386/boot/compressed/misc.c. The error it gives in "Memory Error"


Following is a list of changes I made to the SYSLINUX and kernel code to get it working for 0x200000.
---------------------------------------------------------------------
#Number preceded by ":" in the following lines represent the line number. I #am using 2.4.20 source
(Syslinux)
1. runkernel.inc:
250: sub eax,0x200000
263: mov edi,0x200000

(linux kernel)
1. arch/i386/boot/setup.S
126: .long 0x200000 # 0x200000 = default for big kernel
813: code32: .long 0x2000 # will be set to 0x200000

2. arch/i386/boot/compressed/head.S
102: movl $0x200000,%edi
127: ljmp $(__KERNEL_CS), $0xdf000000

3. arch/i386/boot/compressed/Makefile
19: BZIMAGE_OFFSET = 0x200000

4. arch/i386/vmlinux.lds
9: . = 0x01000000 + 0x200000;

5. arch/i386/kernel/setup.c
345: static struct resource code_resource = { "Kernel code", 0x200000, 0 };

6. arch/i386/kernel/head.S
ENTRY(swapper_pg_dir)
.long 0x202007
.long 0x203007
.fill BOOT_USER_PGD_PTRS-2,4,0
/* default: 766 entries */
.long 0x202007
.long 0x203007
/* default: 254 entries */
.fill BOOT_KERNEL_PGD_PTRS-2,4,0




Thanks in advance
-Ravi

-----Original Message-----
From: H. Peter Anvin [mailto:[email protected]]
Sent: Tuesday, March 04, 2003 5:00 PM
To: [email protected]
Subject: Re: Loading and executing kernel from a non-standard address using SY SLINUX

Followup to: <[email protected]>
By author: [email protected]
In newsgroup: linux.dev.kernel
>
> I am trying to load and boot the kernel from a non-standard address
> (0x200000). I am using the SYSLINUX boot loader, which loads the
> kernel at that address. I have also made changes to the kernel to
> setup code and startup_32() function to effect the same. When I boot
> the system It says
>

Modified, perhaps. Stock SYSLINUX loads at the standard address
(0x100000).

-hpa
--
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64


2003-03-20 22:57:00

by H. Peter Anvin

[permalink] [raw]
Subject: Re: Loading and executing kernel from a non-standard address usin g SY SLINUX

[email protected] wrote:
> I tweaked the SYSLINUX boot loader and kernel to load and execute the kernel from 0x200000 (physical address). However when I try to load the kernel using the SYSLINUX bootloader to an address 0xdf000000(physical address) it doesn't work!!
> I want to know if the following should work.
>
> 1. Should the syslinux be able to copy to the address DI=(0xdf000000). I think bcopy function in (SYSLINUX sources) does this.. Though the bcopy is done in the 32-bit mode, SOMETIMES it fails for this physical address). bcopy is called in runkernel.inc.

Yes.

> 2. Will I have any problem in the setup.S code in arch/i386/boot or head.S in arch/i386/boot/compressed because of this copy to 0xdf000000?? At times when it gets past step 1, it fails in malloc in arch/i386/boot/compressed/misc.c. The error it gives in "Memory Error"

Almost certainly.

-hpa