quinn-os/make_distimage.sh
2022-07-11 20:00:28 +10:00

115 lines
2.2 KiB
Bash
Executable File

#!/bin/bash -e
cd $HOME/Quinn
if [ ! -e images ]
then
mkdir images
fi
cd images
dd if=/dev/zero of=disk.img bs=512 count=331072
sed -e 's/\t\([\+0-9a-zA-Z]*\)[ \t].*/\1/' << EOF | /sbin/fdisk disk.img
n # new partition
p # primary partition
1 # partition number 1
# default - start at beginning of disk
# default - whole disk
a # make the partition active
w # write the partition table
q # and we're done
EOF
sudo losetup /dev/loop0 disk.img
sudo losetup /dev/loop1 disk.img -o 1048576
sudo mkfs.minix -3 /dev/loop1
if [ ! -e mnt ]
then
mkdir mnt
fi
sudo mount -t minix /dev/loop1 mnt
sudo grub-install --target=i386-pc --root-directory=$HOME/Quinn/images/mnt --no-floppy --modules="normal part_msdos multiboot fat" /dev/loop0
if [ -e $HOME/Quinn/fsroot ]
then
rm -rf $HOME/Quinn/fsroot
fi
cd $HOME/Quinn/src/quinn-os
export PATH=$HOME/Quinn/cross/bin:$PATH
./make_userland.sh
mkdir $HOME/Quinn/fsroot/licenses
cp $HOME/Quinn/src/quinn-os/programs/freetype-2.12.1/docs/FTL.TXT $HOME/Quinn/fsroot/licenses/freetype.license
cp $HOME/Quinn/src/quinn-os/programs/freetype-2.12.1/docs/GPLv2.TXT $HOME/Quinn/fsroot/licenses/freetype-gplv2.license
cp $HOME/Quinn/src/quinn-os/programs/libpng-1.6.37/LICENSE $HOME/Quinn/fsroot/licenses/libpng.license
cp $HOME/Quinn/src/quinn-os/programs/zlib-1.2.12/README $HOME/Quinn/fsroot/licenses/zlib.license
cd $HOME/Quinn/src/quinn-os/programs/external
cd SDL
./make.sh
cd ..
cd SDL_image
./make.sh
cd ..
cd SDL_ttf
./make.sh
cd ..
cd PDCurses
./make.sh
cd ..
cd doom
./make.sh
cd ..
cd dungeonbash
./make.sh
cd ..
cd frotz
./make.sh
cd ..
#cd text
#./make.sh
#cd ..
cd my_basic
./make.sh
cd ..
cd nasm
./make.sh
cd ..
cd tcc
./make.sh
cd ..
cd brexx
./make.sh
cd ..
cp $HOME/Downloads/DOOM1.WAD $HOME/Quinn/fsroot/games/
sudo cp -R $HOME/Quinn/fsroot/* $HOME/Quinn/images/mnt
if [ ! -e $HOME/Quinn/src/quinn-os/kernel.bin ]
then
cd $HOME/Quinn/src/quinn-os
make clean
make
fi
sudo cp $HOME/Quinn/src/quinn-os/kernel.bin $HOME/Quinn/images/mnt
cd $HOME/Quinn/images
sudo umount mnt
sudo losetup -d /dev/loop0
sudo losetup -d /dev/loop1
qemu-img convert -f raw -O vmdk $HOME/Quinn/images/disk.img $HOME/Quinn/images/disk.vmdk