From 5bc8549a8d7f5c9644f878fe3ca55761663a2fd0 Mon Sep 17 00:00:00 2001 From: Alex AUVOLAT Date: Thu, 17 May 2012 10:25:35 +0200 Subject: Now booting on CD-ROM. --- .gitignore | 2 ++ Makefile | 32 ++++++++++++++++++-------------- bochs.cfg | 28 +++++++++++++++++++--------- copy_fdd.sh | 14 -------------- menu_cdrom.lst | 5 +++++ menu_fdd.cfg | 5 ----- src/kernel/mem/paging.cpp | 1 + 7 files changed, 45 insertions(+), 42 deletions(-) delete mode 100755 copy_fdd.sh create mode 100644 menu_cdrom.lst delete mode 100644 menu_fdd.cfg diff --git a/.gitignore b/.gitignore index b2dfd6b..39d72ef 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,7 @@ *.swp *.map *.elf +cdrom/* tmp TCE.fl.img +TCE.iso diff --git a/Makefile b/Makefile index d63478d..bb759b8 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ QemuCmd = qemu-system-i386 BasePath = $(shell pwd) SrcPath = $(BasePath)/src -Floppy = TCE.fl.img +Cdrom = TCE.iso all: @for p in $(Projects); do \ @@ -36,20 +36,24 @@ commit: mrproper git commit -a; exit 0 git push origin -floppy: - mkdir mnt; exit 0 - sudo mount $(Floppy) mnt -o loop - sudo ./copy_fdd.sh - sleep 0.3 - sudo umount mnt - - -bochs: all floppy +$(Cdrom): menu_cdrom.lst src/kernel/kernel.elf src/user/test/test.elf + mkdir -p cdrom/boot/grub + if [ ! -e cdrom/boot/grub/stage2_eltorito ]; then \ + echo "Please copy grub's stage2_eltorito to cdrom/boot/grub."; \ + exit -1; \ + fi + cp menu_cdrom.lst cdrom/boot/grub/menu.lst + cp src/kernel/kernel.elf cdrom + cp src/user/test/test.elf cdrom + genisoimage -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 \ + -boot-info-table -input-charset ascii -A TCE -o $(Cdrom) cdrom + +bochs: all $(Cdrom) bochs -f bochs.cfg -qemu: all floppy - $(QemuCmd) -fda $(Floppy) -m 32 +qemu: all $(Cdrom) + $(QemuCmd) -cdrom $(Cdrom) -m 32 -qemu-gdb: all floppy - $(QemuCmd) -fda $(Floppy) -m 32 -s -S & gdb src/kernel/kernel.elf -x gdb-cmd +qemu-gdb: all $(Cdrom) + $(QemuCmd) -cdrom $(Cdrom) -m 32 -s -S & gdb src/kernel/kernel.elf -x gdb-cmd diff --git a/bochs.cfg b/bochs.cfg index b6bc3c8..d80600d 100644 --- a/bochs.cfg +++ b/bochs.cfg @@ -1,14 +1,16 @@ # configuration file generated by Bochs +plugin_ctrl: unmapped=1, biosdev=1, speaker=1, extfpuirq=1 config_interface: textconfig display_library: x -megs: 16 +memory: host=16, guest=16 romimage: file="/usr/share/bochs/BIOS-bochs-latest" vgaromimage: file="/usr/share/bochs/VGABIOS-lgpl-latest" -boot: floppy +boot: cdrom floppy_bootsig_check: disabled=0 -floppya: 1_44="TCE.fl.img", status=inserted +#floppya: type=1_44, 1_44="none", status=inserted, write_protected=0 # no floppyb ata0: enabled=1, ioaddr1=0x1f0, ioaddr2=0x3f0, irq=14 +ata0-master: type=cdrom, path="TCE.iso", status=inserted, biosdetect=auto, model="Generic 1234" ata1: enabled=1, ioaddr1=0x170, ioaddr2=0x370, irq=15 ata2: enabled=0 ata3: enabled=0 @@ -18,20 +20,28 @@ com1: enabled=1, mode=null, dev="" com2: enabled=0 com3: enabled=0 com4: enabled=0 -i440fxsupport: enabled=0 -vga_update_interval: 40000 -vga: extension=vbe -cpu: count=1, ips=2000000, reset_on_triple_fault=1 +usb_uhci: enabled=0 +usb_ohci: enabled=0 +usb_xhci: enabled=0 +pci: enabled=0 +vga: extension=vbe, update_freq=25 +cpu: count=1, ips=2000000, model=bx_generic, reset_on_triple_fault=1, cpuid_limit_winnt=0, ignore_bad_msrs=1 +cpuid: family=6, model=0x03, stepping=3, mmx=1, apic=xapic, sse=sse2, sse4a=0, sep=1, aes=0, xsave=0, xsaveopt=0, movbe=0, smep=0, mwait=1, mwait_is_nop=0 +cpuid: vendor_string="AuthenticAMD" +cpuid: brand_string="AMD Athlon(tm) processor" + +print_timestamps: enabled=0 +port_e9_hack: enabled=0 private_colormap: enabled=0 clock: sync=none, time0=local # no cmosimage ne2k: enabled=0 pnic: enabled=0 sb16: enabled=0 +es1370: enabled=0 # no loader log: - logprefix: %t%e%d -debugger_log: - panic: action=ask error: action=report info: action=report @@ -41,4 +51,4 @@ keyboard_serial_delay: 250 keyboard_paste_delay: 100000 keyboard_mapping: enabled=1, map=/usr/share/bochs/keymaps/x11-pc-fr.map user_shortcut: keys=none -mouse: enabled=0, type=ps2 +mouse: enabled=0, type=ps2, toggle=ctrl+mbutton diff --git a/copy_fdd.sh b/copy_fdd.sh deleted file mode 100755 index ebd53c5..0000000 --- a/copy_fdd.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# We assume mnt/ is the directory where the image is mounted, and src/ is the directory with all the compiled files -rm mnt/* - -# Update GRUB's menu.cfg -cp menu_fdd.cfg mnt/boot/menu.cfg - -# copy kernel -cp src/kernel/kernel.elf mnt -cp src/user/test/test.elf mnt - -#echo "*** Launching a BASH shell, if you want to do any maintenance ***" -#bash || exit 0 diff --git a/menu_cdrom.lst b/menu_cdrom.lst new file mode 100644 index 0000000..4bbe812 --- /dev/null +++ b/menu_cdrom.lst @@ -0,0 +1,5 @@ +timeout 10 + +title T/CE +kernel /kernel.elf +module /test.elf diff --git a/menu_fdd.cfg b/menu_fdd.cfg deleted file mode 100644 index 2be8686..0000000 --- a/menu_fdd.cfg +++ /dev/null @@ -1,5 +0,0 @@ -timeout 1 - -title T/CE -kernel /kernel.elf -module /test.elf diff --git a/src/kernel/mem/paging.cpp b/src/kernel/mem/paging.cpp index 496b70c..8beee16 100644 --- a/src/kernel/mem/paging.cpp +++ b/src/kernel/mem/paging.cpp @@ -39,6 +39,7 @@ void paging_init(size_t totalRam) { frames.size = totalRam / 0x1000; frames.bits = (uint32_t*)ksbrk(INDEX_FROM_BIT(frames.size)); + memset(frames.bits, 0, INDEX_FROM_BIT(frames.size)); kernel_pagedir = (page_directory*)ksbrk(sizeof(page_directory)); kernel_pagedir->mappedSegs = 0; -- cgit v1.2.3