Commit 2a633423 authored by Hans Buchmann's avatar Hans Buchmann

boot

parent e35eb7fb
00000000 43 6f 70 79 72 69 67 68 74 20 31 39 38 35 2d 31 |Copyright 1985-1|
00000010 39 38 38 20 50 68 6f 65 6e 69 78 20 54 65 63 68 |988 Phoenix Tech|
00000020 6e 6f 6c 6f 67 69 65 73 20 4c 74 64 2e 20 20 20 |nologies Ltd. |
00000030 43 6f 70 79 72 69 67 68 74 20 31 39 38 38 2d 32 |Copyright 1988-2|
00000040 30 30 39 20 44 65 6c 6c 20 49 6e 63 2e 20 20 20 |009 Dell Inc. |
00000050 41 6c 6c 20 72 69 67 68 74 73 20 72 65 73 65 72 |All rights reser|
00000060 76 65 64 2e 00 00 00 00 00 00 00 00 00 00 00 00 |ved.............|
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
000f0000 43 6f 70 79 72 69 67 68 74 20 31 39 38 35 2d 31 |Copyright 1985-1|
000f0010 39 38 38 20 50 68 6f 65 6e 69 78 20 54 65 63 68 |988 Phoenix Tech|
000f0020 6e 6f 6c 6f 67 69 65 73 20 4c 74 64 2e 20 20 20 |nologies Ltd. |
000f0030 43 6f 70 79 72 69 67 68 74 20 31 39 38 38 2d 32 |Copyright 1988-2|
000f0040 30 30 39 20 44 65 6c 6c 20 49 6e 63 2e 20 20 20 |009 Dell Inc. |
000f0050 41 6c 6c 20 72 69 67 68 74 73 20 72 65 73 65 72 |All rights reser|
000f0060 76 65 64 2e 00 00 00 00 00 00 00 00 00 00 00 00 |ved.............|
000f0070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
*
00000200
000f0200
000001f0 ea 5b e0 00 f0 31 32 2f 32 31 2f 30 39 00 fc 00 |.[...12/21/09...|
0000f1f0 ea 5b e0 00 f0 31 32 2f 32 31 2f 30 39 00 fc 00 |.[...12/21/09...|
No preview for this file type
......@@ -161,12 +161,17 @@ Basic Architecture
\end{columns}
\end{frame}
\begin{codedemo}{VirtualBox}
\begin{itemize}
\item Erzeuge kleine VM
\item Starte
\end{itemize}
\end{codedemo}
%\begin{codedemo}{VirtualBox/QEMU}
% \begin{itemize}
% \item Erzeuge kleine VM
% \begin{itemize}
% \item VirtualBox
% \item qemu
% \end{itemize}
% \item Starte
% \end{itemize}
% \remark{src/notes.txt}
%\end{codedemo}
\section{Bootstrap}
\begin{frame}
......@@ -238,12 +243,11 @@ Basic Architecture
% \remark{Siehe Kapitel {\em 2-as-user}}
%\end{codedemo}
\begin{frame}[verbatim]
\frametitle{BIOS:\cod{0x000ffff0}: die letzten 16 Bytes}
\begin{code}
dd if=/dev/mem skip=\$((0xffff0/512)) count=1
\end{code}
Die letzten 16 Byte
\begin{frame}[fragile]\frametitle{BIOS:\cod{0x000ffff0}: die letzten 16 Bytes}
% \begin{code}
% dd if=/dev/mem skip=\$((0xffff0/512)) count=1
% \end{code}
% Die letzten 16 Byte
\listing{bios.0xffff0.hex}
aufgeschlsselt:
\begin{description}[\cod{0x5b 0xe0 0x00 0xf0}]
......@@ -270,41 +274,62 @@ Basic Architecture
\begin{codedemo}{MBR:Master Boot Record}
\begin{description}
\item[Read] Lese erster Block der Harddisk\\
\cod{dd if=/dev/sda count=1 > mbr.cod}
\cod{dd if=/dev/sda count=1 > mbr.img}
\item[Inspect]
\cod{hexdump -C mbr.cod}
\item[Decode] \cod{sh show-code.sh mbr.cod 0}
\cod{hexdump -C mbr.img}
\item[Decode] \cod{sh show-code.sh mbr.img 0}
\end{description}
\end{codedemo}
\begin{codedemo}{MBR \cod{mbr.cod} in VirtualBox}
\begin{itemize}
\item VirtuaBox akzeptiert (virtuelle) FloppyDisks: 1474560 Bytes
\fig{fig/floppy.pdf}{0.75}{0}
\item \cod{mbr.cod} (512 Bytes) einbetten in \cod{floppy.img} (1474560 Bytes)
\remark{Gemacht mit \cod{make-bootfloppy.sh}}
\item VirtualBox mit \cod{floppy.img} als MBR
\end{itemize}
\end{codedemo}
%\begin{codedemo}{MBR \cod{mbr.cod} in VirtualBox}
% \begin{itemize}
% \item VirtuaBox akzeptiert (virtuelle) FloppyDisks: 1474560 Bytes
% \fig{fig/floppy.pdf}{0.75}{0}
% \item \cod{mbr.cod} (512 Bytes) einbetten in \cod{floppy.img} (1474560 Bytes)
% \remark{Gemacht mit \cod{make-bootfloppy.sh}}
% \item VirtualBox mit \cod{floppy.img} als MBR
% \end{itemize}
%\end{codedemo}
\begin{codedemo}{Leicht modifizierter MBR \cod{mbr.cod} in VirtualBox}
\section{Aufgaben}
\begin{frame}{Aufgabe:Virtuelle Maschine}{Installation}
\begin{itemize}
\item VirtualBox Minimales System
\begin{description}
\item[OS Type] Other
\item[System] 4MB, Floppy
\item[Display] 1MB
\item[Storage] Floppy Disk Controller
\begin{itemize}
\item Image \cod{mbr.img}
\end{itemize}
\end{description}
\item qemu
\begin{itemize}
\item Siehe \cod{qemu.sh}
\item Image \cod{mbr.img}
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}{Leicht modifizierter MBR}{\cod{mbr-mod.img}}
\begin{itemize}
\item ndere
\begin{quote}
\cod{Error loading operating system}
\end{quote}
ab
\item \cod{hexedit floppy.img}
\item VirtualBox mit modifiziertem \cod{floppy.img} als MBR
\item Hexeditor
\item Starte VirtualBox/quemu mit \cod{mbr-mod.img} als MBR
\end{itemize}
\end{codedemo}
\end{frame}
\begin{codedemo}{MBR abndern \cod{floppy-new.img}}
\begin{frame}{MBR abndern}{\cod{mbr-loop.img}}
\begin{description}
\item[Original] \cod{objdump --start-address=0 $\backslash$\\
-b binary -m i8086 -D floppy.img}
\item[Original]
\cod{sh show-code.sh mbr.img 0}:\\
\cod{
0: 33 c0 xor \%ax,\%ax\\
2: 8e d0 mov \%ax,\%ss\\
......@@ -314,44 +339,30 @@ Basic Architecture
\cod{
0: eb {\em delta} jmp ?\\
2:
2: <--- pc
}
Wie gross ist das {\em delta}?
\cod{hexedit floppy-new.img}\\
\cod{objdump --start-address=0 $\backslash$\\
-b binary -m i8086 -D floppy-new.img}
\begin{itemize}
\item Wie gross ist das {\em delta}?
\begin{itemize}
\item Ausprobieren
\begin{itemize}
\item hexedit offset 1,
\item \cod{show-code mbr-loop.img 0}
\end{itemize}
\end{itemize}
\end{itemize}
\end{description}
\remark{$2+x=0$}
\end{codedemo}
\begin{codedemo}{\cod{floppy-new.img} starten}
\begin{itemize}
\item VirtualBox mit \cod{floppy-new.img}
\end{itemize}
\end{codedemo}
\section{Aufgaben}
\begin{frame}
\frametitle{Aufgabe}
\begin{itemize}
\item Installation {\em VirtualBox} \
\item Start mit \cod{floppy.img}
\item Start mit \cod{floppy-new.img}
\end{itemize}
\remark{$2+\delta=0$}
\end{frame}
\begin{frame}
\frametitle{Aufgabe: VirtualBox installieren}
\begin{itemize}
\item Download \www{www.virtualbox.org/}
\item Machine: OS Type:Other/Unknown
\item Boot: Floppy Image \cod{mbr.cod}
\end{itemize}
\begin{frame}{Kleines Boot Programm}{\cod{mbr-video.img}}
\begin{description}[make-boot.sh]
\item[mbr-video.S] der Code
\item[make-boot.sh] erzeugt image
\end{description}
\end{frame}
%\begin{frame}
% \frametitle{Ein etwas besserer MBR: Einfach}
% \listing{video-out.cod.solution}
......
README
------
The files:
floppy.img: an empy floppy disk
video.img: a very simple program
video.S: the code for video.img
show-code.sh : script for displaying binary file as code
make-boot.sh : script for making image from source
copy-bios.sh : copy bios code to stdout
make-bootfloppy.sh: create from a 512 byte master boot record a bootable
floppy appropriate for Virtual Machines
......@@ -4,7 +4,7 @@
#$Id$
#-------------------
#000f0000-000fffff : System ROM
# see cat /proc/iomen
# see cat /proc/iomem
# you must be root
BLOCKSIZE=512
BIOS_START=0xf0000
......
#----------------------
#make-bootfloppy.sh
#(c) H.Buchmann FHNW 2012
#$Id$
#calling make-bootfloppy.sh mbr-file
# mbr-file must be 512 bytes
#----------------------
FILE_SIZE=$(stat --format='%s' ${1})
FLOPPY_SIZE=1474560
BLOCK_SIZE=512
if [ ${FILE_SIZE} -ne 512 ]
then echo "wrong size ${FILE_SIZE} expected 512"
exit 1
fi
#floppy
# 512 |
cp ${1} floppy.img
#512 | 1474560-512
dd if=/dev/zero count=$(((FLOPPY_SIZE-512)/512))>> floppy.img
......@@ -3,9 +3,9 @@
#----------------------
.code16
loop: mov $0xe,%ah #Write Character in TTY Mode
mov $'2' ,%al #the character
mov $'2' ,%al #the character <--- enter here annother char
mov 0x00 ,%bx #the color
int $0x10 #call bios service
jmp loop #again and again
end:
.fill 1474560-(end-loop),1,0 #must be floopy: 1474560 Bytes
.fill 512-(end-loop),1,0 #up to first sector Bytes
Virtual Box
-----------
System:
Motherbopard:
4MB
Floppy <--- boot device
Display:
1MB
Storage:
Floppy Controller
Choose Disk video.img
QEMU
----
see quemu.sh
Making from Assembler
---------------------
Source File: video.S
see make-boot.sh
Making from Hex
---------------
copy of floppy.img floppy-new.img
run floppy-new.img
'Error loading operating system'
change text
sh show-code.sh
Hexeditor:ghex
change code
0: jmp 0 loop forever
offset:
0: eb delta
delta = ?
use:
sh show-code.sh
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment