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

Set default ram-image to always be /usr/share/cartesi-machine/images/linux.bin #129

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/perfect-news-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cartesi/cli": major
---

set default ram-image to always be '/usr/share/cartesi-machine/images/linux.bin'
19 changes: 3 additions & 16 deletions apps/cli/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import bytes from "bytes";
import os from "os";
import { extname } from "path";
import { TomlPrimitive, parse as parseToml } from "smol-toml";

Expand Down Expand Up @@ -74,10 +73,7 @@ export class InvalidStringArrayError extends Error {
*/
const DEFAULT_FORMAT = "ext2";
const DEFAULT_RAM = "128Mi";
const DEFAULT_RAM_IMAGE_DOCKER = "/usr/share/cartesi-machine/images/linux.bin";
const DEFAULT_RAM_IMAGE_LINUX = "/usr/share/cartesi-machine/images/linux.bin";
const DEFAULT_RAM_IMAGE_MAC =
"/opt/homebrew/share/cartesi-machine/images/linux.bin";
const DEFAULT_RAM_IMAGE = "/usr/share/cartesi-machine/images/linux.bin";
export const DEFAULT_SDK = "cartesi/sdk:0.12.0-alpha.1";

type Builder = "directory" | "docker" | "empty" | "none" | "tar";
Expand Down Expand Up @@ -172,15 +168,6 @@ export const defaultRootDriveConfig = (): DriveConfig => ({
tags: [],
});

export const defaultRamImage = (): string => {
switch (os.platform()) {
case "darwin":
return DEFAULT_RAM_IMAGE_MAC;
default:
return DEFAULT_RAM_IMAGE_LINUX;
}
};

export const defaultMachineConfig = (): MachineConfig => ({
assertRollingTemplate: undefined,
bootargs: [],
Expand All @@ -190,7 +177,7 @@ export const defaultMachineConfig = (): MachineConfig => ({
maxMCycle: undefined,
noRollup: undefined,
ramLength: DEFAULT_RAM,
ramImage: defaultRamImage(),
ramImage: DEFAULT_RAM_IMAGE,
store: "image",
user: undefined,
});
Expand Down Expand Up @@ -368,7 +355,7 @@ const parseMachine = (value: TomlPrimitive): MachineConfig => {
maxMCycle: parseOptionalNumber(toml["max-mcycle"]),
noRollup: parseBoolean(toml["no-rollup"], false),
ramLength: parseString(toml["ram-length"], DEFAULT_RAM),
ramImage: parseString(toml["ram-image"], defaultRamImage()),
ramImage: parseString(toml["ram-image"], DEFAULT_RAM_IMAGE),
store: "image",
user: parseOptionalString(toml.user),
};
Expand Down
Loading