Skip to content

Commit

Permalink
bin/menuconfig: support external devices
Browse files Browse the repository at this point in the history
  • Loading branch information
samueldr committed Jul 28, 2020
1 parent d5dc607 commit 8711126
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions bin/menuconfig
Expand Up @@ -18,7 +18,14 @@ if other_args.empty?
end

DEVICE = other_args.shift
FILE = Dir.glob(File.join(ROOT, "devices", DEVICE, "kernel", "config.*")).sort.first

FILE =
# Is the device a path?
if DEVICE.match(%r{/})
Dir.glob(File.join(DEVICE, "kernel", "config.*")).sort.first
else
Dir.glob(File.join(Dir.pwd, "devices", DEVICE, "kernel", "config.*")).sort.first
end

ONLY_SAVE = !!params.delete("--only-save")

Expand All @@ -27,22 +34,32 @@ unless params.empty?
usage
exit 1
end

unless other_args.empty?
$stderr.puts "Unexpected arguments #{other_args.join(", ")}."
usage
exit 1
end
unless File.exists?(FILE)

unless FILE
$stderr.puts "Could not find kernel configuration file for #{DEVICE}."
usage
exit 1
end

arg =
# Is the device a path?
if DEVICE.match(%r{/})
["--arg", "device", DEVICE]
else
["--argstr", "device", DEVICE]
end

Dir.chdir(ROOT) do
tool = File.join(`#{[
"nix-build",
"--no-out-link",
"--argstr", "device", DEVICE,
*arg,
"-A", "config.mobile.boot.stage-1.kernel.package.menuconfig"
].shelljoin}`.strip, "bin/nconf")

Expand Down

0 comments on commit 8711126

Please sign in to comment.