Hi, My 1st try at a kernel change (fwd)

anachron (anachron@tbe.net)
Wed, 4 Mar 1998 12:23:16 -0500 (EST)


---------- Forwarded message ----------
Date: Wed, 4 Mar 1998 12:20:15 -0500 (EST)
From: anachron <anachron@tbe.net>
To: linux-kernel@vger.ruthers.edu
Cc: anachron@tbe.net
Subject: Hi, My 1st try at a kernel change

Hi, this is my first time at a kernel change.
I got stumped so I am asking for some pointers.

what I have:
linux 2.0.33 (redhat - upgraded)
/dev/hda2 as root
/dev/hdb2 as other
hdb2 has copies of all the files that hda2 has

what I want to do:
** switch the root (/) drive from hda2 to hdb2 without initrd!
let me explain: :)
1) I am in runlevel 3
2) I do an init 1
3) at single user mode I unmounted everything except the root and /proc
4) i revised the kernel so that I could do a chroot2 (explained in
detail later on)
5) after the "chroot2" /proc/mounts said the following
none /proc proc rw 0 0
none none ext2 ro 0 0

the second line is "i believe to be hdb2"
if I do a "ls" the system still thinks hda2 is root. :(

What is chroot2?
================

My inspiration for my kernel change came from
fs/super.c

in that file there is a function change_root. I copied that code and
called it chroot2. I made it an asmlinkage instead of int.
What is asmlinkage????

I then made a C program that would do a system call to the new
asmlinkage chroot2.

I ran that C program in runlevel 1.
While running It said some interesting stuff, like this:

VFS: root device prepare for armageddon
VFS: mounted root ext2 filesystem readonly

Much kudos belongs to the people reading this. With your help
(KHG) i was able to do this!

My guess at what is going on:
=============================
1) my c program is doing a successful system call to chroot2
2) chroot2 is running
3) chroot is calling functions put_super and do_mount_root
4) The "root change" was a failure because I did not do something
correctly with VFS or the "disk read buffers"

What I would like:
==================
any tips on the kernel (ie what to read)
(I spend a lot of time reading the KHG)
Someone who will to spend a little time discussing the kernel and giving
me pointers on how to do this. I could send you a copy of my
revised super.c

If you help me out, I'd be glad to do some coding for you. :)

What I am weak on:
==================
1) VFS how it works
2) the disk read buffers
3) what is the structure "current"?

Thank you for your valueable time reading this.
Linux is fantasic. You are doing an excellent job.

Jim
anachron@tbe.net

PS please reply via e-mail

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu