Problem with init call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hi,

I have a pxa270 based board, and I would like to renew the system on it...

I am using the emdebian's stable gnueabi cross-toolchain.
I have already recompile the kernel (both latest stable (2.6.28.7) and testing (2.6.29-rc8)) and it works (boot up) now...
I make a single init code:
devel:/opt/rootfs# cat test_init.c
#include <stdio.h>

int main()
{
  printf("Hello world!\n");
  while(1);
  return 0;
}

I compiled it with the toolchain to static and move it to the ${nfsserver}/root/sbin/init place

But when I got this error message when I trying to boot:

Looking up port of RPC 100003/2 on 10.10.10.1
Looking up port of RPC 100005/1 on 10.10.10.1
VFS: Mounted root (nfs filesystem) on device 0:11.
Freeing init memory: 96K
Warning: unable to open an initial console.
Kernel panic - not syncing: Attempted to kill init!


(I have console= in the kernel params so I ignore the warning message...)
I put some printk to the arch/arm/kernel/sys_arm.c's kernel_execve function to see where is the problem:
int kernel_execve(const char *filename, char *const argv[], char *const envp[])
{
	struct pt_regs regs;
	int ret;

	printk("Before memset.\n");
	memset(&regs, 0, sizeof(struct pt_regs));
	printk("After memset, before do_execve.\n");
	ret = do_execve((char *)filename, (char __user * __user *)argv,
			(char __user * __user *)envp, &regs);
	printk("After do_execve, return value: %d\n",ret);
	if (ret < 0)
		goto out;
	/*
	 * Save argc to the register structure for userspace.
	 */
	regs.ARM_r0 = ret;

	/*
	 * We were successful.  We won't be returning to our caller, but
	 * instead to user space by manipulating the kernel stack.
	 */
	printk("Before asm code.\n");
	asm(<-->"add<-->r0, %0, %1\n\t"
		"mov<-->r1, %2\n\t"
		"mov<-->r2, %3\n\t"
		"bl<--->memmove\n\t"<-->/* copy regs to top of stack */
		"mov<-->r8, #0\n\t"<--->/* not a syscall */
		"mov<-->r9, %0\n\t"<--->/* thread structure */
		"mov<-->sp, r0\n\t"<--->/* reposition stack pointer */
		"b<---->ret_to_user"
		:
		: "r" (current_thread_info()),
		  "Ir" (THREAD_START_SP - sizeof(regs)),
		  "r" (&regs),
		  "Ir" (sizeof(regs))
		: "r0", "r1", "r2", "r3", "ip", "lr", "memory");
	printk("After asm code.\n");
 out:
	return ret;
}


And I got this output at boot:
Freeing init memory: 96K
Warning: unable to open an initial console.
Before memset.
After memset, before do_execve.
After do_execve, return value: 0
Before asm code.
Kernel panic - not syncing: Attempted to kill init!



It looks like when it use the asm code, it crash (no "After asm code." message)...

Any Idea what am I doing wrong?

regards,
Balázs Zachár











-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php


[Linux ARM]     [Linux ARM MSM]     [Linux ARM Kernel]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

Add to Google Follow linuxarm on Twitter