リトライ

ええとイチからヤッてみます。以下のエントリを参考にしつつ。

とりあえず

カーネルから作り直し。ARCH と CROSS_COMPILE を環境変数にしておられます。

$ ARCH=arm; export ARCH
$ CROSS_COMPILE=~/Documents/Android/Embedded-Master-ARM/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- ; export CROSS_COMPILE
$ make clean
$ make versatile_defconfig
$ make menuconfig
$ make

versatile_defconfig って何でしょorz

Android の make はそのまんま実行してみます。パッチは略で。

$ TARGET_ARCH_VARIANT=armv5te-vfp ; export TARGET_ARCH_VARIANT
$ WITH_JIT=true ; export WITH_JIT
$ make clean
$ time make -j4 2>&1 |tee make.log

微妙に書いてある事と違うんですが良いのかなぁ。と思ったらカーネルのディレクトリだったよorz
二つ上に戻ってリトライ。

$ make clean
$ source ./build/envsetup.sh
$ choosecombo 1 1 beagleboard 3

Unknown ARM architecture version と叱られた。build/core/combo/linux-arm.mk の中身を確認。デフォだと armv5te が TARGET_ARCH_VARIANT に代入されている模様。
なので

$ TARGET_ARCH_VARIANT= ; export TARGET_ARCH_VARIANT
$ time make -j4 2>&1 |tee make.log

でどうか。とりあえず kickoff は正常になんとかなってるみたいに見えます。

エラー出た

とほほ。

more undefined references to `gDvmJit' follow

との事なんですがこれは一体何だ、と言いつつリトライ。

$ time make -j4 showcommands 2>&1 |tee make.log

なんか動いてるんだけど、何だこれ。って思ったら同じトコで止まりましたな。
ええと WITH_JIT をクリアしてみます。

$ WITH_JIT= ; export WITH_JIT
$ time make -j4 showcommands 2>&1 |tee make.log

どうかいな。てーか、変数の意味を理解せずに使ってるのがバレバレだよ。

正常終了

とほほ。しかも time の結果が以下だし。

real    12m22.301s
user    5m17.400s
sys     0m23.410s
$

とりあえず出てきたソレを qemu に吸わせてみます。

$ qemu-system-arm -M versatilepb -m 256 \
 -kernel kernel/beagleboard/arch/arm/boot/zImage \
 -initrd out/target/product/beagleboard/ramdisk.img \
 -hda out/target/product/beagleboard/system.img \
 -append "root=/dev/sda1"

panic った。

Freeing init memory: 104K
Kernel panic - not syncing: Attempted to kill init!

メセジによれば init なセクションは出ている模様。以下か。

kernel/beagleboard/kernel/exit.c:                       panic("Attempted to kill init!");

とほほ。
以下な手続きな模様。

/*
 * When we die, we re-parent all our children.
 * Try to give them to another thread in our thread
 * group, and if no such member exists, give it to
 * the child reaper process (ie "init") in our pid
 * space.
 */
static struct task_struct *find_new_reaper(struct task_struct *father)
{
	struct pid_namespace *pid_ns = task_active_pid_ns(father);
	struct task_struct *thread;

	thread = father;
	while_each_thread(father, thread) {
		if (thread->flags & PF_EXITING)
			continue;
		if (unlikely(pid_ns->child_reaper == father))
			pid_ns->child_reaper = thread;
		return thread;
	}

	if (unlikely(pid_ns->child_reaper == father)) {
		write_unlock_irq(&tasklist_lock);
		if (unlikely(pid_ns == &init_pid_ns))
			panic("Attempted to kill init!");

find_new_reaper() 手続き呼び出しは exit.c の forgot_original_parent() らしい。

static void forget_original_parent(struct task_struct *father)
{
	struct task_struct *p, *n, *reaper;
	LIST_HEAD(ptrace_dead);

	write_lock_irq(&tasklist_lock);
	reaper = find_new_reaper(father);

ではその上は? てかこいつも static な関数なので同じファイルだな。exit_notify() 手続きか。

/*
 * Send signals to all our closest relatives so that they know
 * to properly mourn us..
 */
static void exit_notify(struct task_struct *tsk, int group_dead)
{
	int signal;
	void *cookie;

	/*
	 * This does two things:
	 *
  	 * A.  Make init inherit all the child processes
	 * B.  Check to see if any process groups have become orphaned
	 *	as a result of our exiting, and if they have any stopped
	 *	jobs, send them a SIGHUP and then a SIGCONT.  (POSIX 3.2.2.2)
	 */
	forget_original_parent(tsk);

で、この exit_notify() は do_exit() から呼び出されてます。やれやれ、exit 途中で死んでるんかな。

起動時に

initrd 指定しなかったら以下なメセジで panic。

VFS: Cannot open root device "1f03" or unknown-block(31,3)
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3)

では -append "root=/dev/sda1" を付けてみたらどうなるか。

Root-NFS: No NFS server available giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "sda1" or unknown-block(2,0)
Please append a correct "root=" boot option; here are the available partitions:
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

むむ。-append 取って -initrd 付けたらどうか。ってこれは最初のソレに戻りましたな。これってそもそも Android の make で出力されたナニが何なのか、についての理解ができてないからこーゆー事になるんだよな。
ちょっと諸々確認入れます。