forked from DGNum/liminix
qemu: use phram instead of block2mtd
This commit is contained in:
parent
46991e2761
commit
c40eef25d6
5 changed files with 12 additions and 8 deletions
|
@ -26,8 +26,9 @@
|
||||||
PCI_HOST_GENERIC="y";
|
PCI_HOST_GENERIC="y";
|
||||||
|
|
||||||
MTD = "y";
|
MTD = "y";
|
||||||
MTD_BLOCK2MTD = "y";
|
|
||||||
MTD_BLOCK = "y";
|
MTD_BLOCK = "y";
|
||||||
|
MTD_CMDLINE_PARTS = "y";
|
||||||
|
MTD_PHRAM = "y";
|
||||||
|
|
||||||
VIRTIO_MENU = "y";
|
VIRTIO_MENU = "y";
|
||||||
PCI = "y";
|
PCI = "y";
|
||||||
|
|
|
@ -52,8 +52,9 @@
|
||||||
CPU_MIPS32_R2= "y";
|
CPU_MIPS32_R2= "y";
|
||||||
|
|
||||||
MTD = "y";
|
MTD = "y";
|
||||||
MTD_BLOCK2MTD = "y";
|
|
||||||
MTD_BLOCK = "y";
|
MTD_BLOCK = "y";
|
||||||
|
MTD_CMDLINE_PARTS = "y";
|
||||||
|
MTD_PHRAM = "y";
|
||||||
|
|
||||||
VIRTIO_MENU = "y";
|
VIRTIO_MENU = "y";
|
||||||
PCI = "y";
|
PCI = "y";
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
OF = "y";
|
OF = "y";
|
||||||
USE_OF = "y";
|
USE_OF = "y";
|
||||||
};
|
};
|
||||||
hardware.ram.startAddress = lim.parseInt "0x0";
|
hardware.ram.startAddress = lim.parseInt "0x80000000";
|
||||||
boot.commandLine = [
|
boot.commandLine = [
|
||||||
"console=ttyS0,115200" # true of all mips we've yet encountered
|
"console=ttyS0,115200" # true of all mips we've yet encountered
|
||||||
];
|
];
|
||||||
|
|
|
@ -84,6 +84,7 @@ in
|
||||||
(if pkgs.stdenv.hostPlatform.isAarch
|
(if pkgs.stdenv.hostPlatform.isAarch
|
||||||
then "${pkgs.stdenv.cc.targetPrefix}objcopy -O binary -R .comment -S ${kernel} $out"
|
then "${pkgs.stdenv.cc.targetPrefix}objcopy -O binary -R .comment -S ${kernel} $out"
|
||||||
else "cp ${kernel} $out");
|
else "cp ${kernel} $out");
|
||||||
|
phram_address = lib.toHexString (config.hardware.ram.startAddress + 256 * 1024 * 1024);
|
||||||
in pkgs.runCommandCC "vmroot" {} ''
|
in pkgs.runCommandCC "vmroot" {} ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cd $out
|
cd $out
|
||||||
|
@ -94,7 +95,7 @@ in
|
||||||
echo ${cmdline} > commandline
|
echo ${cmdline} > commandline
|
||||||
cat > run.sh << EOF
|
cat > run.sh << EOF
|
||||||
#!${pkgs.runtimeShell}
|
#!${pkgs.runtimeShell}
|
||||||
CMDLINE=${cmdline} ${pkgs.pkgsBuildBuild.run-liminix-vm}/bin/run-liminix-vm --arch ${pkgs.stdenv.hostPlatform.qemuArch} \$* ${makeBootableImage} ${config.system.outputs.rootfs}
|
CMDLINE=${cmdline} PHRAM_ADDRESS=0x${phram_address} ${pkgs.pkgsBuildBuild.run-liminix-vm}/bin/run-liminix-vm --arch ${pkgs.stdenv.hostPlatform.qemuArch} \$* ${makeBootableImage} ${config.system.outputs.rootfs}
|
||||||
EOF
|
EOF
|
||||||
chmod +x run.sh
|
chmod +x run.sh
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -54,13 +54,14 @@ case "$arch" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
INIT=${INIT-/bin/init}
|
phram="mtdparts=phram0:16M(rootfs) phram.phram=phram0,${PHRAM_ADDRESS},16Mi,65536 root=/dev/mtdblock0";
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
$QEMU \
|
$QEMU \
|
||||||
-m 256 \
|
-m 272 \
|
||||||
-echr 16 \
|
-echr 16 \
|
||||||
-append "$CMDLINE liminix root=/dev/mtdblock0 block2mtd.block2mtd=/dev/vda,65536" \
|
-append "$CMDLINE liminix $phram" \
|
||||||
-drive file=$rootfs,format=raw,readonly=off,if=virtio,index=0 \
|
-device loader,file=$rootfs,addr=$PHRAM_ADDRESS \
|
||||||
${initramfs} \
|
${initramfs} \
|
||||||
-netdev socket,id=access,mcast=230.0.0.1:1234,localaddr=127.0.0.1 \
|
-netdev socket,id=access,mcast=230.0.0.1:1234,localaddr=127.0.0.1 \
|
||||||
-device virtio-net,disable-legacy=on,disable-modern=off,netdev=access,mac=ba:ad:1d:ea:21:02 \
|
-device virtio-net,disable-legacy=on,disable-modern=off,netdev=access,mac=ba:ad:1d:ea:21:02 \
|
||||||
|
|
Loading…
Reference in a new issue