Skip to contentSkip to conversation

kexec on mips failed

DISCUSSION wilbur.chan 3 participants 4 messages Aug 16, 2009 – Aug 28, 2009 MIPS

lore
Share & tools
lore
#0 lore raw

Hi,Nicolas,

I've got some problem with kexec on mips32...

in your code for kexec on mips32, there is a relocate_new_kernel function .

In the end of this function , it jump to kexec_start_address by 'j s1'

Because I changed the kexec-tools code ,in the hope that, it simplely passed the new kernel segment data into the old kernel.(so

I didn't pass the command-line segment in, in my code, there is just one segment , segment[0] = kernel_data).

So I need to change register s1 to the new kernel entry address, and jump to new kernel directly.

In my vmlinux, the entry is 0x802b0000,so I let image->start = 0x2b0000,and invoke relocate_new_kernel.

However, whether I changed kexec_start_address to 0x802b0000 or 0x2b0000 , the 'j s1' seemed taking no effect?

(I wrote 88 to address0xa1230000 before 'j s1' , it succedd .I also wrote 78 to address 0xa1230000 in the beginning

of head.S of the new kernel , but failed. And I reset the board to uboot mode, used 'md 0x802b0400' to display the new kernel

in ram, it is identical to the objdump content of the vmlinux. So I guess, this problem lays in the failing of 'j 0x802b0000'

or 'j 0x2b0000'. I don't know why 'j s1' failed , any suggestions
about this ? Thank you very much.

regads,

Wilbur

#1 lore raw

Hi,

Le Sunday 16 August 2009 18:20:56 wilbur.chan, vous avez écrit :

Quoted 25 lines

Hi,Nicolas,

I've got some problem with kexec on mips32...

in your code for kexec on mips32, there is a relocate_new_kernel function .

In the end of this function , it jump to kexec_start_address by 'j s1'

Because I changed the kexec-tools code ,in the hope that, it simplely passed the new kernel segment data into the old kernel.(so

I didn't pass the command-line segment in, in my code, there is just one segment , segment[0] = kernel_data).

So I need to change register s1 to the new kernel entry address, and jump to new kernel directly.

Quoted 6 lines

In my vmlinux, the entry is 0x802b0000,so I let image->start = 0x2b0000,and invoke relocate_new_kernel.

However, whether I changed kexec_start_address to 0x802b0000 or 0x2b0000 , the 'j s1' seemed taking no effect?

Should not you add a nop right after the j s1 in order to fill in the branch delay slot with an instruction which does nothing ?

Quoted 17 lines

(I wrote 88 to address0xa1230000 before 'j s1' , it succedd .I also wrote 78 to address 0xa1230000 in the beginning

of head.S of the new kernel , but failed. And I reset the board to uboot mode, used 'md 0x802b0400' to display the new kernel

in ram, it is identical to the objdump content of the vmlinux. So I guess, this problem lays in the failing of 'j 0x802b0000'

or 'j 0x2b0000'. I don't know why 'j s1' failed , any suggestions
about this ? Thank you very much.

regads,

Wilbur

Signature · 5 lines
Best regards, Florian Fainelli
Email: [email protected]
Web: http://openwrt.org
IRC: [florian] on irc.freenode.net
-------------------------------
#2 lore raw
Quoted 1 line · Florian Fainelli

Hi,

Hi,

Quoted 5 lines
Quoted 2 lines

However, whether I changed kexec_start_address to 0x802b0000 or 0x2b0000 , the 'j s1' seemed taking no effect?

Should not you add a nop right after the j s1 in order to fill in the branch delay slot with an instruction which does nothing ?

This should not be needed since have no ".set noreorder" in the file, so the assembler should add a nop in the delay slot, after "jr s1".

I have this on an objdumped relocate_kernel.o, so the assembler does add the nop:

[...]
000000a4 <done>:
a4: 02200008 jr s1
a8: 00000000 nop
[...]

Regards,

Signature · 1 line
Nicolas Schichan
#3 lore raw
In reply to wilbur.chan
Quoted 1 line · wilbur.chan

Hi,Nicolas,

Hi,

Quoted 11 lines

I've got some problem with kexec on mips32...

in your code for kexec on mips32, there is a relocate_new_kernel function .

In the end of this function , it jump to kexec_start_address by 'j s1'

Quoted 4 lines

Because I changed the kexec-tools code ,in the hope that, it simplely passed the new kernel segment data into the old kernel.(so I didn't pass the command-line segment in, in my code, there is just one segment , segment[0] = kernel_data).

I  do not know  what the  kexec userland  code does  regarding command
line,  but  the  relocate_kernel.S  code  does  not  take  any  action
regarding  command line passing  (as far  as I  know it  is bootloader

dependent).

Quoted 8 lines

So I need to change register s1 to the new kernel entry address, and jump to new kernel directly.

In my vmlinux, the entry is 0x802b0000,so I let image->start = 0x2b0000,and invoke relocate_new_kernel.

Normaly the userland and sys_kexec should do the right thing in setting image->start to the entry point set in the elf header of the vmlinux file.

Quoted 11 lines

However, whether I changed kexec_start_address to 0x802b0000 or 0x2b0000 , the 'j s1' seemed taking no effect?

(I wrote 88 to address0xa1230000 before 'j s1' , it succedd .I also wrote 78 to address 0xa1230000 in the beginning of head.S of the new kernel , but failed. And I reset the board to uboot mode, used 'md 0x802b0400' to display the new kernel

Quoted 4 lines

in ram, it is identical to the objdump content of the vmlinux. So I guess, this problem lays in the failing of 'j 0x802b0000' or 'j 0x2b0000'. I don't know why 'j s1' failed , any suggestions about this ? Thank you very much.

The relocation code should really jump to 0x802b0000 address, not the 0x002b0000 address, could you please check that the machine_kexec() function is invoked with image->start set to 0x802b0000 ?

The other failure causes I can think about right now are that the kernel for your board expects the bootloader to set some registers (for the command line for instance), and since the kexec code does not do this, the new kernel fails early.

Regards,

Signature · 1 line
Nicolas Schichan