Browse Source

Use images in QCOW2 format.

Giovanni Mascellani 5 years ago
parent
commit
0e3a67ff1b
4 changed files with 21 additions and 17 deletions
  1. 4 4
      .gitlab-ci.yml
  2. 7 1
      Makefile
  3. 6 8
      README.md
  4. 4 4
      test/build_all_variants.sh

+ 4 - 4
.gitlab-ci.yml

@@ -16,7 +16,7 @@ stages:
 build:
   stage: build
   script:
-    - apt-get update -qq && apt-get install -y -qq build-essential nasm python3
+    - apt-get update -qq && apt-get install -y -qq build-essential nasm python3 qemu-utils
     - bash test/build_all_variants.sh
     - ls -l build/asmg.x86.exe build/asmg_dbg.x86.exe
   artifacts:
@@ -27,17 +27,17 @@ tests:
   stage: test
   script:
     - apt-get update -qq && apt-get install -y -qq python3 qemu-system-x86
-    - "(qemu-system-i386 -hda artifacts/tests/boot_asmg.x86 -serial stdio -device isa-debug-exit -display none -m 256M || true) | ./test/decode_tests.py"
+    - "(qemu-system-i386 -hda artifacts/tests/boot_asmg.x86.qcow2 -serial stdio -device isa-debug-exit -display none -m 256M || true) | ./test/decode_tests.py"
 
 mm0:
   stage: test
   script:
     - apt-get update -qq && apt-get install -y -qq python3 qemu-system-x86
-    - "(qemu-system-i386 -hda artifacts/mm0/boot_asmg.x86 -serial stdio -device isa-debug-exit -display none -m 256M || true) | ./test/decode_tests.py just_malloc"
+    - "(qemu-system-i386 -hda artifacts/mm0/boot_asmg.x86.qcow2 -serial stdio -device isa-debug-exit -display none -m 256M || true) | ./test/decode_tests.py just_malloc"
 
 tinycc:
   stage: test
   script:
     - apt-get update -qq && apt-get install -y -qq python3 qemu-system-x86
     - cd http && python3 -m http.server 8080 &
-    - "(qemu-system-i386 -hda artifacts/tinycc/boot_asmg.x86 -serial stdio -device isa-debug-exit -display none -m 256M || true) | ./test/decode_tests.py just_malloc"
+    - "(qemu-system-i386 -hda artifacts/tinycc/boot_asmg.x86.qcow2 -serial stdio -device isa-debug-exit -display none -m 256M || true) | ./test/decode_tests.py just_malloc"

+ 7 - 1
Makefile

@@ -1,5 +1,5 @@
 
-all: build build/boot_asmg.x86 build/boot_asmg_dbg.x86 build/boot_asmg0.x86
+all: build build/boot_asmg.x86.qcow2 build/boot_asmg_dbg.x86.qcow2 build/boot_asmg0.x86
 
 # Trivial things
 build:
@@ -79,6 +79,12 @@ build/boot_asmg.x86: build/bootloader.x86.mbr build/bootloader.x86.stage2 build/
 build/boot_asmg_dbg.x86: build/bootloader.x86.mbr build/bootloader.x86.stage2 build/asmg_dbg.x86 build/diskfs.img build/debugfs.img
 	./create_partition.py $^ > $@
 
+build/boot_asmg.x86.qcow2: build/boot_asmg.x86
+	qemu-img convert -O qcow2 $^ $@
+
+build/boot_asmg_dbg.x86.qcow2: build/boot_asmg_dbg.x86
+	qemu-img convert -O qcow2 $^ $@
+
 # Asmg0 kernel
 build/full-asmg0.asm: lib/mb_header.asm asmg0/asmg0.asm lib/shutdown.asm asmg0/debug.asm lib/top.asm
 	cat $^ | grep -v "^ *section " > $@

+ 6 - 8
README.md

@@ -32,7 +32,7 @@ You should use Linux to compile `asmc`, although some parts of it can
 also be built on macOS. If you use Debian, install the prerequisites
 with
 
-    sudo apt-get install build-essential nasm qemu-system-x86 python3 gcc-multilib
+    sudo apt-get install build-essential nasm qemu-system-x86 python3 qemu-utils
 
 If you cloned the GIT repository, you will probably want to checkout
 the submodules as well:
@@ -42,15 +42,13 @@ the submodules as well:
 
 Then just call `make` in the toplevel directory of the repository. A
 subdirectory named `build` will be created, with all compilation
-artifacts inside it. In particular `build/boot_asmg.x86` is a bootable
-disk image, which you can run with QEMU:
+artifacts inside it. In particular `build/boot_asmg.x86.qcow2` is a
+bootable disk image, which you can run with QEMU:
 
-    qemu-system-i386 -m 256M -hda build/boot_asmg.x86 -serial stdio -device isa-debug-exit -display none
+    qemu-system-i386 -m 256M -hda build/boot_asmg.x86.qcow2 -serial stdio -device isa-debug-exit -display none
 
-(if your host system supports it, you can add `-enable-kvm -cpu host`
-to benefit of KVM acceleration; `-cpu host` is currently required
-because `asmc` currently tries to use hardware performance counters,
-but at some point this will be fixed)
+(if your host system supports it, you can add `-enable-kvm` to benefit
+of KVM acceleration)
 
 Unless I have broken something, this should run a little operating
 system that compiles a little C compiler, and later uses such compiler

+ 4 - 4
test/build_all_variants.sh

@@ -11,25 +11,25 @@ sed -i -e 's|const TEST_ALL .|const TEST_ALL 1|' asmg/main.g
 sed -i -e 's|const RUN_MM0 .|const RUN_MM0 0|' asmg/main.g
 sed -i -e 's|const RUN_TINYCC .|const RUN_TINYCC 0|' asmg/main.g
 make
-cp build/boot_asmg.x86 build/boot_asmg_dbg.x86 artifacts/tests
+cp build/boot_asmg.x86.qcow2 build/boot_asmg_dbg.x86.qcow2 artifacts/tests
 
 rm -fr build
 sed -i -e 's|const TEST_ALL .|const TEST_ALL 0|' asmg/main.g
 sed -i -e 's|const RUN_MM0 .|const RUN_MM0 1|' asmg/main.g
 sed -i -e 's|const RUN_TINYCC .|const RUN_TINYCC 0|' asmg/main.g
 make
-cp build/boot_asmg.x86 build/boot_asmg_dbg.x86 artifacts/mm0
+cp build/boot_asmg.x86.qcow2 build/boot_asmg_dbg.x86.qcow2 artifacts/mm0
 
 rm -fr build
 sed -i -e 's|const TEST_ALL .|const TEST_ALL 0|' asmg/main.g
 sed -i -e 's|const RUN_MM0 .|const RUN_MM0 0|' asmg/main.g
 sed -i -e 's|const RUN_TINYCC .|const RUN_TINYCC 1|' asmg/main.g
 make
-cp build/boot_asmg.x86 build/boot_asmg_dbg.x86 artifacts/tinycc
+cp build/boot_asmg.x86.qcow2 build/boot_asmg_dbg.x86.qcow2 artifacts/tinycc
 
 rm -fr build
 sed -i -e 's|const TEST_ALL .|const TEST_ALL 1|' asmg/main.g
 sed -i -e 's|const RUN_MM0 .|const RUN_MM0 1|' asmg/main.g
 sed -i -e 's|const RUN_TINYCC .|const RUN_TINYCC 1|' asmg/main.g
 make
-cp build/boot_asmg.x86 build/boot_asmg_dbg.x86 artifacts/full
+cp build/boot_asmg.x86.qcow2 build/boot_asmg_dbg.x86.qcow2 artifacts/full