|
|
|
|
Project 1 Setup: VM-For-Everything Instructions
You can use the course VM to do all parts of this assignment.
Using the VM for everything has the advantage that you have root access on it.
If something goes wrong in you shell (in particular, a fork bomb), you can
reboot the machine, and don't have to wait for support to unwedge your account.
Also, installing your hacked kernel is a bit simpler, because you build on the
machine where you install it.
The VM used for this is the same one you use if you primarily use forkbomb
for this assignment. The main, and important, difference is that you probably
don't have 12GB of private disk space on CSE systems, so can't keep a permanent
copy of the VM on CSE machines.
Instead, you have to re-fetch and re-untar the VM each time you want
to test a new kernel, a non-trivial overhead.
By using your own system to host the VM, your VM is persistent, and you
avoid that overhead. Plus, you can work exclusively on the VM; you don't have
to move files from the build machine to the VM to test.
Getting the Virtual Machine
It's /cse/courses/cse451/11sp/FC13-CSE451-2011-04-09.tar.gz, from most any
CSE machine: 4.2GB to fetch; 12GB expanded.
Depending on your connection speed, it might be easiest to fetch it while at CSE, either to
your portable machine or to your portable flash drive.
Security
In the next section we give you usernames and passwords. Anyone in the world can read this page.
It's a good idea not to let your VM be accessible from anywhere in the world.
The VM is configured to allow host-only networking,
meaning it can communicate only with the
host machine it's running on. I recommend you not change that, for security reasons.
You can ssh, scp, etc. to/from the VM from the machine it's running on, and to/from there
to anywhere else you might need.
What's on the virtual machine?
- User Accounts
- 451user / 451userpassword
The account most of your work takes place under. You can gain privilege (become root)
to execute a single command by sudo cmd. You can become root until you ctrl-d
by sudo -s.
- root / rootpassword
Enough said.
- forkuser / forkuserpassword
A spare user account, for emergency use.
This account can sudo, so can do root-y things.
- Files
- ~451user/project1
Where your work should go.
- ~451user/project1/kernel/linux-2.6.38.2
Contains the kernel source, ready for re-building.
- /boot/vmlinuz-2.6.38.2-CSE451
Your installed kernel. The VM boots this kernel by default.
The one the VM comes with is basically an unadulterated build of the 2.6.38.2 kernel source.
Once you modify and install the kernel, it's possible you won't be able to boot this kernel.
If that happens, choose one of the others offered during boot. The machine should come up, and
your files will be accessible.
Compiling, Installing, and Running Your Kernel
- Navigate to ~451user/project1/kernel/linux-2.6.38.2
- Say make -j 2 bzImage to compile.
- If everything goes well and you want to try installing, say sudo make install
- If that goes well, reboot to run your kernel: sudo reboot.
Notes about Kernel Development
- Code carefully. Your changes are difficult to debug because you have to reboot to test them.
- Debugging kernel code is difficult. You can use printk() calls in your code.
This is the kernel equivalent of printf().
- To read the results of printk, you need to look at the system log.
You can do this with the
dmesg command.
dmesg prints a lot of output. You can make this more manageable by printing only the last 10 lines or so: dmesg | tail -n 10
References
- The 451 VM is derived from the CSE Home Linux VM
|