-
Notifications
You must be signed in to change notification settings - Fork 34
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
resources: Add documentation about extending disk images #148
base: stable
Are you sure you want to change the base?
resources: Add documentation about extending disk images #148
Conversation
packer build /path/to/packer/script | ||
``` | ||
|
||
**Note:** If you want to view the terminal of the image during the build process, you can use a VNC viewer. Packer will provide a VNC port during the build, which you can connect to using a VNC viewer. |
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 could be good to show an example of Packer output with the VNC port so it's easier for people to find, but it's not absolutely necessary
|
||
4. **Create a Packer Script** | ||
|
||
Write a Packer script to use the above disk image as a base image and extend it. Below is an example Packer script with placeholders: |
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.
Once the new npb/gapbs disk images are merged, it could be helpful to point toward the Packer scripts for those as well. It would give people more examples to look at.
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 would also be good to add a link to the directories for the base Ubuntu x86/Arm disk images to provide more examples of Packer scripts.
You could also tell readers to simply use those directories as more of the process is automated, making it easier to make disk images.
packer build /path/to/packer/script | ||
``` | ||
|
||
**Note:** If you want to view the terminal of the image during the build process, you can use a VNC viewer. Packer will provide a VNC port during the build, which you can connect to using a VNC viewer. |
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'd clarify what you mean by "terminal of the image". If I'm reading this I'd think i was already in the terminal. What it the "image's" terminal.
I think maybe the problem is you've not really explained what packer is doing here. Is it running in quemu and therefore has it's own terminal output?
variable "ssh_password" { | ||
type = string | ||
default = "12345" # Update if different for the base image | ||
} | ||
|
||
variable "ssh_username" { | ||
type = string | ||
default = "gem5" # Update if different for the base image |
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 does someone find out what the password and user name is for a base image?
iso_urls = [""] # Path to the base image | ||
memory = "8192" | ||
output_directory = "" # Output directory path | ||
qemu_binary = "/usr/bin/qemu-system-x86_64" |
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 assume you need to update this for each of the 3 base images?
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.
yes
provisioner "shell" { | ||
execute_command = "echo '${var.ssh_password}' | {{ .Vars }} sudo -E -S bash '{{ .Path }}'" | ||
scripts = ["# path to the post-install script that will extend the disk image"] | ||
expect_disconnect = true | ||
} | ||
} |
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.
This is the most important part of the whole thing and you really brushed over it.
I'd make this more tutorially and have a good example here of what a script can do here to setup a disk image.
Like, I have an application i want to be in the disk image. How do I put it there? How to I setup it up correctly so it runs when the US finishes booting?
## Running disk images in gem5 | ||
|
||
As these disk iamges throw m5 exit events, we need to handle those to succesfully run the image to boot. |
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 think you should lead with a small script which can run the disk image they just created before jumping straight into explaining exit events.
format = "raw" | ||
headless = "true" | ||
disk_image = "true" | ||
iso_checksum = "sha256:# sha256sum of the base image" |
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.
Do you need this? It's rather annoying they need to get the md5 of the disk image just to put it here. There's no way to disable the checksum?
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 serves as a check that the file is not curropted.
build { | ||
sources = ["source.qemu.initialize"] | ||
|
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 think it'd be worth explaining what quemu is and in what capacity you're using it here to work with the disk images
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 added a small description in the begining of the section.
```sh | ||
sudo apt-get update && sudo apt-get install packer # Installing Packer |
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.
Don't you need to install qemu and stuff like riscv-system-qemu
to have this work cross-platform?
"<wait120>", | ||
"gem5<enter><wait>", | ||
"12345<enter><wait>", | ||
"sudo mv /etc/netplan/50-cloud-init.yaml.bak /etc/netplan/50-cloud-init.yaml<enter><wait>", | ||
"12345<enter><wait>", | ||
"sudo netplan apply<enter><wait>", | ||
"<wait>" |
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.
You should explain this magic.
} | ||
|
||
source "qemu" "initialize" { | ||
accelerator = "kvm" |
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.
So I need to have a KVM enabled machine? Does this work even if my disk image is X86 but my host is ARM?
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 is set by the creator of the base image. I edited the comments to mention that the 22.04 and 24.04 images on gem5 resources have this user and password.
No description provided.