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

Add simple installer #249

Merged
merged 7 commits into from
Sep 28, 2023
Merged

Add simple installer #249

merged 7 commits into from
Sep 28, 2023

Conversation

remimimimimi
Copy link
Contributor

Adds simple CLI based installer that runs at system startup (installer image) and flushes image with which we configured it to the target device. Also allows anyone to build an installer for their configuration if it builds raw-efi image.

@vilvo
Copy link
Contributor

vilvo commented Aug 29, 2023

Please also squash all the commits into one when you fix the fmt-check

Copy link
Contributor

@vilvo vilvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general - looks good to me as the first iteration of installer. Building this now for testing.

@vilvo
Copy link
Contributor

vilvo commented Sep 14, 2023

Installer does not work for generic target.
IMG_2223

Copy link
Contributor

@vilvo vilvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix installer for generic.

Copy link
Contributor

@vilvo vilvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified to work on X1 with .#nixosConfigurations.generic-x86_64-debug.config.system.build.installer.

The basic structure looks good baseline for further work.
@mikatammi @brianmcgillion - please consired reviewing / merging this soon so further work can be based on it.

@vilvo
Copy link
Contributor

vilvo commented Sep 14, 2023

IMG_2225

Adds function that generates installer for desired configuration that builds
raw-efi image. Also add target that build installer image for
generic-x86_64-release as example.

Signed-off-by: Valentin Kharin <[email protected]>
Signed-off-by: Valentin Kharin <[email protected]>
Copy link
Collaborator

@jenninikko jenninikko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments:
-- Make a separate subsection 5.1.2.
-- Change the main title + change Built-in Installer Modules
-- Make a list of actions instead of plain text.
-- Add reference to https://tiiuae.github.io/ghaf/ref_impl/modules_options.html
-- nix -> Nix

@jenninikko
Copy link
Collaborator

IMG_2225

@remimimimimi, do not forget to change ghaf -> Ghaf ( ` ω ´ )

Copy link
Contributor

@vilvo vilvo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After retesting this together with @remimimimimi - this is not working correctly. The image written to the internal memory is not booting correctly to the desktop.

The problem is that we only get very few early boot logs to the display - then just black display. No IP via DHCP like with the target image booted from SSD.

All I can think now for debug is to print the partitions of nvme0n1 after sync and sleep 20s - here https://github.com/tiiuae/ghaf/pull/249/files#diff-789892fdf4e4c650d81ce42dbc84586807ced5e73a8d53c06775acf7df2d0876R172
Then add a message like: echo "Rebooting automatically in 20 seconds.

If that does not help, we need to check if we can get early kernel logs either to display or to USB debugging - https://docs.kernel.org/driver-api/usb/usb3-debug-port.html

@vilvo
Copy link
Contributor

vilvo commented Sep 22, 2023

@remimimimimi - this fixes the issue on X1

diff --git a/targets/lenovo-x1-carbon.nix b/targets/lenovo-x1-carbon.nix
index 6bf7bcf..6f00e8f 100644
--- a/targets/lenovo-x1-carbon.nix
+++ b/targets/lenovo-x1-carbon.nix
@@ -194,6 +194,7 @@
               # Passthrough Intel Iris GPU 8086:a7a1
               "vfio-pci.ids=8086:51f1,8086:a7a1"
             ];
+            boot.initrd.availableKernelModules = [ "nvme" ];
           }
         ]
         ++ (import ../modules/module-list.nix)

kudos @mikatammi for thinking out loud about possibly missing nvme kernel module - I remember I had to add nvme to initrd way back on my Lenovo P43s so it was easy fix to test.

@vilvo
Copy link
Contributor

vilvo commented Sep 22, 2023

Ghaf on X1 Carbon gen3 - booted from nvme with no SSD attached.
IMG_2256

Copy link
Collaborator

@jenninikko jenninikko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! Let's play a little bit more with letters :D

docs/src/ref_impl/installer.md Outdated Show resolved Hide resolved
docs/src/ref_impl/installer.md Outdated Show resolved Hide resolved
docs/src/ref_impl/installer.md Show resolved Hide resolved
docs/src/ref_impl/installer.md Outdated Show resolved Hide resolved
docs/src/ref_impl/installer.md Outdated Show resolved Hide resolved
@vilvo vilvo mentioned this pull request Sep 27, 2023
2 tasks
@mikatammi
Copy link
Contributor

I tested the installer and there are some rough edges, for example I was staring away from laptop while it was installing, then it rebooted, and I wasn't fast enough to disconnect the USB-drive. So the system somehow strangely booted up into ghaf desktop but still something was mounted from USB-drive.

But I'm fine with merging this now and improving things later.

@mikatammi
Copy link
Contributor

Note for the future: Also the resulting image was 26 gigabytes, so adding (zstd) compression even to the image embedded, would save many gigabytes

Signed-off-by: Valentin Kharin <[email protected]>
Without `nvme` kernel module it doesn't boot's up after installation.

Signed-off-by: Valentin Kharin <[email protected]>
Signed-off-by: Valentin Kharin <[email protected]>
@mikatammi mikatammi merged commit 7fd351b into tiiuae:main Sep 28, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants