build: autocompilation avec choix des révisions et configuration de la compilation
This commit is contained in:
parent
14fe26752f
commit
ff367b8462
|
@ -95,6 +95,7 @@ Autres commandes de compilation de COS2000
|
||||||
* `./make.sh debug-boot` debogue le système en mode réel depuis le boot
|
* `./make.sh debug-boot` debogue le système en mode réel depuis le boot
|
||||||
* `./make.sh debug-loader` debogue le système en mode réel depuis le loader
|
* `./make.sh debug-loader` debogue le système en mode réel depuis le loader
|
||||||
* `./make.sh debug-system` debogue le système en mode protégé
|
* `./make.sh debug-system` debogue le système en mode protégé
|
||||||
|
* `./make.sh config` change la configuration de la compilation
|
||||||
|
|
||||||
### Utilisation
|
### Utilisation
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
docker build . -t cos2000-compiler-alpine
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
docker build . -t cos2000-compiler
|
|
|
@ -1,9 +0,0 @@
|
||||||
FROM debian:10
|
|
||||||
|
|
||||||
RUN apt-get update -yq \
|
|
||||||
&& apt-get install --no-install-recommends gcc make qemu fusefat fuseext2 gdb ovmf xz-utils psmisc tmux git libc6-dev bsdmainutils tar wget bsdmainutils indent binutils xxd bochs bochs-x bochsbios dos2unix nasm gnome-terminal spice-client-gtk python2.7 qemu-system-x86 -yq \
|
|
||||||
&& apt-get clean -y
|
|
||||||
RUN wget http://ftp.fr.debian.org/debian/pool/main/c/cramfs/cramfsprogs_1.1-6_amd64.deb -O /tmp/cramfsprogs_1.1-6_amd64.deb
|
|
||||||
RUN dpkg -i /tmp/cramfsprogs_1.1-6_amd64.deb
|
|
||||||
RUN mkdir /data
|
|
||||||
WORKDIR /data
|
|
|
@ -3,8 +3,6 @@ RUN echo "http://alpine.42.fr/v3.12/main" > /etc/apk/repositories
|
||||||
RUN echo "http://alpine.42.fr/v3.12/community" >> /etc/apk/repositories
|
RUN echo "http://alpine.42.fr/v3.12/community" >> /etc/apk/repositories
|
||||||
RUN apk --no-cache update
|
RUN apk --no-cache update
|
||||||
RUN apk --no-cache upgrade
|
RUN apk --no-cache upgrade
|
||||||
RUN apk --no-cache add font-noto git gcc make qemu qemu-system-i386 dosfstools qemu-system-x86_64 nasm sed gdb ovmf tar wget gzip indent binutils hexdump dos2unix xxd xz tmux git musl-dev gnome-terminal spice-gtk spice-gtk-tools python2 cramfs
|
RUN apk --no-cache add font-noto git gcc make qemu qemu-system-i386 dosfstools nasm sed gdb tar wget gzip indent binutils hexdump dos2unix xxd tmux git musl-dev gnome-terminal spice-gtk spice-gtk-tools python2
|
||||||
RUN mkdir -p /usr/share/qemu/
|
|
||||||
RUN ln -s /usr/share/OVMF/OVMF.fd /usr/share/qemu/OVMF.fd
|
|
||||||
RUN mkdir /data
|
RUN mkdir /data
|
||||||
WORKDIR /data
|
WORKDIR /data
|
|
@ -0,0 +1,7 @@
|
||||||
|
FROM debian:10
|
||||||
|
|
||||||
|
RUN apt-get update -yq \
|
||||||
|
&& apt-get install --no-install-recommends gcc make qemu dosfstools gdb psmisc tmux git libc6-dev bsdmainutils tar wget bsdmainutils indent binutils xxd dos2unix nasm gnome-terminal spice-client-gtk python2.7 qemu-system-x86 -yq \
|
||||||
|
&& apt-get clean -y
|
||||||
|
RUN mkdir /data
|
||||||
|
WORKDIR /data
|
|
@ -3,7 +3,7 @@ all: cos2000.img
|
||||||
cos2000.img:
|
cos2000.img:
|
||||||
(dd if=/dev/zero of=cos2000.img count=2880 bs=512)
|
(dd if=/dev/zero of=cos2000.img count=2880 bs=512)
|
||||||
(mkfs.msdos -F 12 -n "COS2000" cos2000.img;mkdir ./mnt || true)
|
(mkfs.msdos -F 12 -n "COS2000" cos2000.img;mkdir ./mnt || true)
|
||||||
(mount cos2000.img ./mnt -o rw)
|
(mount -t vfat cos2000.img ./mnt -o rw)
|
||||||
(cp ../boot/loader.sys ./mnt/)
|
(cp ../boot/loader.sys ./mnt/)
|
||||||
(cp ../system/system.sys ./mnt/;sync)
|
(cp ../system/system.sys ./mnt/;sync)
|
||||||
(umount ./mnt)
|
(umount ./mnt)
|
||||||
|
|
50
make.sh
50
make.sh
|
@ -1,23 +1,47 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
function tool {
|
||||||
|
echo "*** Fabrication des outils de compilation par Docker (version ${VERSION} config ${CONFIGURATION})"
|
||||||
|
docker build - -t $COMPILER < ./docker/dockerfile.${CONFIGURATION}
|
||||||
|
}
|
||||||
|
|
||||||
|
function configuration {
|
||||||
|
echo "*** Création du fichier de configuration"
|
||||||
|
echo -en "compilation=alpine\nvideo=vesa" > ./configuration
|
||||||
|
}
|
||||||
|
|
||||||
echo "Autorisation de docker à se connecter à l'écran :0"
|
echo "Autorisation de docker à se connecter à l'écran :0"
|
||||||
xhost +local:docker
|
xhost +local:docker
|
||||||
DOCKER=$(docker -v| grep build)
|
|
||||||
ALPINE=$(docker image ls| grep cos2000-compiler-alpine)
|
|
||||||
COMPILER=$(docker image ls| grep cos2000-compiler)
|
|
||||||
PWD=$(pwd)
|
PWD=$(pwd)
|
||||||
|
FILE=${PWD}/configuration
|
||||||
|
if [ ! -f "$FILE" ]; then
|
||||||
|
configuration
|
||||||
|
fi
|
||||||
|
DOCKER=$(docker -v| grep build)
|
||||||
if [ "${DOCKER}" == "" ]; then
|
if [ "${DOCKER}" == "" ]; then
|
||||||
echo "Docker n'est pas installé..."
|
echo "Docker n'est pas installé..."
|
||||||
echo "*** installation si sous gestionnaire de paquet debian (.deb)"
|
echo "*** installation si sous gestionnaire de paquet debian (.deb)"
|
||||||
sudo apt-get install docker
|
sudo apt-get install docker
|
||||||
exit
|
exit
|
||||||
elif [ "${ALPINE}" != "" ]; then
|
fi
|
||||||
echo "*** lancement de la version Alpine Linux"
|
CONFIGURATION=$(sed -rn 's/^compilation=([^\n]+)$/\1/p' ./configuration)
|
||||||
docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --privileged -v ${PWD}:/data cos2000-compiler-alpine make $1
|
VERSION=$(git rev-parse --short HEAD)
|
||||||
elif [ "${COMPILER}" != "" ]; then
|
COMPILER=cos2000-compiler-${CONFIGURATION}-${VERSION}
|
||||||
echo "*** lancement de la version Debian"
|
if [ "$1" == "tool" ]; then
|
||||||
docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --privileged -v ${PWD}:/data cos2000-compiler make $1
|
tool
|
||||||
else
|
exit
|
||||||
echo "Docker est installé mais aucune image docker n'est fonctionnelle..."
|
fi
|
||||||
echo "*** compilation de l'image docker"
|
if [ "$1" == "configuration" ]; then
|
||||||
docker build ${PWD}/docker/alpine -t cos2000-compiler-alpine
|
configuration
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
PRESENT=$(docker image ls| grep $COMPILER)
|
||||||
|
if [ "${PRESENT}" == "" ]; then
|
||||||
|
tool
|
||||||
|
fi
|
||||||
|
echo "*** lancement de la version ${VERSION}"
|
||||||
|
if [ "$1" == "config" ]; then
|
||||||
|
docker run --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --privileged -v ${PWD}:/data $COMPILER make $1
|
||||||
|
else
|
||||||
|
docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --privileged -v ${PWD}:/data $COMPILER make $1
|
||||||
fi
|
fi
|
||||||
|
|
11
makefile
11
makefile
|
@ -8,6 +8,7 @@ clean:
|
||||||
(cd boot; make clean)
|
(cd boot; make clean)
|
||||||
(cd lib;make clean)
|
(cd lib;make clean)
|
||||||
(cd final;make clean)
|
(cd final;make clean)
|
||||||
|
rm -f configuration
|
||||||
sync
|
sync
|
||||||
|
|
||||||
backup: clean
|
backup: clean
|
||||||
|
@ -49,3 +50,13 @@ boot/boot12.bin:
|
||||||
|
|
||||||
lib/libs.o:
|
lib/libs.o:
|
||||||
(cd lib; make)
|
(cd lib; make)
|
||||||
|
|
||||||
|
config:
|
||||||
|
@echo "*** Options de compilation"
|
||||||
|
@echo "Quelle distribution utiliser avec Docker comme environnement de compilation ?"
|
||||||
|
@echo "Alpine Linux ou Debian [A*/D]"
|
||||||
|
@read line; if [ $$line = "D" ]; then sed -i -r 's/compilation=.*/compilation=debian/' configuration ; else sed -i -r 's/compilation=.*/compilation=alpine/' configuration ; fi
|
||||||
|
@echo "Quel mode vidéo préférez vous utiliser ?"
|
||||||
|
@echo "VESA ou VGA [E*/G]"
|
||||||
|
@read line; if [ $$line = "G" ]; then sed -i -r 's/video=.*/video=vga/' configuration ; else sed -i -r 's/video=.*/video=vesa/' configuration ; fi
|
||||||
|
|
||||||
|
|
34
menu.sh
34
menu.sh
|
@ -32,6 +32,7 @@ echo "7 Tuer tout les processus"
|
||||||
echo "8 Nettoyer les sources"
|
echo "8 Nettoyer les sources"
|
||||||
echo "9 Voir le disque en hexadécimal"
|
echo "9 Voir le disque en hexadécimal"
|
||||||
echo "c Changer la version de developpement"
|
echo "c Changer la version de developpement"
|
||||||
|
echo "o Changer les options de développement"
|
||||||
echo "0 Quitter"
|
echo "0 Quitter"
|
||||||
echo "------------------------------------------"
|
echo "------------------------------------------"
|
||||||
echo "Choisissez l'action à réaliser..."
|
echo "Choisissez l'action à réaliser..."
|
||||||
|
@ -48,20 +49,38 @@ case "${answer}" in
|
||||||
7) ./make.sh killer;;
|
7) ./make.sh killer;;
|
||||||
8) ./make.sh clean;;
|
8) ./make.sh clean;;
|
||||||
9) ./make.sh view|more;;
|
9) ./make.sh view|more;;
|
||||||
c) echo "Version disponibles:"
|
o*) ./make.sh config
|
||||||
|
./make.sh tool
|
||||||
|
;;
|
||||||
|
c*) echo "Version disponibles:"
|
||||||
SELECT=$(git branch|grep "*"|tr -d "* ")
|
SELECT=$(git branch|grep "*"|tr -d "* ")
|
||||||
NUM=1
|
NUM=1
|
||||||
|
echo "XX Hash d'une révision particulière"
|
||||||
while read LINE
|
while read LINE
|
||||||
do
|
do
|
||||||
echo "${NUM} ${LINE}"
|
echo "${NUM} ${LINE}"
|
||||||
(( NUM++ ))
|
(( NUM++ ))
|
||||||
done < <(git branch -lr|tr -d "* "|grep -v HEAD|sed s/".*origin\/"//)
|
done < <(git branch -lr|tr -d "* "|grep -v HEAD|sed s/".*origin\/"//)
|
||||||
read ANSWER
|
read -p"?" ANSWER
|
||||||
CHOOSE=$(git branch -lr|tr -d "* "|grep -v HEAD|sed s/".*origin\/"//|tr "\n" " "|cut -d " " -f${ANSWER})
|
COUNT=$(echo -n ${ANSWER}|wc -c)
|
||||||
echo "vous avez selectionné $ALL..."
|
if [ "${COUNT}" == "1" ]; then
|
||||||
git checkout $CHOOSE
|
CHOOSE=$(git branch -lr|tr -d "* "|grep -v HEAD|sed s/".*origin\/"//|tr "\n" " "|cut -d " " -f${ANSWER})
|
||||||
git clean -fd
|
echo "vous avez selectionné une branche $CHOOSE..."
|
||||||
git reset --hard
|
else
|
||||||
|
EXIST=$(git show ${ANSWER})
|
||||||
|
if [ "${EXIST}" != "" ]; then
|
||||||
|
CHOOSE=${ANSWER}
|
||||||
|
echo "vous avez selectionné une révision ${choose}..."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "${CHOOSE}" != "" ]; then
|
||||||
|
echo "*** Application de la version ${CHOOSE}"
|
||||||
|
git checkout $CHOOSE
|
||||||
|
git clean -fd
|
||||||
|
git reset --hard
|
||||||
|
git pull -f
|
||||||
|
./make.sh tool
|
||||||
|
fi
|
||||||
read
|
read
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -70,3 +89,4 @@ esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue