dbg = -g
inc = -Isrc -Isrc/libc
-CFLAGS = $(carch) $(warn) $(dbg) $(inc) -fno-pic -ffreestanding -nostdinc \
+CFLAGS = $(carch) -march=i386 $(warn) $(dbg) $(inc) -fno-pic -ffreestanding -nostdinc \
-fno-builtin -MMD
LDFLAGS = $(ldarch) -nostdlib -T kern1.ld -Map kern1.map
drawtext(line & 7, row, buf);
for(i=0; i<65536 * 4; i++) {
- buf[0] = twirl[(i >> 18) & 3];
+ buf[0] = twirl[(i >> 15) & 3];
buf[1] = 0;
vga_setcolor(VGA_WHITE, VGA_BLACK);
drawtext(50, row, buf);
--- /dev/null
+#!/bin/sh
+
+SUDO=
+mntpt=/tmp/3sys1mnt
+
+make -C kern || exit 1
+
+echo 'creating partition image: part.img'
+dd if=/dev/zero of=part.img bs=1024 count=63488
+mkfs -t vfat -n SYS1ROOT part.img
+
+echo 'creating disk image: disk.img'
+dd if=/dev/zero of=disk.img bs=1024 count=65536
+echo start=2048 type=c | sfdisk disk.img
+
+echo 'combining images'
+dd if=part.img of=disk.img bs=1024 seek=1024 conv=notrunc
+
+if [ "`id -u`" != 0 ]; then
+ if sudo --version >/dev/null 2>&1; then
+ echo 'will need superuser priviledges for the next part, using sudo'
+ SUDO=sudo
+ else
+ echo 'will need superuser priviledges for the next part, using su'
+ su || exit 1
+ fi
+fi
+
+echo "mounting parition image to $mntpt"
+$SUDO mkdir -p $mntpt
+$SUDO mount -o loop,offset=1M disk.img $mntpt
+$SUDO mkdir -p $mntpt/boot/grub
+echo 'copying grub files'
+$SUDO cp grub.cfg $mntpt/boot/grub
+echo 'copying kernel'
+$SUDO cp kern/kern1.elf $mntpt/boot
+echo 'installing grub'
+$SUDO grub-install --target=i386-pc --boot-directory=$mntpt/boot \
+ --skip-fs-probe --install-modules='part_msdos fat multiboot' \
+ --modules='part_msdos fat multiboot' disk.img
+$SUDO umount $mntpt