canonical / pi-gadget

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

snapcraft: add core24 builds for arm64 #106

Closed Meulengracht closed 9 months ago

Meulengracht commented 10 months ago

Pi gadgets for Ubuntu Core 24 - Goal with this is to support both armhf and arm64 from the same branch as changes between those two are minimal. (Did I miss any changes?)

I currently have them in build-base: devel as the base is not stable yet. Do we wait for this or change this in a followup PR once the base goes stable?

alfonsosanchezbeato commented 9 months ago

I think that this should be proposed to a branch called simply 24, there is no need to list the architectures.

alfonsosanchezbeato commented 9 months ago

Also, I've seen now references to jammy and 22.04 in the Makefile, those need to change now.

alfonsosanchezbeato commented 9 months ago

I think we need something like this (it removes old u-boot stuff and sets the right release):

diff --git a/Makefile b/Makefile
index b55d61d..79c91b3 100644
--- a/Makefile
+++ b/Makefile
@@ -89,11 +89,7 @@ server: firmware uboot boot-script config-server device-trees gadget

 desktop: firmware uboot boot-script config-desktop device-trees gadget

-ifeq "22.04" "$(word 1, $(sort 22.04 $(SERIES_RELEASE)))"
 core: firmware config-core device-trees gadget
-else
-core: firmware uboot boot-script config-core device-trees gadget
-endif

 firmware: $(SOURCES_RESTRICTED) $(DESTDIR)/boot-assets
    $(call stage_package,linux-firmware-$(FIRMWARE_FLAVOR))
@@ -142,10 +138,6 @@ boot-script: $(SOURCES_RESTRICTED) device-trees $(DESTDIR)/boot-assets
            $(STAGEDIR)/etc/flash-kernel/bootscript/bootscr.rpi* \
            > $(STAGEDIR)/bootscr.rpi; \
    done
-ifneq "22.04" "$(word 1, $(sort 22.04 $(SERIES_RELEASE)))"
-   mkimage -A $(MKIMAGE_ARCH) -O linux -T script -C none -n "boot script" \
-       -d $(STAGEDIR)/bootscr.rpi $(DESTDIR)/boot-assets/boot.scr
-endif

 CORE_CFG := \
    $(if $(call lt,$(SERIES_RELEASE),22.04),uboot-$(ARCH),piboot-core) \
@@ -164,19 +156,7 @@ CORE_CMD := \
 config-core: $(DESTDIR)/boot-assets
    $(call make_boot_config,$(CORE_CFG))
    $(call make_boot_cmdline,$(CORE_CMD))
-ifeq "22.04" "$(word 1, $(sort 22.04 $(SERIES_RELEASE)))"
    touch $(DESTDIR)/piboot.conf
-else
-   # TODO:UC20: currently we use an empty uboot.conf as a landmark for the new
-   #            uboot style where there is no uboot.env installed onto the root
-   #            of the partition and instead the boot.scr is used. this may
-   #            change for the final release
-   touch $(DESTDIR)/uboot.conf
-   # the boot.sel file is currently installed onto ubuntu-boot from the gadget
-   # but that will probably change soon so that snapd installs it instead
-   # it is empty now, but snapd will write vars to it
-   mkenvimage -r -s 4096 -o $(DESTDIR)/boot.sel - < /dev/null
-endif

 SERVER_CFG := \
    $(if $(call eq,$(SERIES_RELEASE),20.04),legacy-header,) \
diff --git a/snapcraft.yaml b/snapcraft.yaml
index e0678c2..5f3561f 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -43,6 +43,7 @@ parts:

       make -C $SNAPCRAFT_PART_SRC core \
         DESTDIR=${SNAPCRAFT_PART_INSTALL} \
+        SERIES=noble \
         ARCH="$(dpkg-architecture -t $BUILD_ARCH_TRIPLET -q DEB_HOST_ARCH)" \
         ${OPTIONAL_ARGS:-}
     prime:
diff --git a/sources.list b/sources.list
index fc5fa79..289c60d 100644
--- a/sources.list
+++ b/sources.list
@@ -1,6 +1,4 @@
 deb [arch=ARCH] http://ports.ubuntu.com/ubuntu-ports/ SERIES main restricted
 deb [arch=ARCH] http://ports.ubuntu.com/ubuntu-ports/ SERIES-updates main restricted
 deb [arch=ARCH] http://ports.ubuntu.com/ubuntu-ports/ SERIES-security main restricted
-deb [arch=ARCH] http://ppa.launchpad.net/jawn-smith/linux-firmware-raspi/ubuntu SERIES main
-# TODO: remove the PPA above. It is a temporary fix for LP: #1968111
-#deb [arch=ARCH] http://ports.ubuntu.com/ubuntu-ports/ SERIES-proposed main restricted
+deb [arch=ARCH] http://ports.ubuntu.com/ubuntu-ports/ SERIES-proposed main restricted
alfonsosanchezbeato commented 9 months ago

It boots for arm64, but I had to repack the kernel as it was missing meta/kernel.yaml. Which should be:

assets:
  dtbs:
    update: true
    content:
      - dtbs/