|
I-RT04 REALZEITSYSTEME WS04
|
Ziel dieser Übungen ist es, möglichst schnell ein Verständnis für die praktische Generierung von Realzeitsystemen zu bekommen um so die Voraussetzungen zu schaffen, eigene Modelle gezielt implementieren zu können.
Ziel der heutigen Übung ist es, zunächst das Entwicklungswerkzeug ELinOS der Firma Sysgo AG nutzen zu lernen, ohne dass schon alle technischen und theoretischen Hintergründe geklärt sind; dies erfolgt parallel in der Vorlesung.
Für die ersten Beispiele wird ferner angenommen, dass diese Systeme per Diskette gebootet werden sollen. Die Libraries für Intel- und PowerPC-Plattformen stehen zur Verfügung. Wir werden zunächst nur die Intel-Plattformen berücksichtigen. Damit kann jeder das selbst erzeugte Betriebssystem auf jedem Intel-PC ausprobieren bzw. auf dem Demo-PC im RT-Lab.
ELinos 2.2 ist auf allen Rechnern im BCN 103 verfuegbar. Alle Rechner verfügen über ein Diskettenlaufwerk.
Wir beginnen damit, ein schon vorhandes Projekt mit Namen 'BusyBox' im Verzeichnis '/opt/elinos/demos' in ein lauffähiges eingebettetes System zu verwandeln.
Die BusyBox ist ein Programm, das mehr als 120 UNIX-Kommandos emuliert, inklusive einer einfachen Shell. Auf der Basis von BusyBox kann man ein fast vollständiges kommandozeilenorientiertes Linux erstellen.
Der erste Schritt besteht darin, einen 'Clone' dieses Projektes zu erzeugen. Dazu wird zunächst nicht das grafische frontend benutzt, sondern die verfügbaren Shell-Befehle, hier der Befehl elinos-cloneproject im Verzeichnis /opt/elinos/bin. Man muss das Quellprojekt angeben und den Zielnamen:
gerd@kant:~> /opt/elinos/bin/elinos-cloneproject /opt/elinos/demos/BusyBox BusyBox
Es wird ein Shellfenster geöffnet, in dem dann einige zusätzliche Angaben verlangt werden:
CLONING PROJECT `BusyBox' FROM `/opt/elinos/demos/BusyBox' ========================================================== Checking existing project /opt/elinos/demos/BusyBox... ok Checking new project BusyBox... ok Cloning project /opt/elinos/demos/BusyBox as BusyBox... ok CONFIGURING PROJECT =================== Configuration: reading from ./project.config... ok Current Settings: ELINOS_BOARD = custom ELINOS_CPU = x86 ELINOS_ARCH = 386 ELINOS_LIBC = libc6 ELINOS_DOSNAME = busybox ELINOS_BOOT_STRAT = floppy Please select your board type. (1) 386_libc5 (2) 486_libc5 (3) 486_FPU_libc5 (4) 386_FPU_libc5 (5) dilnet_pc_libc5 (6) 386 (7) 486 (8) 486_FPU (9) 386_FPU (10) dilnet_pc (11) custom Board Type [custom]: 7
Wir wählen zunächst mal die angabe mit den wenigstens Randbedingungen:
Project Name (8 characters at most, no blanks) [busybox]: You must now select the boot strategy for your new project: (1) floppy -- Floppy Bootstrap (2) lilo -- Hard-Disk Bootstrap (3) rolo -- x86 ROM Bootstrap with ROLO (4) rolo_rawdisk -- ROLO disk boot image (eg. for CompactFlash) (5) etherboot -- Diskless Network Bootstrap (6) etherboot_multi -- Diskless Network Bootstrap (one Image for Kernel/Root-Filesystem) Boot Strategy: [floppy]: 1 Please select your kernel source tree. The suggested order is: (1) linux-x86-2.4.18 Kernel Source Tree [1]: Checking Kernel-Source /opt/elinos/linux/linux-x86-2.4.18... ok Wiping old kernel... ok Setting up new kernel... ok Writing file ./project.config... ok Writing file ELINOS.sh... ok
Nach diesen Angaben kann ELinOS alle Eigenschaften definieren, die als Basis für die Erzeugung des Zielkerns gelten sollen:
Configuring Features in /home/gerd/BusyBox ========================================== *** initializing features *** feature input complete *** initializing features *** feature input complete *** running feature configuration scripts ... (prepare) done. (commit) done. (mkefs) done. (kernel) done. (unkernel) done. *** merging kernel configuration with feature-config ... Feature build complete. ---------------------------------------------- Your new project has been set up successfully. To work on it, type: sh# cd "/home/gerd/BusyBox" sh# . ELINOS.sh ---------------------------------------------- CLONING DONE.
Das Shellskript ELINOS.sh hat die Funktion, eine Reihe von Umgebungsvariablen zu setzen.
Man muss jetzt in das Projektverzeichnis wechseln und dort weiterarbeiten:
gerd@kant:~> cd /home/gerd/BusyBox gerd@kant:~/BusyBox> l insgesamt 72 drwxr-xr-x 8 gerd users 504 2003-10-15 08:55 ./ drwxr-xr-x 72 gerd users 3368 2003-10-15 09:04 ../ -rw-r--r-- 1 gerd users 12708 2003-10-15 08:55 .features -rw-r--r-- 1 gerd users 2702 2003-10-15 08:55 ELINOS.sh -rw-r--r-- 1 gerd users 5085 2003-10-15 08:53 Makefile -rw-r--r-- 1 gerd users 644 2003-10-15 08:53 README drwxr-xr-x 2 gerd users 48 2003-10-15 08:53 app.rootfs/ drwxr-xr-x 2 gerd users 48 2003-10-15 08:53 boot/ -rw-r--r-- 1 gerd users 63 2003-10-15 08:53 busybox.mkefs lrwxrwxrwx 1 gerd users 32 2003-10-15 08:53 configure -> /opt/elinos/bin/elinos-configure* lrwxrwxrwx 1 gerd users 19 2003-10-15 08:53 elk -> /opt/elinos/bin/elk* -rw-r--r-- 1 gerd users 210 2003-10-15 08:55 feature.mkefs drwxr-xr-x 3 gerd users 72 2003-10-15 08:55 feature.rootfs/ drwxr-xr-x 2 gerd users 48 2003-10-15 08:53 kernel.rootfs/ drwxr-xr-x 14 gerd users 688 2003-10-15 08:56 linux/ -rwxr-xr-x 1 gerd users 21761 2003-10-15 08:53 makeboot* -rw-r--r-- 1 gerd users 855 2003-10-15 08:55 project.config drwxr-xr-x 3 gerd users 72 2003-10-15 08:53 src/ gerd@kant:~/BusyBox> . ELINOS.sh STARTING ELINOS SESSION ======================= Setting up CDK x86_386 for libc6 $ELINOS_BOARD = 486 $ELINOS_BIN_PREFIX = x86_386 $ELINOS_PROJECT = /home/gerd/BusyBox $ELINOS_DOSNAME = busybox $CC = x86_386-gcc $CXX = x86_386-g++ $AS = x86_386-as $GDB = x86_386-gdb gerd@kant:~/BusyBox> make boot
Hiermit beginnt die eigentliche Erzeugung des neuen Zielkerns. Die Bildschirmausgabe ist nur zu Beginn und zum Ende wiedergegeben, da sie zu umfangreich ist:
Reading feature configuration ... complete Reading implications from /opt/elinos/elk/valid.elk ... ok. Reading implications from /home/gerd/BusyBox/valid.elk ... n/a. make -C /home/gerd/BusyBox/linux symlinks clean install make[1]: Entering directory `/home/gerd/BusyBox/linux' rm -f include/asm ( cd include ; ln -sf asm-i386 asm) ( cd drivers/rtai/include ; rm -f asm ; ln -s asm-i386 asm) make[2]: Entering directory `/home/gerd/BusyBox/linux/arch/i386/boot' rm -f tools/build rm -f setup bootsect zImage compressed/vmlinux.out rm -f bsetup bbootsect bzImage compressed/bvmlinux.out make[3]: Entering directory `/home/gerd/BusyBox/linux/arch/i386/boot/compressed' rm -f vmlinux bvmlinux _tmp_* make[3]: Leaving directory `/home/gerd/BusyBox/linux/arch/i386/boot/compressed' make[2]: Leaving directory `/home/gerd/BusyBox/linux/arch/i386/boot' ....... usw. usw. ........ x86_386-objcopy -O binary -R .note -R .comment -S compressed/bvmlinux compressed/bvmlinux.out tools/build -b bbootsect bsetup compressed/bvmlinux.out CURRENT > bzImage Root device is (3, 2) Boot sector 512 bytes. Setup is 2516 bytes. System is 316 kB sh -x ./install.sh 2.4.18 bzImage /home/gerd/BusyBox/linux/System.map "/home/gerd/BusyBox/boot" + '[' -z x86_386 ']' + '[' -n /home/gerd/BusyBox/boot ']' + '[' '!' -d /home/gerd/BusyBox/boot ']' + '[' -f /home/gerd/BusyBox/boot/vmlinuz ']' + '[' -f /home/gerd/BusyBox/boot/System.map ']' + cat bzImage + cp /home/gerd/BusyBox/linux/System.map /home/gerd/BusyBox/boot/System.map + '[' -z x86_386 ']' make[2]: Leaving directory `/home/gerd/BusyBox/linux/arch/i386/boot' make[1]: Leaving directory `/home/gerd/BusyBox/linux' No modules, skipping module build. (if [ -z `sed -n '/^CONFIG_MODULES/p' /home/gerd/BusyBox/linux/.config` ]; then \ echo "No modules, skipping module dependencies."; \ else \ make -C /home/gerd/BusyBox/linux _modinst_post; \ fi) No modules, skipping module dependencies. Checking device node type on target file system ... device file system Reading kernel configuration ... complete Reading feature configuration ... complete Running mkefs ... complete Reading target file system ... complete Reading implications from /opt/elinos/elk/valid.elk ... ok. Reading implications from /home/gerd/BusyBox/valid.elk ... n/a. ./makeboot busybox.tgz Checking for CONFIG_ELINOS_CMDLINE ... adding custom parameters: "devfs=mount rw root=ramfs" Preparing for floppy-boot: Checking for banner ... installing default banner. Writing syslinux.cfg ... ok. Ok. As a final step to get a bootable floppy disk, please copy the following files to an empty, MS-DOS formatted floppy: cp syslinux.cfg /floppy/syslinux.cfg cp banner /floppy/banner cp boot/vmlinuz /floppy/linux cp busybox.tgz /floppy/busybox.tgz To make the floppy bootable, please type: /opt/elinos/bin/syslinux /dev/fd0 - NOTE - You may need root privileges to execute the above commands. - NOTE - You may want to customise this script to meet any special requirements of your target hardware. For instance, you could add the commands neccessary to copy the boot files to a floppy disk, or to the download directory of your tftp-server. The script is located here: /home/gerd/BusyBox/makeboot gerd@kant:~/BusyBox>
Um die neuen Systemdateien auf den Zielrechner zu bringen, muss eine Bootdiskette erzeugt werden und die Dateien müssen auf diese Diskette kopiert werden (dazu wurde vom Autor der Rechner (von 'kant' nach 'turing') gewechselt):
gerd@turing:~/BusyBox> fdformat /dev/fd0h1440 Doppelseitig, 80 Spuren, 18 Sektoren/Spur, Totale Kapazität: 1440kB. Formatieren ... Beendet Überprüfen ... Beendet
Falls die 'mtools' installiert sind, genügt jetzt der Befehl 'mformat':
gerd@turing:~/BusyBox> mformat a: gerd@turing:~/BusyBox> mdir Volume in drive A has no label Volume Serial Number is 65B9-5AD6 Directory for A:/ No files 1 457 664 bytes free gerd@turing:~/BusyBox> mcopy syslinux.cfg banner busybox.tgz a: gerd@turing:~/BusyBox> mcopy boot/vmlinuz a:linux gerd@turing:~/BusyBox> mdir Volume in drive A has no label Volume Serial Number is 65B9-5AD6 Directory for A:/ syslinux cfg 77 2003-10-15 9:38 banner 2532 2003-10-15 9:38 busybox tgz 650128 2003-10-15 9:38 linux 327658 2003-10-15 9:40 4 files 980 395 bytes 476 672 bytes free
Damit diese Diskette mit den Dateien als Bootdiskette angenommen wird, muss sie noch mit dem Befehl 'syslinux' bearbeitet werden:
gerd@turing:/> /opt/elinos/bin/syslinux /dev/fd0 gerd@turing:/>
Ab jetzt sollte diese Diskette von jedem geeigneten Intel-PC als Bootdiskette akzeptiert werden.
Eine anmerkung zum Dateisystem des Projektes BusyBox. Schaut man sich den Inhalt der tar-Datei an (siehe unten), dann erkennt man, dass alle Shellbefehle symbolisch auf ein einziges Programm 'busybox' gelinkt werden. Dies hängt damit zusammen, dass busybox tatsächlich nur ein einziges Binärprogramm ist, für das die Befehlsnamen der shellbefehle Eingabeparameter darstellen.
gerd@kant:~/ELINOS-TEST/BusyBox> tar ztvf busybox.tgz
drwxr-xr-x 0/0 0 2003-10-15 08:53:34 ./ drwxr-xr-x 0/0 0 2003-10-15 08:55:31 ./ drwxr-xr-x 0/0 0 2003-10-15 08:55:38 etc/ -rw-r--r-- 0/0 57 2003-10-15 08:55:38 etc/fstab -rw-r--r-- 0/0 62 2003-10-15 08:55:35 etc/inittab -rwxr-xr-x 0/0 1038 2003-10-15 08:55:31 etc/profile drwxr-xr-x 0/0 0 2003-10-15 09:23:16 proc/ drwxr-xr-x 0/0 0 2003-10-15 09:23:16 dev/ drwxr-xr-x 0/0 0 2003-10-15 09:23:16 tmp/ drwxr-xr-x 0/0 0 2003-09-23 09:42:37 ./ drwxr-xr-x 0/0 0 2003-09-23 09:42:37 bin/ lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/dd -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/cp -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/df -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/ln -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/ls -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/mv -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/ps -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/rm -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/sh -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/vi -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/cat -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/msh -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/pwd -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/sed -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/tar -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/date -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/echo -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/grep -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/gzip -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/kill -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/more -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/ping -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/stty -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/sync -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/true -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/zcat -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/chgrp -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/chmod -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/chown -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/dmesg -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/false -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/mkdir -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/mknod -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/mount -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/pidof -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/rmdir -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/sleep -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/touch -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/uname -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/gunzip -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/hostname -> busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 bin/umount -> busybox -rwsr-sr-x 0/0 247296 2003-10-15 09:23:16 bin/busybox drwxr-xr-x 0/0 0 2003-09-23 09:42:37 usr/ drwxr-xr-x 0/0 0 2003-09-23 09:42:37 usr/bin/ lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/[ -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/du -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/id -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/nc -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/wc -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/cut -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/env -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/tee -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/tty -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/yes -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/chvt -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/find -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/free -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/head -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/tail -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/sort -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/test -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/uniq -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/dirname -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/killall -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/clear -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/reset -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/which -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/xargs -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/logger -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/telnet -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/uptime -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/whoami -> ../../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/bin/basename -> ../../bin/busybox drwxr-xr-x 0/0 0 2003-09-23 09:42:37 usr/sbin/ lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 usr/sbin/chroot -> ../../bin/busybox drwxr-xr-x 0/0 0 2003-09-23 09:42:37 sbin/ lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/halt -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/init -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/klogd -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/lsmod -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/rmmod -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/route -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/modprobe -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/poweroff -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/swapoff -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/syslogd -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/insmod -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/mkswap -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/ifconfig -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/reboot -> ../bin/busybox lrwxrwxrwx 0/0 0 2003-09-23 09:42:37 sbin/swapon -> ../bin/busybox drwxr-xr-x 0/0 0 2003-10-15 09:23:16 lib/ lrwxrwxrwx 0/0 0 2003-10-15 09:23:16 lib/libc.so.6 -> libc-2.2.5.so -rwxr-xr-x 0/0 1218408 2003-10-15 09:23:17 lib/libc-2.2.5.so lrwxrwxrwx 0/0 0 2003-10-15 09:23:17 lib/ld-linux.so.2 -> ld-2.2.5.so -rwxr-xr-x 0/0 83220 2003-10-15 09:23:17 lib/ld-2.2.5.so
gerd@kant:~> /opt/elinos/bin/elinos-cloneproject /opt/elinos/demos/Hello MyFirst CLONING PROJECT `MyFirst' FROM `/opt/elinos/demos/Hello' ======================================================== Checking existing project /opt/elinos/demos/Hello... ok Checking new project MyFirst... ok Cloning project /opt/elinos/demos/Hello as MyFirst... ok CONFIGURING PROJECT =================== Configuration: reading from ./project.config... ok Current Settings: ELINOS_BOARD = custom ELINOS_CPU = x86 ELINOS_ARCH = 386 ELINOS_LIBC = libc6 ELINOS_DOSNAME = hello ELINOS_BOOT_STRAT = floppy Please select your board type. (1) 386_libc5 (2) 486_libc5 (3) 486_FPU_libc5 (4) 386_FPU_libc5 (5) dilnet_pc_libc5 (6) 386 (7) 486 (8) 486_FPU (9) 386_FPU (10) dilnet_pc (11) custom Board Type [custom]: 7 Project Name (8 characters at most, no blanks) [hello]: myfirst You must now select the boot strategy for your new project: (1) floppy -- Floppy Bootstrap (2) lilo -- Hard-Disk Bootstrap (3) rolo -- x86 ROM Bootstrap with ROLO (4) rolo_rawdisk -- ROLO disk boot image (eg. for CompactFlash) (5) etherboot -- Diskless Network Bootstrap (6) etherboot_multi -- Diskless Network Bootstrap (one Image for Kernel/Root-Filesystem) Boot Strategy: [floppy]: Please select your kernel source tree. The suggested order is: (1) linux-x86-2.4.18 Kernel Source Tree [1]: Checking Kernel-Source /opt/elinos/linux/linux-x86-2.4.18... ok Wiping old kernel... ok Setting up new kernel... ok Rename mkefs script "hello.mkefs" to match new project name? [y]: Writing file ./project.config... ok Writing file ELINOS.sh... ok Configuring Features in /home/gerd/MyFirst ========================================== *** initializing features *** feature input complete *** initializing features *** feature input complete *** running feature configuration scripts ... (prepare) done. (commit) done. (mkefs) done. (kernel) done. (unkernel) done. *** merging kernel configuration with feature-config ... Feature build complete. ---------------------------------------------- Your new project has been set up successfully. To work on it, type: sh# cd "/home/gerd/MyFirst" sh# . ELINOS.sh ---------------------------------------------- CLONING DONE. gerd@kant:~>
erd@kant:~> cd MyFirst/ gerd@kant:~/MyFirst> l insgesamt 76 drwxr-xr-x 8 gerd users 536 2003-10-15 10:34 ./ drwxr-xr-x 72 gerd users 3376 2003-10-15 10:33 ../ -rw-r--r-- 1 gerd users 12625 2003-10-15 10:34 .features -rw-r--r-- 1 gerd users 2702 2003-10-15 10:34 ELINOS.sh -rw-r--r-- 1 gerd users 5085 2003-10-15 10:33 Makefile -rw-r--r-- 1 gerd users 367 2003-10-15 10:33 README drwxr-xr-x 2 gerd users 48 2003-10-15 10:33 app.rootfs/ -rwxr-xr-x 1 gerd users 1178 2003-10-15 10:33 autonode.sh* drwxr-xr-x 2 gerd users 48 2003-10-15 10:33 boot/ lrwxrwxrwx 1 gerd users 32 2003-10-15 10:33 configure -> /opt/elinos/bin/elinos-configure* lrwxrwxrwx 1 gerd users 19 2003-10-15 10:33 elk -> /opt/elinos/bin/elk* -rw-r--r-- 1 gerd users 235 2003-10-15 10:34 feature.mkefs drwxr-xr-x 3 gerd users 72 2003-10-15 10:34 feature.rootfs/ drwxr-xr-x 2 gerd users 48 2003-10-15 10:33 kernel.rootfs/ drwxr-xr-x 14 gerd users 688 2003-10-15 10:35 linux/ -rwxr-xr-x 1 gerd users 21761 2003-10-15 10:33 makeboot* -rw-r--r-- 1 gerd users 39 2003-10-15 10:33 myfirst.mkefs -rw-r--r-- 1 gerd users 855 2003-10-15 10:34 project.config drwxr-xr-x 3 gerd users 72 2003-10-15 10:33 src/ gerd@kant:~/MyFirst> . ELINOS.sh STARTING ELINOS SESSION ======================= Setting up CDK x86_386 for libc6 $ELINOS_BOARD = 486 $ELINOS_BIN_PREFIX = x86_386 $ELINOS_PROJECT = /home/gerd/MyFirst $ELINOS_DOSNAME = myfirst $CC = x86_386-gcc $CXX = x86_386-g++ $AS = x86_386-as $GDB = x86_386-gdb
Eine eigenes Startprogramm durch Ersetzen der Datei /src/rc/init.c:
gerd@kant:~/MyFirst> cd src gerd@kant:~/MyFirst/src> l insgesamt 1 drwxr-xr-x 3 gerd users 72 2003-10-15 10:33 ./ drwxr-xr-x 8 gerd users 536 2003-10-15 10:34 ../ drwxr-xr-x 2 gerd users 128 2003-10-15 10:43 rc/ gerd@kant:~/MyFirst/src> cd rc gerd@kant:~/MyFirst/src/rc> l insgesamt 12 drwxr-xr-x 2 gerd users 128 2003-10-15 10:43 ./ drwxr-xr-x 3 gerd users 72 2003-10-15 10:33 ../ -rw-r--r-- 1 gerd users 136 2003-10-15 10:33 Makefile.elinos -rw-r--r-- 1 gerd users 461 2003-10-15 10:43 init.c -rw-r--r-- 1 gerd users 1281 2003-10-15 10:33 init.c~
Die Datei init.c vom Projekt 'Hello' soll durch eine neue Datei ersetzt werden:
/******************************* * * init.c * * ****************************/ #include <stdio.h> #include <unistd.h> int main(void) { int i; /*************************************** Linux doesn_t like init to finish, therefore an infinite loop will be prepared... ***************************************/ for(;;) { printf("Hallo wrld!!!\n"); printf("This is the first Programm ..."); for(i=0; i<100000000; i++){;} } return 0; }
Die übrigen Schritte sind analog zum vorausgehenden Beispiel.
Für weitere Beispiele siehe auch die Webseite von Herrn Houssaini oder die Seite RT Übung Nr.2 von WS03. s
Die Übung Nr.5 zielt darauf ab,
Für das Ziel (i) sollten die vorausgehenden Beispiele ausreichend Informationen liefern.
Für das Ziel (ii) soll das Programm, das in Übungsaufgabe Nr.1 gestellt worden ist, jetzt als bootfaehiges Programm mit Hilfe von ELinOS 2.2 realisiert werden.
Für die Vorführung des Programms einschliesslich Kurzvortrag kann es bis zu 7 Pkt. geben.
Die Übungsaufgabe gilt als erfüllt, wenn folgende Bedingungen erfüllt sind: