6 # Read Pintos.pm from the same directory as this program.
7 BEGIN { my $self = $0; $self =~ s%/+[^/]*$%%; require "$self/Pintos.pm"; }
9 # Get command-line arguments.
10 usage (0) if @ARGV == 1 && $ARGV[0] eq '--help';
11 usage (1) if @ARGV < 2 || $ARGV[1] ne '--';
12 my ($disk, undef, @kernel_args) = @ARGV;
16 open ($handle, '+<', $disk) or die "$disk: open: $!\n";
18 # Check that it's a partitioned disk with a Pintos loader.
19 my ($buffer) = read_fully ($handle, $disk, 512);
20 unpack ("x510 v", $buffer) == 0xaa55 or die "$disk: not a partitioned disk\n";
21 $buffer =~ /Pintos/ or die "$disk: does not contain Pintos loader\n";
23 # Write the command line.
25 sysseek ($handle, $LOADER_SIZE, SEEK_SET) == $LOADER_SIZE
26 or die "$disk: seek: $!\n";
27 write_fully ($handle, $disk, make_kernel_command_line (@kernel_args));
30 close ($handle) or die "$disk: close: $!\n";
36 pintos-set-cmdline, a utility for changing the command line in Pintos disks
37 Usage: pintos-set-cmdline DISK -- [ARGUMENT...]
38 where DISK is a bootable disk containing a Pintos loader
39 and each ARGUMENT is inserted into the command line written to DISK.