Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the information about serial to help output and added the seperated nvme and ata option #120

Merged
merged 8 commits into from
Jan 12, 2024
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ Argument explanation:
```
[fw_jump.bin] Initial M-mode firmware, OpenSBI in this case
-k, -kernel u-boot.bin S-mode kernel payload (Linux Image, U-Boot, etc)
-i, -image drive.img Attach NVMe storage image (Raw format as of now)
-i, -image drive.img Attach NVMe storage image (Raw format as of now, use -nvme instead)
-nvme drive.img Attach NVMe storage image (Raw format as of now)
-ata drive.img Attach ATA storage image (Raw format as of now)
-m, -mem 2G Memory amount (may be suffixed by k/M/G), default 256M
-s, -smp 2 Amount of cores, single-core machine by default
-res 1280x720 Changes framebuffer & VM window resolution
-jitcache 64M Raise JIT cache limit (64M recommended for complex guests)
-serial /tmp/pts1 Add more serial ports (use stdout to bring UART over terminal as usual)
. . .
-rv32 Enable 32-bit RISC-V, 64-bit by default
-cmdline, -append ... Override/append default kernel command line
Expand Down
17 changes: 16 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Copyright (C) 2021 LekKit <github.com/LekKit>
cerg2010cerg2010 <github.com/cerg2010cerg2010>
Mr0maks <mr.maks0443@gmail.com>
KotB <github.com/0xCatPKG>
fish4terrisa-MSDSM <fish4terrisa@fishinix.eu.org>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -30,6 +31,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "devices/rtc-goldfish.h"
#include "devices/pci-bus.h"
#include "devices/nvme.h"
#include "devices/ata.h"
#include "devices/eth-oc.h"
#include "devices/rtl8169.h"
#include "devices/i2c-oc.h"
Expand Down Expand Up @@ -79,9 +81,12 @@ static void print_help()
" -rv32 Enable 32-bit RISC-V, 64-bit by default\n"
#endif
" -k, -kernel ... Load S-mode kernel payload (Linux, U-Boot, etc)\n"
" -i, -image ... Attach NVMe storage image\n"
" -nvme ... Attach NVMe storage image\n"
" -i, -image ... Attach NVMe storage image (For compatibility reasons)\n"
" -ata ... Attach ATA storage image (Deprecated)\n"
" -cmdline ... Override default kernel command line\n"
" -append ... Modify kernel command line\n"
" -serial ... Add more serial ports\n"
#ifdef USE_FB
" -res 1280x720 Change framebuffer resoulution\n"
" -nogui Disable framebuffer GUI\n"
Expand Down Expand Up @@ -237,6 +242,16 @@ static int rvvm_main(int argc, const char** argv)
rvvm_error("Failed to attach image \"%s\"", arg_val);
success = false;
}
} else if (cmp_arg(arg_name, "nvme")) {
if (success && !nvme_init_auto(machine, arg_val, true)) {
rvvm_error("Failed to attach image \"%s\"", arg_val);
success = false;
}
} else if (cmp_arg(arg_name, "ata")) {
if (success && !ata_init_auto(machine, arg_val, true)) {
rvvm_error("Failed to attach image \"%s\"", arg_val);
success = false;
}
} else if (cmp_arg(arg_name, "cmdline")) {
rvvm_set_cmdline(machine, arg_val);
} else if (cmp_arg(arg_name, "append")) {
Expand Down