build icon indicating copy to clipboard operation
build copied to clipboard

rockchip64: make rockchip64 bootable in VM

Open alex3d opened this issue 1 year ago • 5 comments

Description

Most of stuff needed to boot inside VM was already in place, the one remaining (new?) thing is CONFIG_PCI_HOST_GENERIC. Enable it to allow quick check of new images in QEMU or Apple Virtualization framework.

The kernel size difference is negligible (actually I see no kernel size change at all, apparently growth is fully covered by some kernel image alignment)

How Has This Been Tested?

  • [x] Make rk3318-box image and boot it inside UTM in "boot from kernel image" mode (both QEMU and Apple engines)

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code

alex3d avatar Oct 19 '24 10:10 alex3d

I guess it wouldn't hurt anything, although IMHO would be more ideal to have a specific lean kernel for virtualization builds. Amusingly I'm guessing the rockchip64 kernel is probably a fair bit leaner than the uefi ARM64 kernel

lanefu avatar Oct 19 '24 14:10 lanefu

Virtio drivers was already enabled in rockchip64 kernel config, this PR only adds ~512 bytes of code to make them usable. If kernel size is a concern then probably virtio drivers should be disabled (not sure there will be big size improvement).

BTW if you are concerned with disk size of the kernel (not RAM size), then probably you can compress it and let uboot uncompress it. I use something like this in my build config/extension:

function pre_package_kernel_image__compress_kernel() {
    lzop --best "${kernel_image_pre_package_path}"
    mv "${kernel_image_pre_package_path}"{.lzo,}
    return 0;
}

alex3d avatar Oct 19 '24 15:10 alex3d

@alex3d btw how you booting the image with Apple Virtualization Framework?

In the past I've used UTM a few different ways

lanefu avatar Oct 19 '24 16:10 lanefu

UTM currently has builtin Apple Virtualization support. You need to specify drive image + unpacked kernel + initramfs in the VM wizard: image VM config: image

alex3d avatar Oct 19 '24 16:10 alex3d

Mmmh, I see no harm in enablng the generic PCI Host driver. Perhaps having the chance to boot the kernel via VM can be useful for some automated image testing later @igorpecovnik

About concerns on size of the kernel and modules, currently rockchip64 carries a lot of useless drivers and features that can be slimmed down by several megabytes any time.

I will just make a quick check on a live system then, if it works as I suppose it will, approve

paolosabatino avatar Oct 19 '24 18:10 paolosabatino