Skip to content

Commit

Permalink
Merge branch 'image-autogen'
Browse files Browse the repository at this point in the history
Conflicts:
	src/Makefile
	src/fd.img
	src/menu.lst

Got rid of the fd.img in favor of img.iso.
Still some cleanup to do, but I wanted to just blindly resolve
conflicts in one commit, and fully fix them in a second.
  • Loading branch information
ccs4ever committed Jul 14, 2011
2 parents fdb475d + 4c519cf commit 0faf37f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 32 deletions.
4 changes: 4 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
img.iso
*.o
image.elf
iso/
62 changes: 32 additions & 30 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
all: clean src
img := img.iso
srcs := $(wildcard *.c *.s)
objs := 00entry.o $(srcs:%.c=%.o)
objs := $(objs:%.s=%.o)
target := ixmage.elf
AS=$(CC)
CFLAGS = -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -I../include/
ASFLAGS := $(CFLAGS) -c

all: src

clean:
rm -f *.o ixmage.elf doc.txt

src: clean
nasm -felf start.asm -o 00entry.o
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o gdt.o -I ../include/ gdt.c
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o isrs.o -I ../include/ isrs.c
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o util.o -I ../include/ util.c
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o irq.o -I ../include/ irq.c
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o timer.o -I ../include/ timer.c
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o idt.o -I../include/ idt.c
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o kernel_assert.o -I../include/ kernel_assert.c
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o kernel_halt.o -I../include/ kernel_halt.s
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o io.o -I../include/ io.c
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o ix_main.o -I../include/ ix_main.c
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o kb.o -I../include/ kb.c
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o vga.o -I../include/ vga.c
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o zz.o -I../include/ zz.c
gcc -Wall -mtune=i386 -mno-mmx -mno-3dnow -mno-sse2 -mno-sse3 -mno-sse -mno-tls-direct-seg-refs -nostdlib -nostdinc -ffreestanding -c -o kaukatcr.o -I../include/ kaukatcr.c
ld -nostdlib -Tlink.ld *.o -o ixmage.elf

image: clean src
mkdir -p mnt
sudo mount -o loop fd.img ./mnt/
sudo cp menu.lst ./mnt/boot/menu.cfg
sudo cp ixmage.elf ./mnt/
sudo umount ./mnt/
-rm -f $(objs) $(target) $(img) doc.txt

00entry.o: start.asm
nasm -f elf32 $< -o $@

$(target): link.ld $(objs)
ld -nostdlib -Tlink.ld $(objs) -o $(target)

src: $(target)

image: $(img)

$(img): $(target) menu.lst
mkdir -p iso/boot/grub
cp /boot/grub/stage2_eltorito iso/boot/grub
sudo cp menu.lst iso/boot/grub/menu.lst
sudo cp $(target) iso/
mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot \
-boot-load-size 4 -boot-info-table -o $(img) iso/

test: image
qemu -no-reboot -no-shutdown -fda fd.img
qemu -no-reboot -no-shutdown -boot d -cdrom $(img)

install: src
sudo cp ixmage.elf /boot/

sudo cp $(target) /boot/

.PHONY: image test install all src clean

Binary file removed src/fd.img
Binary file not shown.
4 changes: 2 additions & 2 deletions src/menu.lst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
timeout 5

title ix
root (fd0)
kernel /ixmage.elf
# grub infers this for us root (cd)
kernel --type=multiboot /image.elf
boot

1 change: 1 addition & 0 deletions src/start.asm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

; entry.asm begins here


; Multiboot header
MULTIBOOT_PAGE_ALIGN equ 1<<0
MULTIBOOT_MEMORY_INFO equ 1<<1
Expand Down

0 comments on commit 0faf37f

Please sign in to comment.