1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-26 01:13:37 +03:00

Removes custom porcelain...

Let's rely on nix-build mainly.
This commit is contained in:
Samuel Dionne-Riel 2019-09-21 22:45:08 -04:00
parent 701c01187f
commit 683ce12eb7
4 changed files with 0 additions and 91 deletions

View File

@ -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

View File

@ -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 <device-name>"
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

View File

@ -1,2 +0,0 @@
ROOT = File.join(__dir__, "..", "..")
require_relative "run.rb"

View File

@ -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