8. System kopieren
Das System SLACK_LNX kann nun auf den Compact Flash Speicher kopiert werden.
Dafür müssen die Bootparameter angepasst werden, da das Root
Filesystem des Zielrechners auf der Partition hda1 liegt und nicht auf hda5.
Zum Kopieren werden ein Compact Flash Adapter und eine Compact Flash Karte
benötigt. Im vorliegenden Projekt wurde als Entwicklungsrechner ein
Notebook verwendet, so dass ein PCMCIA-zu-CF Adapter zu beschaffen war.
Den Compact Flash Adapter mit eingesetzter CF-Karte auf dem Rechner DEVBOX
installieren, booten und zwei Verzeichnisse anlegen, /flash und
/slack_lnx .
# mkdir /flash
# mkdir /slack_lnx
|
|
Der Flash Speicher wird vom Betriebssystem automatisch erkannt. Er sollte als
/dev/hdc1 angezeigt werden. Überprüfen mit:
CF-Karten sind standardmässig mit FAT12 oder mit FAT16 formatiert,
also mit DOS. cfdisk starten und ein Linux Filesystem anlegen.
Zuerst eine Partitionstabelle für /dev/hdc anlegen.
Die Parameter für die Partition lauten: «Primary, bootable,
type 83 Linux». Bei einer 256 MB CF-Karte sollte
/dev/hdc die folgenden Werte zeigen:
Device Boot Start End Blocks Id System
/dev/hdc1 * 1 984 251888 83 Linux
|
|
/dev/hdc mit ext2 formatieren.
Die Compact Flash Karte und das System SLACK_LNX mounten.
# mount -t ext2 /dev/hdc1 /flash
# mount -t ext2 /dev/hda5 /slack_lnx
|
|
SLACK_LNX auf den CF-Speicher kopieren (-d = Links nicht dereferenzieren,
-p = preserve mode, Ownerships beibehalten, -r = rekursiv kopieren):
# cp -dpr /slack_lnx/* /flash/
|
|
Die Datei /flash/etc/fstab anpassen, die folgenden
Einträge sind nötig:
/dev/hda1 / ext2 defaults 1 1
proc /proc proc defaults 0 0
|
|
Schliesslich muss der Bootmanager des Routers angepasst werden. (Es kann sich auszahlen,
den mbr des Hostsystems DEVBOX zu sichern, bevor dieser Schritt ausgeführt wird!)
Falls Lilo verwendet wird, die Datei /flash/etc/lilo.conf wie folgt editieren:
## Start LILO global section
##
# WARNING
# Make sure the following two lines are NOT commented out when running lilo on your
# development machine, else you may be writing into an mbr you'd rather not have touched!
#
# You will have to comment these two entries out after the first boot of the target system.
boot=/dev/hdc # Where lilo installs its boot block.
disk=/dev/hdc bios=0x80 # Overrides the BIOS' harddisk order
# (tells the BIOS that hdc will later be hda).
# Value to use on the router.
#boot=/dev/hda
map=/boot/map
install=text
default=linux
lba32
read-only
prompt
timeout=40
##
## LILO bootable partition config
##
image=/boot/linux
label=linux
root=/dev/hda1
ramdisk=4096
## For platforms without video card use
## append = "console=ttyS0,9600n8r"
## To enable virtual terminal and serial port use
append="console=tty0 console=ttyS0,9600n8r"
|
|
LILO updaten (-C = das Lesen des definierten Konfigurationsfiles erzwingen,
-r = Rootdirectory).
# /flash/sbin/lilo -v -r /flash/ -C etc/lilo.conf
|
|
Im Erfolgsfall erscheint die Meldung:
Falls GRUB als Bootmanager verwendet wird, muss /boot/grub/menu.lst
wie folgt editiert werden.
## /boot/grub/menu.lst
##
color white/blue black/light-gray
default 0
timeout 4
## Define serial port ttyS0
serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
## Define your terminals
terminal serial
## GRUB bootable partitions
title Slackware on sda1
root (hd0,0)
kernel /boot/linux root=/dev/sda1 ro vga=normal console=tty0 console=ttyS0,9600n8
|
|
GRUB mit dem folgenden Kommando installieren:
/usr/local/sbin/grub-install --root-directory=/flash /dev/hdc
|
|
/dev/hdc bezeichent das Device, in dessen MBR Grub installiert werden soll.
/boot/grub/device.map muss den Eintrag (hd0) /dev/hda enthalten,
damit das System bootet.
(Falls die Meldung erscheint: «/dev/hdc does not have any corresponding BIOS
drive», zuerst /boot/grub/device.map löschen.)
Sicherstellen, dass der Router eigene SSH Keys erhält. Dazu eventuell mit-kopierte
Keyfiles im Verzeichnis /flash/etc/ssh/ löschen. Unter der
Voraussetzung, dass das Binary /flash/usr/bin/ssh-keygen auf dem
Router installiert ist, werden beim ersten Booten des Routers neue SSH Keys
generiert.
|