unify kernel command line handling

We now use MIPS_CMDLINE_DTB_EXTEND for all boot varieties
(tftpboot, flash boot, kexec) with the addition of
MIPS_BOOTLOADER_CMDLINE_REQUIRE_COOKIE - local patch -
so that the bootloader args are ignored unless they
contain the string "liminix"
This commit is contained in:
Daniel Barlow
2023-03-23 21:50:44 +00:00
parent 1c36f1b373
commit a5cfa37ed3
6 changed files with 74 additions and 10 deletions

View File

@@ -79,6 +79,10 @@ in {
MODULE_SIG = "y";
DEBUG_FS = "y";
MIPS_BOOTLOADER_CMDLINE_REQUIRE_COOKIE = "y";
MIPS_BOOTLOADER_CMDLINE_COOKIE = "\"liminix\"";
MIPS_CMDLINE_DTB_EXTEND = "y";
# basic networking protocols
NET = "y";
UNIX = "y";

View File

@@ -14,10 +14,6 @@ in {
kernel = {
config = {
MTD_SPLIT_UIMAGE_FW = "y";
# ignore the commandline provided by U-Boot because it's most
# likely wrong
MIPS_CMDLINE_FROM_BOOTLOADER = lib.mkForce "n";
MIPS_CMDLINE_FROM_DTB = "y";
};
};

View File

@@ -11,9 +11,6 @@ in {
config = {
boot.ramdisk.enable = true;
kernel.config.MIPS_CMDLINE_FROM_DTB = "y";
kernel.config.MIPS_CMDLINE_FROM_BOOTLOADER = mkForce "n";
outputs.kexecboot =
let o = config.outputs; in
pkgs.runCommand "kexecboot" {} ''

View File

@@ -11,7 +11,6 @@ in {
imports = [ ./ramdisk.nix ];
config = {
boot.ramdisk.enable = true;
kernel.config.MIPS_CMDLINE_FROM_BOOTLOADER = "y";
outputs.tftpboot =
let o = config.outputs; in
@@ -35,12 +34,12 @@ in {
squashfsStart=0x$(printf %x $((${cfg.loadAddress} + 0x100000 + $uimageSize)))
squashfsBytes=$(($(stat -L -c %s ${config.outputs.squashfs}) + 0x100000 &(~0xfffff)))
squashfsMb=$(($squashfsBytes >> 20))
cmd="mtdparts=phram0:''${squashfsMb}M(nix) phram.phram=phram0,''${squashfsStart},''${squashfsMb}Mi memmap=''${squashfsMb}M\$''${squashfsStart} root=1f00";
cmd="mtdparts=phram0:''${squashfsMb}M(rootfs) phram.phram=phram0,''${squashfsStart},''${squashfsMb}Mi memmap=''${squashfsMb}M\$''${squashfsStart} root=1f00";
cat > $out << EOF
setenv serverip ${cfg.serverip}
setenv ipaddr ${cfg.ipaddr}
setenv bootargs '${concatStringsSep " " config.boot.commandLine} $cmd'
setenv bootargs 'liminix $cmd'
tftp 0x$(printf %x ${cfg.loadAddress}) result/uimage ; tftp 0x$(printf %x $squashfsStart) result/squashfs
bootm 0x$(printf %x ${cfg.loadAddress})
EOF