diff --git a/bin/boot-qemu b/bin/boot-qemu deleted file mode 100755 index 1c1cd700..00000000 --- a/bin/boot-qemu +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -p qemu -p ruby -i ruby - -# Boots a given `result` symlink on a remote system. -# This is mainly used to speed-up development where -# an aarch64 host is used to build the system, but the -# target device is plugged into another system - -require_relative "../lib/rb/all.rb" -require "fileutils" -include FileUtils - -# This assumes `result` is boot.img. -STORE_PATH = File.readlink("result") - -# FIXME : read-only doesn't work... -$copy_readwrite = true; - -begin - disk_image = Dir.glob(File.join(File.readlink("result"), "system", "*.img")).first - if $copy_readwrite then - DISK_IMAGE = "fs.img" - cp(disk_image, DISK_IMAGE) - chmod("u=rw", DISK_IMAGE) - else - DISK_IMAGE = disk_image - end -end - -unless ARGV.count == 0 then - puts "Usage: bin/boot-eqmu" - exit 1 -end - -KERNEL_INITRD = "result/kernel-initrd" - -args = [] -args.push("qemu-system-x86_64") -args.push("-enable-kvm") -args.push("-kernel", "#{KERNEL_INITRD}/kernel") -args.push("-initrd", "#{KERNEL_INITRD}/initrd") -args.push("-append", File.read("#{KERNEL_INITRD}/cmdline.txt")) -args.push("-m", "#{File.read("#{KERNEL_INITRD}/ram.txt")}M") -args.push("-serial", "stdio") -args.push("-drive", "file=#{DISK_IMAGE},format=raw#{if $copy_readwrite then "" else ",readonly" end}") -args.push("-device", "e1000,netdev=net0") -args.push("-netdev", "user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23,net=172.16.42.0/24,dhcpstart=172.16.42.1") - -run(*args, exec: true) - -# vim: ft=ruby diff --git a/bin/build b/bin/build deleted file mode 100755 index 4b9dd7a5..00000000 --- a/bin/build +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -p ruby -i ruby - -require_relative "../lib/rb/all.rb" - -# Given a device name, instantiates `nix-build` to build -# everything needed to boot on that device. - -if ARGV.count < 1 then - puts "Usage: bin/build " - exit 1 -end - -DEVICE = ARGV.shift -NIXPKGS=File.join(*__dir__.split("/")[0..-2], "nixpkgs") - -run( - "env", "-i", - "nix-build", "-A", "all", - "-I", "nixpkgs=#{NIXPKGS}", - "--argstr", "device", DEVICE, - *ARGV, - exec: true -) - -# vim: ft=ruby diff --git a/lib/rb/all.rb b/lib/rb/all.rb deleted file mode 100644 index 528bbda1..00000000 --- a/lib/rb/all.rb +++ /dev/null @@ -1,2 +0,0 @@ -ROOT = File.join(__dir__, "..", "..") -require_relative "run.rb" diff --git a/lib/rb/run.rb b/lib/rb/run.rb deleted file mode 100644 index 086f7b00..00000000 --- a/lib/rb/run.rb +++ /dev/null @@ -1,12 +0,0 @@ -require "shellwords" - -def run(*cmd, exec: false) - puts " $ #{cmd.shelljoin}" - - if exec then - Kernel.exec(*cmd) - else - system(*cmd) - end - exit $?.exitstatus unless $?.exitstatus == 0 -end