summaryrefslogtreecommitdiff
path: root/rakelib
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2025-08-28 22:45:42 +0200
committerEugen Wissner <belka@caraus.de>2025-08-30 01:29:00 +0200
commit627975775c941130975ce0f9dbef08c723e69794 (patch)
tree0f7f4c2c6d83420262d89ff720e6435a67410c9a /rakelib
parente614d43ea9af078301d538fcddb19e83eed7e879 (diff)
downloadelna-627975775c941130975ce0f9dbef08c723e69794.tar.gz
Start over
Diffstat (limited to 'rakelib')
-rw-r--r--rakelib/stage.rake61
1 files changed, 0 insertions, 61 deletions
diff --git a/rakelib/stage.rake b/rakelib/stage.rake
deleted file mode 100644
index 6f61cae..0000000
--- a/rakelib/stage.rake
+++ /dev/null
@@ -1,61 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public License,
-# v. 2.0. If a copy of the MPL was not distributed with this file, You can
-# obtain one at https://mozilla.org/MPL/2.0/. -}
-# frozen_string_literal: true
-
-CROSS_GCC = 'build/rootfs/bin/riscv32-unknown-linux-gnu-gcc'
-SYSROOT = 'build/sysroot'
-QEMU = 'qemu-riscv32'
-
-def assemble_stage(output, compiler, source)
- arguments = [QEMU, '-L', SYSROOT, *compiler]
-
- puts Term::ANSIColor.green(arguments * ' ')
- puts
- Open3.popen2(*arguments) do |qemu_in, qemu_out|
- qemu_in.write File.read(*source)
- qemu_in.close
-
- IO.copy_stream qemu_out, output
- qemu_out.close
- end
-end
-
-library = []
-
-Dir.glob('boot/*.s').each do |assembly_source|
- source_basename = Pathname.new(assembly_source).basename
- target_object = Pathname.new('build/boot') + source_basename.sub_ext('.o')
-
- file target_object.to_s => [assembly_source, 'build/boot'] do |t|
- sh CROSS_GCC, '-c', '-o', t.name, assembly_source
- end
- library << assembly_source unless source_basename.to_s.start_with? 'stage'
-end
-
-desc 'Initial stage'
-file 'build/boot/stage1' => ['build/boot/stage1.o', *library] do |t|
- sh CROSS_GCC, '-nostdlib', '-o', t.name, *t.prerequisites
-end
-
-file 'build/boot/stage2a.s' => ['build/boot/stage1', 'boot/stage2.elna'] do |t|
- source, exe = t.prerequisites.partition { |prerequisite| prerequisite.end_with? '.elna' }
-
- File.open t.name, 'w' do |output|
- assemble_stage output, exe, source
- end
-end
-
-['build/boot/stage2a', 'build/boot/stage2b'].each do |exe|
- file exe => [exe.ext('.s'), *library] do |t|
- sh CROSS_GCC, '-nostdlib', '-o', t.name, *t.prerequisites
- end
-end
-
-file 'build/boot/stage2b.s' => ['build/boot/stage2a', 'boot/stage2.elna'] do |t|
- source, exe = t.prerequisites.partition { |prerequisite| prerequisite.end_with? '.elna' }
-
- File.open t.name, 'w' do |output|
- assemble_stage output, exe, source
- end
-end