Merge branch 'feature/pipeline' into 'develop'

Recreated Cleaner Build Pipeline

See merge request spexeah/asuro!17
This commit is contained in:
Aaron Hance 2021-06-27 00:32:10 +00:00
commit 40b2c8efb7
22 changed files with 157 additions and 358 deletions

View File

@ -1,39 +1,66 @@
# This file is a template, and might need editing before it works on your project. stages:
# see https://docs.gitlab.com/ee/ci/yaml/README.html for all available options - Generate Stub and Versions
- Generate Version Files
- Compile Sources
- Link
- Generate ISO
.before_script: compile_stub:
- echo "Before script section" stage: Generate Stub and Versions
- echo "For example you might run an update here or install a build dependency" script:
- echo "Or perhaps you might print out some debugging details" - chmod +x ./compile_stub.sh
- ./compile_stub.sh
.after_script: artifacts:
- echo "After script section" paths:
- echo "For example you might do some cleanup here" - lib/stub.o
build: vergen:
stage: build stage: Generate Stub and Versions
tags: script:
- asuro - chmod +x ./compile_vergen.sh
script: ./compile.sh - ./compile_vergen.sh
artifacts: artifacts:
paths: paths:
- release/Asuro.iso
- iso/boot/asuro.bin
- release/*.svg - release/*.svg
- src/include/asuro.pas
.test1: compile_sources:
stage: test stage: Compile Sources
script: script:
- echo "Do a test here" - chmod +x ./compile_sources.sh
- echo "For example run a test suite" - ./compile_sources.sh
artifacts:
paths:
- lib/*.o
dependencies:
- compile_stub
- vergen
needs:
- vergen
- compile_stub
.test2: link:
stage: test stage: Link
script: script:
- echo "Do another parallel test here" - chmod +x ./compile_link.sh
- echo "For example run a lint test" - ./compile_link.sh
artifacts:
paths:
- bin/kernel.bin
dependencies:
- compile_sources
needs:
- compile_sources
.deploy1: isogen:
stage: deploy stage: Generate ISO
script: script:
- echo "Do your deploy here" - chmod +x ./compile_isogen.sh
- ./compile_isogen.sh
artifacts:
paths:
- ./Asuro.iso
dependencies:
- link
needs:
- link

View File

@ -2,8 +2,8 @@ FROM ubuntu:latest
VOLUME ["/code"] VOLUME ["/code"]
RUN dpkg --add-architecture i386 && \ RUN dpkg --add-architecture i386
apt-get update RUN apt-get update
RUN apt-get install nasm curl make:i386 binutils:i386 xorriso grub-pc-bin dos2unix -y RUN apt-get install nasm curl make:i386 binutils:i386 xorriso grub-pc-bin dos2unix -y
RUN apt-get clean RUN apt-get clean
RUN curl https://sourceforge.net/projects/freepascal/files/Linux/2.6.4/fpc-2.6.4.i386-linux.tar/download --output fpc.tar -L && \ RUN curl https://sourceforge.net/projects/freepascal/files/Linux/2.6.4/fpc-2.6.4.i386-linux.tar/download --output fpc.tar -L && \

View File

@ -2,18 +2,12 @@
ERRCOUNT=0 ERRCOUNT=0
echo " " echo " "
echo "=======================" echo "======================="
echo "== ASURO COMPILATION =="
echo "======================="
echo " " echo " "
echo "Checking out latest VM Source..." echo "Asuro Compilation"
echo " " echo " "
./updatevm.sh
echo " "
echo "Compiling ASM Stub..."
echo " "
rm lib/*
nasm -f elf src/stub/stub.asm -o lib/stub.o #Compile Stub.asm
./compile_stub.sh
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "Failed to compile stub!" echo "Failed to compile stub!"
@ -22,47 +16,23 @@ else
echo "Success." echo "Success."
fi fi
echo " " #Generate .pas with versioning headers.
echo "=======================" ./compile_vergen.sh
echo " "
./versioning.sh
if [ "$1" = "-d" ]
then
echo "Compiling Debug FPC Sources..."
echo " "
fpc -Aelf -gw -n -va -O3 -Op3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/driver/* src/kernel.pas
else
echo "Compiling FPC Sources..."
echo " "
fpc -Aelf -gw -n -va -O3 -Op3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/driver/* -Fusrc/driver/net/* src/kernel.pas
fi
#Compile all .pas sources
./compile_sources.sh
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo " "
echo "Failed to compile FPC Sources!" echo "Failed to compile FPC Sources!"
ERRCOUNT=$((ERRCOUNT+1)) ERRCOUNT=$((ERRCOUNT+1))
else else
echo " "
echo "Success." echo "Success."
fi fi
echo " " #Link into a binary.
echo "=======================" ./compile_link.sh
echo " "
echo "Linking..."
echo " "
objstring="";
for object in `find lib/ -name "*.o"`; do
if [ "$object" != "lib/stub.o" ]
then
objstring=$objstring$object" ";
fi
done;
objstring=lib/stub.o" "$objstring
echo "Object Files: "$objstring
echo " "
ld -m elf_i386 -s --gc-sections -Tlinker.script -o bin/kernel.bin $objstring
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "Failed linking!" echo "Failed linking!"
@ -71,13 +41,8 @@ else
echo "Success." echo "Success."
fi fi
echo " " #Generate an ISO with GRUB as the Bootloader.
echo "=======================" ./compile_isogen.sh
echo " "
echo "Creating ISO..."
echo " "
cp bin/kernel.bin iso/boot/asuro.bin
grub-mkrescue -o Asuro.iso iso
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "Failed to create ISO!" echo "Failed to create ISO!"
@ -86,27 +51,12 @@ else
echo "Success." echo "Success."
fi fi
echo " " #Call generate final artifacts based on failure or success of the above.
echo "======================="
echo " "
if [ "$ERRCOUNT" -ne "0" ] if [ "$ERRCOUNT" -ne "0" ]
then then
echo "$ERRCOUNT Errors Occurred, please review." ./compile_finish.sh "failed"
wget -q https://img.shields.io/badge/build-failed-red.svg -O release/build.svg
else else
echo "No errors." ./compile_finish.sh "success"
wget -q https://img.shields.io/badge/build-succeeded-green.svg -O release/build.svg
fi fi
echo " "
echo "======================="
echo " "
#cp Asuro.iso ~/host/Asuro.iso
cp Asuro.iso release/Asuro.iso
checksum=$(md5sum release/Asuro.iso | awk '{print $1}')
wget -q https://img.shields.io/badge/checksum-$checksum-important.svg -O release/checksum.svg
cd release
touch *
#svn commit -m "Versioning Auto-Commit"
cd .. cd ..

View File

@ -1,7 +0,0 @@
#!/bin/sh
ERRCOUNT=0
echo "======================="
echo "== ASURO =="
echo "======================="
./compile.sh
./run.sh

View File

@ -1,7 +0,0 @@
#!/bin/sh
ERRCOUNT=0
echo "======================="
echo "== ASURO =="
echo "======================="
./compile.sh -d
./run.sh -d

0
checksum.sh → compile_checksum.sh Executable file → Normal file
View File

View File

@ -1,2 +0,0 @@
#!/bin/sh
./compile.sh -d

18
compile_finish.sh Normal file
View File

@ -0,0 +1,18 @@
#/bin/sh
echo " "
echo "======================="
echo " "
if [ "$1" == "failed" ]
then
echo "Errors Occurred, please review."
wget -q https://img.shields.io/badge/build-failed-red.svg -O release/build.svg 2>/dev/null
echo " "
echo "======================="
exit 1
else
echo "No errors."
wget -q https://img.shields.io/badge/build-succeeded-green.svg -O release/build.svg 2>/dev/null
echo " "
echo "======================="
exit 0
fi

8
compile_isogen.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/sh
echo " "
echo "======================="
echo " "
echo "Creating ISO..."
echo " "
cp bin/kernel.bin iso/boot/asuro.bin
grub-mkrescue -o Asuro.iso iso

17
compile_link.sh Normal file
View File

@ -0,0 +1,17 @@
#!/bin/sh
echo " "
echo "======================="
echo " "
echo "Linking..."
echo " "
objstring="";
for object in `find lib/ -name "*.o"`; do
if [ "$object" != "lib/stub.o" ]
then
objstring=$objstring$object" ";
fi
done;
objstring=lib/stub.o" "$objstring
echo "Object Files: "$objstring
echo " "
ld -m elf_i386 -s --gc-sections -Tlinker.script -o bin/kernel.bin $objstring

7
compile_sources.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/sh
echo " "
echo "======================="
echo " "
echo "Compiling FPC Sources..."
echo " "
fpc -Aelf -gw -n -va -O3 -Op3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/driver/* -Fusrc/driver/net/* src/kernel.pas

8
compile_stub.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/sh
echo " "
echo "======================="
echo " "
echo "Compiling Stub..."
echo " "
rm lib/*
nasm -f elf src/stub/stub.asm -o lib/stub.o

8
compile_sumgen.sh Normal file
View File

@ -0,0 +1,8 @@
#/bin/sh
echo " "
echo "======================="
echo " "
echo "Generating Checksum Badge..."
echo " "
checksum=$(md5sum Asuro.iso | awk '{print $1}')
wget -q https://img.shields.io/badge/checksum-$checksum-important.svg -O release/checksum.svg 2>/dev/null

29
versioning.sh → compile_vergen.sh Executable file → Normal file
View File

@ -1,6 +1,11 @@
#!/bin/bash #!/bin/bash
echo " "
echo "======================="
echo " "
echo "Generating Versioning Info..." echo "Generating Versioning Info..."
./checksum.sh echo " "
chmod +x ./compile_checksum.sh
./compile_checksum.sh
outfile="src/include/asuro.pas" outfile="src/include/asuro.pas"
file="version" file="version"
while IFS=: read -r line;do while IFS=: read -r line;do
@ -44,15 +49,15 @@ echo "implementation" >> $outfile
echo " " >> $outfile echo " " >> $outfile
echo "end." >> $outfile echo "end." >> $outfile
echo "Generating release info..." echo "Generating release info..."
wget -q https://img.shields.io/badge/version-$major.$minor.$sub--$revision$release-blue.svg -O release/version.svg wget -q https://img.shields.io/badge/version-$major.$minor.$sub--$revision$release-blue.svg -O release/version.svg 2>/dev/null
wget -q https://img.shields.io/badge/revision-$revision-blue.svg -O release/revision.svg wget -q https://img.shields.io/badge/revision-$revision-blue.svg -O release/revision.svg 2>/dev/null
wget -q https://img.shields.io/badge/release-$release-blue.svg -O release/release.svg wget -q https://img.shields.io/badge/release-$release-blue.svg -O release/release.svg 2>/dev/null
wget -q https://img.shields.io/badge/lines-$linecount-blueviolet.svg -O release/lines.svg wget -q https://img.shields.io/badge/lines-$linecount-blueviolet.svg -O release/lines.svg 2>/dev/null
wget -q https://img.shields.io/badge/files-$sourcecount-blueviolet.svg -O release/files.svg wget -q https://img.shields.io/badge/files-$sourcecount-blueviolet.svg -O release/files.svg 2>/dev/null
wget -q https://img.shields.io/badge/drivers-$drivercount-blueviolet.svg -O release/drivers.svg wget -q https://img.shields.io/badge/drivers-$drivercount-blueviolet.svg -O release/drivers.svg 2>/dev/null
wget -q https://img.shields.io/badge/FPC_version-$fpcversion-lightgrey.svg -O release/fpcversion.svg wget -q https://img.shields.io/badge/FPC_version-$fpcversion-lightgrey.svg -O release/fpcversion.svg 2>/dev/null
wget -q https://img.shields.io/badge/NASM_version-$nasmversion-lightgrey.svg -O release/nasmversion.svg wget -q https://img.shields.io/badge/NASM_version-$nasmversion-lightgrey.svg -O release/nasmversion.svg 2>/dev/null
wget -q https://img.shields.io/badge/MAKE_version-$makeversion-lightgrey.svg -O release/makeversion.svg wget -q https://img.shields.io/badge/MAKE_version-$makeversion-lightgrey.svg -O release/makeversion.svg 2>/dev/null
wget -q https://img.shields.io/badge/release_date-$compiledate-lightgrey.svg -O release/date.svg wget -q https://img.shields.io/badge/release_date-$compiledate-lightgrey.svg -O release/date.svg 2>/dev/null
wget -q https://img.shields.io/badge/fingerprint-$checksum-important.svg -O release/fingerprint.svg wget -q https://img.shields.io/badge/fingerprint-$checksum-important.svg -O release/fingerprint.svg 2>/dev/null
echo "Done versioning." echo "Done versioning."

View File

@ -1,113 +0,0 @@
#!/bin/sh
ERRCOUNT=0
echo " "
echo "==================================="
echo "== ASURO DEV ENVIRONMENT INSTALL =="
echo "==================================="
echo " "
echo "Installing Build Essentials..."
sudo apt-get install build-essential:i386
if [ $? -ne 0 ]
then
echo "Failed to install!"
ERRCOUNT=$((ERRCOUNT+1))
else
echo "Success."
fi
echo " "
echo "Installing NASM..."
sudo apt-get install nasm
if [ $? -ne 0 ]
then
echo "Failed to install!"
ERRCOUNT=$((ERRCOUNT+1))
else
echo "Success."
fi
echo " "
echo "Installing Bin-Utils..."
sudo apt-get install binutils:i386
if [ $? -ne 0 ]
then
echo "Failed to install!"
ERRCOUNT=$((ERRCOUNT+1))
else
echo "Success."
fi
echo " "
echo "Installing FPC Sources..."
sudo apt-get install fpc-src:i386
if [ $? -ne 0 ]
then
echo "Failed to install!"
ERRCOUNT=$((ERRCOUNT+1))
else
echo "Success."
fi
echo " "
echo "Installing FPC..."
sudo apt-get install fpc:i386
if [ $? -ne 0 ]
then
echo "Failed to install!"
ERRCOUNT=$((ERRCOUNT+1))
else
echo "Success."
fi
echo " "
echo "Installing QEmu..."
sudo apt-get install qemu
if [ $? -ne 0 ]
then
echo "Failed to install!"
ERRCOUNT=$((ERRCOUNT+1))
else
echo "Success."
fi
echo " "
echo "Installing xorriso..."
sudo apt-get install xorriso
if [ $? -ne 0 ]
then
echo "Failed to install!"
ERRCOUNT=$((ERRCOUNT+1))
else
echo "Success."
fi
echo " "
echo "Installing GRUB PC Bin..."
sudo apt-get install grub-pc-bin
if [ $? -ne 0 ]
then
echo "Failed to install!"
ERRCOUNT=$((ERRCOUNT+1))
else
echo "Success."
fi
echo " "
echo "WARNING: We assume you already have Grub installed."
echo " Asuro depends on grub-mkrescue."
echo " "
echo "======================="
echo " "
if [ "$ERRCOUNT" -ne "0" ]
then
echo "$ERRCOUNT Errors Occurred, please review."
else
echo "No errors."
fi
echo " "
echo "======================="
echo " "

View File

@ -1,53 +0,0 @@
#!/bin/sh
ERRCOUNT=0
echo " "
echo "======================="
echo "== ASURO MOUNT =="
echo "======================="
echo " "
echo "Mounting Asuro..."
sudo modprobe nbd
if [ $? -ne 0 ]
then
echo "Failed load nbd!"
ERRCOUNT=$((ERRCOUNT+1))
fi
sudo qemu-nbd --connect=/dev/nbd0 IMAGE.img
if [ $? -ne 0 ]
then
echo "Failed to mount Image!"
ERRCOUNT=$((ERRCOUNT+1))
fi
sudo partx -a /dev/nbd0
if [ $? -ne 0 ]
then
echo "Failed to find Partitions!"
ERRCOUNT=$((ERRCOUNT+1))
fi
sudo mount /dev/nbd0p1 /mnt/asuro
if [ $? -ne 0 ]
then
echo "Failed to mount Asuro!"
ERRCOUNT=$((ERRCOUNT+1))
fi
echo " "
echo "======================="
echo " "
if [ "$ERRCOUNT" -ne "0" ]
then
./unmount.sh
echo " "
echo "======================="
echo " "
echo "$ERRCOUNT Errors Occurred, please review."
else
echo "No errors."
fi
echo " "
echo "======================="
echo " "

38
run.sh
View File

@ -1,38 +0,0 @@
#!/bin/sh
ERRCOUNT=0
echo " "
echo "======================="
echo "== ASURO OPERATION =="
echo "======================="
echo " "
echo "Running Asaro..."
if [ "$1" = "-d" ]
then
qemu-system-i386 -hda IMAGE.img -serial pty -s -S -cdrom Asuro.iso&
sleep 1
gdb -ex "target remote localhost:1234"
else
qemu-system-i386 -hda IMAGE.img -serial pty -monitor stdio -cdrom Asuro.iso
fi
if [ $? -ne 0 ]
then
echo "Failed to run Asaro!"
ERRCOUNT=$((ERRCOUNT+1))
else
echo "Finished Successfully."
fi
echo " "
echo "======================="
echo " "
if [ "$ERRCOUNT" -ne "0" ]
then
echo "$ERRCOUNT Errors Occurred, please review."
else
echo "No errors."
fi
echo " "
echo "======================="
echo " "

View File

@ -1,2 +0,0 @@
#!/bin/sh
bochs

View File

@ -1,11 +0,0 @@
#!/bin/sh
ERRCOUNT=0
echo " "
echo "========================="
echo "== ASURO UNMOUNT =="
echo "========================="
echo " "
echo "Unmounting Asuro..."
sudo umount /mnt/asuro
sudo qemu-nbd --disconnect /dev/nbd0
sudo rmmod nbd

View File

@ -1,6 +0,0 @@
#!/bin/sh
DIRECTORY="src/vm"
rm -rf /tmp/MINJ
git clone https://gitlab.spexeah.com/spexeah/MINJ.git /tmp/MINJ
rm -rf $DIRECTORY
cp -rf /tmp/MINJ/src/vm $DIRECTORY

View File

@ -1,7 +0,0 @@
#!/bin/sh
ERRCOUNT=0
echo "======================="
echo "== ASURO =="
echo "======================="
./compile.sh
./vbox.sh

View File

@ -1,3 +0,0 @@
#name ur machine "asuro"
VBoxManage startvm "asuro"