Coppy original mapping to the higher half
This commit is contained in:
17
Rakefile
17
Rakefile
@@ -144,11 +144,13 @@ namespace :cross do
|
||||
cwd = source_directory.dirname + 'build-binutils'
|
||||
cwd.mkpath
|
||||
options.rootfs.mkpath
|
||||
options.sysroot.mkpath
|
||||
|
||||
env = ENV.slice 'CC', 'CXX'
|
||||
configure_options = [
|
||||
"--prefix=#{options.rootfs.realpath}",
|
||||
"--target=#{options.target}",
|
||||
"--with-sysroot=#{options.sysroot.realpath}",
|
||||
'--disable-nls',
|
||||
'--enable-gprofng=no',
|
||||
'--disable-werror',
|
||||
@@ -167,7 +169,6 @@ namespace :cross do
|
||||
cwd = source_directory.dirname + 'build-gcc'
|
||||
cwd.mkpath
|
||||
options.rootfs.mkpath
|
||||
options.sysroot.mkpath
|
||||
|
||||
sh 'contrib/download_prerequisites', chdir: source_directory.to_path
|
||||
configure_options = options.configuration('-with-') + [
|
||||
@@ -354,10 +355,10 @@ rule '.elna.o' => ->(match) {
|
||||
} do |t|
|
||||
options = BuildTarget.new relative_from_tmp(t.name).first
|
||||
compiler = options.rootfs + "bin/#{options.target}-gcc"
|
||||
flags = ['-O2', '-g3', '-fno-stack-protector'] + options.configuration('m')
|
||||
sources = t.prerequisites.select { |prerequisite| File.extname(prerequisite) == '.elna' }
|
||||
|
||||
system compiler.to_s, *flags, '-c', '-o', t.name, *sources, exception: true
|
||||
system compiler.to_s, '-O2', '-g3', '-fno-stack-protector', *options.configuration('m'),
|
||||
'-c', '-o', t.name, *sources, exception: true
|
||||
end
|
||||
|
||||
rule 'kernel.elf' => ->(match) {
|
||||
@@ -373,17 +374,17 @@ rule 'kernel.elf' => ->(match) {
|
||||
objects << "arch/#{instruction_set}/kernel.ld"
|
||||
} do |t|
|
||||
options = BuildTarget.new relative_from_tmp(t.name).first
|
||||
compiler = options.rootfs + "bin/#{options.target}-gcc"
|
||||
flags = options.configuration('m')
|
||||
linker = options.rootfs + options.target + 'bin/ld'
|
||||
objects, linker_script = t.prerequisites.partition { |prerequisite| File.extname(prerequisite) == '.o' }
|
||||
|
||||
system compiler.to_s, '-nostdlib', '-T', *linker_script, '-o', t.name, *objects, exception: true
|
||||
system linker.to_s, '-nostdlib', '-T', *linker_script, '-o', t.name, *objects, exception: true
|
||||
end
|
||||
|
||||
task default: 'build/riscv32/kernel.elf'
|
||||
task :default do |t|
|
||||
QEMU = 'qemu-system-riscv32'
|
||||
|
||||
system QEMU, '-machine', 'virt', '-bios', 'default', '-nographic', '-serial', 'mon:stdio', '--no-reboot',
|
||||
'-kernel', t.prerequisites.last, exception: true
|
||||
system QEMU, '-machine', 'virt', '-nographic', '-serial', 'mon:stdio', '--no-reboot',
|
||||
'-bios', '../opensbi-1.7-rv-bin/share/opensbi/ilp32/generic/firmware/fw_jump.bin',
|
||||
'-device', "loader,file=#{t.prerequisites.last}", exception: true
|
||||
end
|
||||
|
Reference in New Issue
Block a user