-
Notifications
You must be signed in to change notification settings - Fork 1
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
FMO-81: Merge fmo-os images into fmo-os-x86_64 #92
Conversation
buianhhuy96
commented
Dec 9, 2024
•
edited
Loading
edited
- Create x86_64-devices containing pci device map and rugged-devices.nix for pci info of rugged devices
- Create systemd service to write pci device paths into config file for microvm
- Map touch device in sway via a script
- Clean up tablet and laptop config file
- Build targets are:
- fmo-os-x86_64-rugged-devices-debug / fmo-os-x86_64-rugged-devices-release
- fmo-os-x86_64-public-rugged-devices-debug / fmo-os-x86_64-public-rugged-devices-release
- fmo-os-installer-debug / fmo-os-installer-release
- fmo-os-installer-public-debug / fmo-os-installer-public-releas
hardware/device-info.nix
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably here we need to rename this file to show that it is related to Latitude 7230 Rugged Extreme Tablet
and Latitude 7330 Rugged Extreme
, otherwise it is too common name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I choose a general name is that: If we like to see FMO-OS as a general operating system, we can make it work that way by adding more devices manually, or even automatically using ghaf hardware-scan
script.
For example, I'm thinking of a device called VM
when I build it as a (QEMU) VM development target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this exact configurations will work only on rugged devices, not for any x86, or any other. QEMU targets may be added here, due to they will be used for debug purposes for rugged devices. But if someone will add ARM-NVIDIA target where they will need to put it? If name is so general it looks like it should be put here.. But I think it would be better to put it to arm-nvidia-projectname-device-info.nix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it is a good idea to put device-info as folder (or subfolder of hardware
folder), just to not mix different types of files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can rename it into x86_64-device-info.nix
or put it inside a folder like x86_64-device-info
, which one would you suggest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to use something like: hardware/device-info/fmo-os-rugged-devices.nix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I think I get where we misunderstood. The idea of mine was to create FMO-OS as a very general operating system, and completely independent of hardware. This device-info.nix
is the only place where device becomes something related.
For example, I want to use FMO-OS on Lenovo X1 Carbon Gen 11, I add this into the file:
"LENOVO_MT_21HM_BU_Think_FM_ThinkPad X1 Carbon Gen 11 21HM006EMX" = {
touchDevices = [
];
pciDevices = {
netvm = [
"0000:00:14.3"
];
dockervm = [];
};
};
As long as the device is x86_64, which's indicated in the name fmo-os-x86_64.nix
, it can run FMO-OS, fully functional. I tested on my X1 Carbon, would need more devices to confirm but for now, it works on all devices that I have
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FMO-OS it self is not general purpose system, as like GHAF, and even if it may be used so -- those build are pretty specific for FMO drone usage. If some one needs to make something different they probably need to rework pretty much of things: VMs, services, devices -- it would pretty different build with different build name and I would prefer to have it fully dedicated from rugged build
utils/default.nix
Outdated
@@ -8,6 +8,8 @@ | |||
addSystemPackages = (packages: [({pkgs, ...}:{environment.systemPackages = map (app: pkgs.${app}) packages;})]); | |||
|
|||
addCustomLaunchers = (launchers: [{ghaf.graphics.app-launchers.enabled-launchers = launchers;}]); | |||
|
|||
addHardwareInfo = (deviceFile: [{device.hardwareInfo.configJson = builtins.toJSON (import ../hardware/${deviceFile});}]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How that will work if someone would wish to add a new target without device-info.nix
or add devices by declaring them in hardware description file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about that. But then I chose this because
- for now, we only work on 2 devices.
- Nix format is easier to manage than JSON format
We may add more devices "statically" indevice-info.nix
before building. As you may know, this file is not really in the system; only its content is read as a string.
But if you prefer it to be a writable JSON file on the FMO system, I can make it work that way. Then, users can add new devices at their will.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It slightly not the same what I meant, I'm totally agree with nix approach instead of JSON, but will it work if I remove deviceFile = "device-info.nix";
from hardware description file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just tried and it fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point, in that case, I think I can change the path to hardcoded path (import ../hardware/device-info.nix
)
deviceFile = "device-info.nix";
lets us know the file name that inside hardware/
then append to ../hardware/device-info.nix
I did this just in case any other platform, not x86 would not be the same as x86
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really get it, how can it make everything to be rewritten?
It only indicates which pci-devices to be passed through to which VM. Other VM's configuration is not related at all. The idea was that FMO can be understood as Windows OS, while device-info.nix is for example, wifi driver to be downloaded and installed.
We can make the device info to be imported implicitly to the system, therefore wouldn't need deviceFile
in fmo-os-x86_64.nix
We put FMO-related configuration in the fmo-os-x86_64.nix
and hardware-specific (pci-devices) in device-info.nix
So unless we need to change the pci that's passed to this VM to other VM, the device-info.nix should not be touched at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I told you if we remove deviceFile = "device-info.nix";
from hardware description file it fails to build at all. Because now it has been made as mandatory field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean I can rewrite it, to make it imported, implicitly. For example, by hardcoded the file path/name to the config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then this implicit file need to have nothing. Can we just use default empty structure if user did not add deviceFile
at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rewrite it into a device in target name
For example, build
fmo-os-x86_64-rugged-devices-debug
then the part rugged-devices
will indicate the which device(s) to be loaded along with FMO-OS.
And also, please check below comments because this code is outdated
hardware/fmo-os-x86_64.nix
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably that file also needs to be renamed to show relations to rugged devices
2dbf879
to
6019fec
Compare
flake.nix
Outdated
@@ -34,11 +34,12 @@ | |||
}; | |||
}); | |||
|
|||
devices = { | |||
rugged-devices = (import ./hardware/x86_64-devices/rugged-devices.nix); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can add new devices here, and when we do that, there will be new targets for those devices
6019fec
to
70723ba
Compare
config-processor-hardware.nix
Outdated
@@ -43,6 +44,7 @@ let | |||
]; | |||
} | |||
] | |||
++ (addHardwareInfo devices.${device}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The device
has now become a variable that is included in the target name.
See line 18 and 57 and commit message
- Create device-info folder containing pci device map and rugged-devices.nix for pci info of rugged devices - Create systemd service to write pci device paths into config file for microvm - Map touch device in sway via a script - Clean up tablet and laptop config file - Build targets are: + fmo-os-rugged-devices-debug / fmo-os-rugged-devices-release + fmo-os-rugged-devices-public-debug / fmo-os-rugged-devices-public-release + fmo-os-installer-debug / fmo-os-installer-release + fmo-os-installer-public-debug / fmo-os-installer-public-release Signed-off-by: Anh Huy Bui <[email protected]>
70723ba
to
1930efc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Ship it!