Import backup from 2004-07-09
This commit is contained in:
1 parent
f3fe4ef3b8
commit
0729754659
76 files changed
+470
-7676
No files matched your search
@@ -1,117 +1,47 @@
|
||||
#####################################################################
|
||||
# Author: Josh Holtrop / Benjamen R. Meyer #
|
||||
# Date: 02/15/04 Modified: 06/07/04 #
|
||||
# Purpose: To build Josh Holtrop's OS (HOS) using GNU make #
|
||||
# Note: This makefile is for use on Linux & other Unix-like systems #
|
||||
#####################################################################
|
||||
# Makefile for HOS
|
||||
# Josh Holtrop
|
||||
# Created: 07/09/04
|
||||
|
||||
##############
|
||||
# Variables: #
|
||||
##############
|
||||
FLOPPY=/dev/fd0
|
||||
FLOPPY_MOUNT=./mnt_flp
|
||||
FLOPPY_IMAGE=hos.flp
|
||||
GRUB_IMAGE=grub.flp
|
||||
|
||||
# Information for creating a floppy image
|
||||
# Note: FLOPPY_FS and FLOPPY_FAT_SIZE are related fields.
|
||||
# FLOPPY_FAT_SIZE should be either 12 or 16,
|
||||
# depending on if FLOPPY_FS is FAT12 or FAT16, respectively.
|
||||
MKDOSFS_PROG=mkdosfs
|
||||
FLOPPY_IMAGE=floppy.img
|
||||
FLOPPY_BLOCK_COUNT=1440
|
||||
FLOPPY_FS=FAT12
|
||||
FLOPPY_FAT_SIZE=12
|
||||
FLOPPY_MOUNT=./floppy_image
|
||||
|
||||
# Floppy images are good for programs like VMware and Bochs Pentium Emulator. ;-)
|
||||
|
||||
# Program for copying
|
||||
COPY_BIN=cp
|
||||
|
||||
##########################################
|
||||
# Build the IPL (Boot Loader) and Kernel #
|
||||
##########################################
|
||||
all:
|
||||
# A word of warning to users :-> And a little helpful information ;-)
|
||||
@echo "Installation must be done as root."
|
||||
@echo "Type 'make install' to install to a floppy in drive '/dev/fd0'"
|
||||
@echo "Type 'make install_img' to create a floppy image and install to it."
|
||||
|
||||
make -C boot
|
||||
make -C kernel
|
||||
# make -C rmmod
|
||||
|
||||
#################################################
|
||||
# Clean up the source directory of any binaries #
|
||||
#################################################
|
||||
clean:
|
||||
make -C boot clean
|
||||
make -C kernel clean
|
||||
# make -C rmmod clean
|
||||
- rm *~
|
||||
|
||||
|
||||
|
||||
###########################################
|
||||
# The following is for the floppy drive #
|
||||
# Note: This must be done on *nix as root #
|
||||
###########################################
|
||||
|
||||
##########################
|
||||
# Make install to floppy #
|
||||
##########################
|
||||
install: Install_IPL File_Copy
|
||||
|
||||
############################################
|
||||
# Write the Stage 1 IPL to the boot sector #
|
||||
############################################
|
||||
Install_IPL:
|
||||
$(MKDOSFS_PROG) /dev/fd0
|
||||
dd if=boot/stage1.bin of=/dev/fd0
|
||||
|
||||
#################################
|
||||
# Copy the files onto the drive #
|
||||
#################################
|
||||
File_Copy:
|
||||
- mkdir floppy_mount
|
||||
@echo "Mounting floppy to ./floppy_mount..."
|
||||
mount /dev/fd0 ./floppy_mount
|
||||
|
||||
@echo "Copying stage 2 bootloader to the floppy..."
|
||||
$(COPY_BIN) boot/stage2.bin ./floppy_mount
|
||||
|
||||
@echo "Copying kernel to the floppy..."
|
||||
$(COPY_BIN) kernel/kernel.bin ./floppy_mount
|
||||
|
||||
@echo "Unmounting floppy..."
|
||||
umount ./floppy_mount
|
||||
- rm -rf floppy_mount
|
||||
|
||||
|
||||
############################################
|
||||
# The following is for the floppy image. #
|
||||
# Note: This must be done on *nix as root. #
|
||||
############################################
|
||||
|
||||
######################################
|
||||
# Create and Format the floppy image #
|
||||
######################################
|
||||
install_img:
|
||||
$(MKDOSFS_PROG) -C -F $(FLOPPY_FAT_SIZE) -r 112 $(FLOPPY_IMAGE) $(FLOPPY_BLOCK_COUNT)
|
||||
|
||||
############################################
|
||||
# Write the Stage 1 IPL to the boot sector #
|
||||
############################################
|
||||
@echo "Writing boot sector to image..."
|
||||
dd if=boot/stage1.bin of=$(FLOPPY_IMAGE) seek=0
|
||||
|
||||
#################################
|
||||
# Copy the files onto the image #
|
||||
#################################
|
||||
grub:
|
||||
- mkdir $(FLOPPY_MOUNT)
|
||||
@echo "Mounting floppy image..."
|
||||
mount $(FLOPPY_IMAGE) $(FLOPPY_MOUNT) -o loop
|
||||
mke2fs $(FLOPPY)
|
||||
mount -t ext2 $(FLOPPY) $(FLOPPY_MOUNT)
|
||||
grub-install --root-directory=$(FLOPPY_MOUNT) fd0
|
||||
umount $(FLOPPY_MOUNT)
|
||||
- rmdir $(FLOPPY_MOUNT)
|
||||
|
||||
@echo "Copying stage 2 bootloader to the floppy image..."
|
||||
$(COPY_BIN) boot/stage2.bin $(FLOPPY_MOUNT)
|
||||
@echo "Copying kernel to the floppy image..."
|
||||
$(COPY_BIN) kernel/kernel.bin $(FLOPPY_MOUNT)
|
||||
grub_image:
|
||||
dd if=$(FLOPPY) of=$(GRUB_IMAGE)
|
||||
|
||||
@echo "Unmounting floppy image..."
|
||||
mount $(FLOPPY_IMAGE) $(FLOPPY_MOUNT) -o loop
|
||||
install:
|
||||
- mkdir $(FLOPPY_MOUNT)
|
||||
mount -t ext2 $(FLOPPY) $(FLOPPY_MOUNT)
|
||||
cp kernel/kernel.bin $(FLOPPY_MOUNT)
|
||||
cp menu.lst $(FLOPPY_MOUNT)/boot/grub
|
||||
umount $(FLOPPY_MOUNT)
|
||||
- rmdir $(FLOPPY_MOUNT)
|
||||
|
||||
install_img:
|
||||
- mkdir $(FLOPPY_MOUNT)
|
||||
cp grub.flp $(FLOPPY_IMAGE)
|
||||
mount -t ext2 -o loop $(FLOPPY_IMAGE) $(FLOPPY_MOUNT)
|
||||
cp kernel/kernel.bin $(FLOPPY_MOUNT)
|
||||
cp menu.lst $(FLOPPY_MOUNT)/boot/grub
|
||||
umount $(FLOPPY_MOUNT)
|
||||
- rmdir $(FLOPPY_MOUNT)
|
||||
|
||||
Reference in new issue
Block a user