Наши друзья и партнеры


Книги по Linux (с отзывами читателей)

Библиотека сайта rus-linux.net

4.4. Implementation

We will need to have a read-write filesystem in order for some of the commands to work. The kernel's normal behavior is to mount root as read-only, but we can change this using a kernel option. By passing the kernel the rw option before init=/bin/sh we will get a read-write root filesystem.

4.4.1. System startup

Follow these steps to get the system running.

  • Boot the PC from using the GRUB boot disk.

  • At the grub> prompt, type kernel (fd0)/boot/vmlinuz rw init=/bin/sh root=/dev/fd0 load_ramdisk=1 prompt_ramdisk=1.

  • Verify that you remembered to add the rw parameter and press Enter.

  • Type boot and press Enter.

  • Insert the recently created root disk when prompted.

The terminal display should look similar to the example below.

GNU GRUB version 0.95

grub> kernel (fd0)/boot/vmlinuz rw init=/bin/sh root=/dev/fd0 load_ramdisk=1 prompt_ramdisk=1
   [Linux-bzImage, setup=0xc00, size=0xce29b]

grub> boot

Linux version 2.4.26
.. [various kernel messages]
VFS: Insert root floppy disk to be loaded into RAM disk and press ENTER
RAMDISK: Compressed image found at block 0
VFS: Mounted root (ext2 filesystem) read-write.
Freeing unused kernel memory: 178k freed
# _

4.4.2. Testing new commands

Now that the system is up and running, try using some of the new commands.

bash# uname -a
bash# ls /etc
bash# echo "PocketLinux" > /etc/hostname
bash# hostname $(cat /etc/hostname)
bash# uname -n
bash# mkdir /home/stuff
bash# cd /home/stuff

If everything goes well the commands like cat, ls and hostname should work now. Even mkdir should work since the root filesystem is mounted read-write. Of course since we are using a ramdisk, any changes will be lost once the PC is reset.

4.4.3. System shutdown

Remove the diskette from fd0 and restart the system using CTRL-ALT-DELETE.