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

[Podman] Create podman bundle for aarch64 which should work on M1 #502

Closed
praveenkumar opened this issue Feb 2, 2022 · 4 comments
Closed

Comments

@praveenkumar
Copy link
Member

Some of the changes we need to do to make bundle for aarch64.

diff --git a/snc.sh b/snc.sh
index 66cc76a..5852670 100755
--- a/snc.sh
+++ b/snc.sh
@@ -35,14 +35,18 @@ ssh-keygen -t ecdsa -b 521 -N "" -f id_ecdsa_crc -C "core"
 ${YQ} eval --inplace ".passwd.users[0].ssh_authorized_keys[0] = \"$(cat id_ecdsa_crc.pub)\"" ${CRC_INSTALL_DIR}/fcos-config.yaml
 
 # Create the ign config 
-${PODMAN} run -i --rm quay.io/coreos/butane:release --pretty --strict < ${CRC_INSTALL_DIR}/fcos-config.yaml > ${CRC_INSTALL_DIR}/fcos-config.ign
+curl -L -O https://github.com/coreos/butane/releases/download/v0.14.0/butane-aarch64-unknown-linux-gnu
+chmod +x butane-aarch64-unknown-linux-gnu
+./butane-aarch64-unknown-linux-gnu  --pretty --strict < ${CRC_INSTALL_DIR}/fcos-config.yaml > ${CRC_INSTALL_DIR}/fcos-config.ign
 
 # Validate ign config
-${PODMAN} run --pull=always --rm -i quay.io/coreos/ignition-validate:release - < ${CRC_INSTALL_DIR}/fcos-config.ign
+curl -L -O https://github.com/coreos/ignition/releases/download/v2.13.0/ignition-validate-aarch64-linux
+chmod +x ignition-validate-aarch64-linux
+./ignition-validate-aarch64-linux - < ${CRC_INSTALL_DIR}/fcos-config.ign
 
 # Download the latest fedora coreos latest qcow2
-${PODMAN} run --pull=always --rm -v ${PWD}/${CRC_INSTALL_DIR}:/data:Z -w /data quay.io/coreos/coreos-installer:release download -s stable -p qemu -f qcow2.xz --decompress
-mv ${CRC_INSTALL_DIR}/fedora-coreos-*-qemu.x86_64.qcow2 ${CRC_INSTALL_DIR}/fedora-coreos-qemu.x86_64.qcow2
+coreos-installer download -s stable -p qemu -f qcow2.xz --decompress -C ${CRC_INSTALL_DIR}
+mv ${CRC_INSTALL_DIR}/fedora-coreos-*-qemu.aarch64.qcow2 ${CRC_INSTALL_DIR}/fedora-coreos-qemu.aarch64.qcow2
 
 # Update the selinux context for ign conig and ${CRC_INSTALL_DIR}
 chcon --verbose ${current_selinux_context} ${CRC_INSTALL_DIR}
@@ -56,7 +60,7 @@ create_json_description
 sudo ${VIRT_INSTALL} --name=${CRC_VM_NAME} --vcpus=2 --ram=2048 \
        --import --network=bridge=virbr0 --graphics=none \
        --qemu-commandline="-fw_cfg name=opt/com.coreos/config,file=${PWD}/${CRC_INSTALL_DIR}/fcos-config.ign" \
-       --disk=size=31,backing_store=${PWD}/${CRC_INSTALL_DIR}/fedora-coreos-qemu.x86_64.qcow2 \
+       --disk=size=31,backing_store=${PWD}/${CRC_INSTALL_DIR}/fedora-coreos-qemu.aarch64.qcow2 \
        --os-variant=fedora-coreos-stable \
        --noautoconsole --quiet
 sleep 120

diff --git a/createdisk.sh b/createdisk.sh
index 55aaa38..22ef6ff 100755
--- a/createdisk.sh
+++ b/createdisk.sh
@@ -32,7 +32,7 @@ install_additional_packages ${VM_IP}
 
 # Add gvisor-tap-vsock
 ${SSH} core@${VM_IP} 'sudo bash -x -s' <<EOF
-  podman create --name=gvisor-tap-vsock --privileged --net=host -v /etc/resolv.conf:/etc/resolv.conf -it quay.io/crcont/gvisor-tap-vsock:3231aba53905468c22e394493a0debc1a6cc6392
+  podman create --name=gvisor-tap-vsock --privileged --net=host -v /etc/resolv.conf:/etc/resolv.conf -it quay.io/crcont/gvisor-tap-vsock:arm
   podman generate systemd --restart-policy=no gvisor-tap-vsock > /etc/systemd/system/gvisor-tap-vsock.service
   systemctl daemon-reload
   systemctl enable gvisor-tap-vsock.service


# git diff createdisk-library.sh
diff --git a/createdisk-library.sh b/createdisk-library.sh
index c77a795..4ec982c 100755
--- a/createdisk-library.sh
+++ b/createdisk-library.sh
@@ -48,13 +48,13 @@ function create_qemu_image {
     local destDir=$2
 
     sudo cp /var/lib/libvirt/images/${CRC_VM_NAME}.qcow2 $destDir
-    sudo cp ${sourceDir}/fedora-coreos-qemu.x86_64.qcow2 $destDir
+    sudo cp ${sourceDir}/fedora-coreos-qemu.aarch64.qcow2 $destDir
 
     sudo chown $USER:$USER -R $destDir
-    ${QEMU_IMG} rebase -F qcow2 -b fedora-coreos-qemu.x86_64.qcow2 $destDir/${CRC_VM_NAME}.qcow2
+    ${QEMU_IMG} rebase -F qcow2 -b fedora-coreos-qemu.aarch64.qcow2 $destDir/${CRC_VM_NAME}.qcow2
     ${QEMU_IMG} commit $destDir/${CRC_VM_NAME}.qcow2
 
-    sparsify $destDir fedora-coreos-qemu.x86_64.qcow2 ${CRC_VM_NAME}.qcow2
+    sparsify $destDir fedora-coreos-qemu.aarch64.qcow2 ${CRC_VM_NAME}.qcow2
 
     # Before using the created qcow2, check if it has lazy_refcounts set to true.
     ${QEMU_IMG} info ${destDir}/${CRC_VM_NAME}.qcow2 | grep "lazy refcounts: true" 2>&1 >/dev/null
@@ -66,7 +66,7 @@ function create_qemu_image {
     # Update the qcow2 image permission from 0600 to 0644
     chmod 0644 ${destDir}/${CRC_VM_NAME}.qcow2
 
-    rm -fr $destDir/fedora-coreos-qemu.x86_64.qcow2
+    rm -fr $destDir/fedora-coreos-qemu.aarch64.qcow2
 }
 
 function update_json_description {
@cfergeau
Copy link
Contributor

cfergeau commented Feb 2, 2022

The kernel most likely needs to be gunzipped before being added to the bundle?

@praveenkumar
Copy link
Member Author

praveenkumar commented Feb 2, 2022

@cfergeau Yes, I am thinking to create another issue for that. If we can extract the kernel and add it to the bundle for all arch and that could works then better to do it for all arch.

@cfergeau
Copy link
Contributor

These changes are in #503 , uncompressing the kernel is cfergeau@07c6a4c

@praveenkumar
Copy link
Member Author

Closing this one since this is also now fixed.

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

No branches or pull requests

2 participants