snapcore / pi-gadget

Universal pi (pi2,pi3,pi4,cm3,cm4 and future) gadget snap for Ubuntu Core and classic systems.
30 stars 60 forks source link

Use classic style config file assembly to add support for piboot #87

Closed jawn-smith closed 2 years ago

jawn-smith commented 2 years ago

This PR adds piboot support to UC22.

It also modernizes the config file assembly of UC22 to match the classic server and desktop images.

jawn-smith commented 2 years ago

Here is the resulting config.txt:

[all]
kernel=kernel.img
cmdline=cmdline.txt
initramfs initrd.img followkernel

[pi4]
max_framebuffers=2
arm_boost=1

[all]
# Enable the audio output, I2C and SPI interfaces on the GPIO header. As these
# parameters related to the base device-tree they must appear *before* any
# other dtoverlay= specification
dtparam=audio=on
dtparam=i2c_arm=on
dtparam=spi=on

# Comment out the following line if the edges of the desktop appear outside
# the edges of your display
disable_overscan=1

# If you have issues with audio, you may try uncommenting the following line
# which forces the HDMI output into HDMI mode instead of DVI (which doesn't
# support audio output)
#hdmi_drive=2

[cm4]
# Enable the USB2 outputs on the IO board (assuming your CM4 is plugged into
# such a board)
dtoverlay=dwc2,dr_mode=host

[all]

# Enable the FKMS ("Fake" KMS) graphics overlay, and allocate 128Mb to the
# GPU memory
dtoverlay=vc4-fkms-v3d,cma-128

# Uncomment the following to enable the Raspberry Pi camera module firmware
#start_x=1
#gpu_mem=128

# Prior versions of Ubuntu Core customized the on-board LEDs so that the green
# ACT LED was a heartbeat, and the red PWR LED represented SD card activity.
# Uncomment the following lines if you wish to restore these customizations
#dtparam=act_led_trigger=heartbeat
#dtparam=pwr_led_trigger=mmc0

# Config settings specific to arm64
arm_64bit=1
dtoverlay=dwc2
alfonsosanchezbeato commented 2 years ago

Thanks for this! I tried the branch, but I got some errors in the staging step:

+ snapcraftctl prime
Failed to copy '/home/ubuntu/src/snappy/pi-gadget/stage/cmdline.txt': no such file or directory.
Check the path and try again.
jawn-smith commented 2 years ago

@alfonsosanchezbeato Thanks for the testing! I had been using make rather than snapcraft in destructive mode, which was a mistake. It looks to be a simple path disagreement. cmdline.txt is in stage/boot-assets/ so this should be an easy change to make.