Creating a kernel snap for a aarch64 board

Apologies if this has been asked before but what are the basic steps in creating a kernel snap for an aarch64 based board where the kernel is supplied by the silicon vendor e.g. Xilinx

take a look at:

1 Like

Hi,
I am getting packages related errors during arm64 kernel snap.

Setting target machine to ‘arm64’
Cross compiling kernel target ‘arm64’
Installing build dependencies: binutils-aarch64-linux-gnu cpp-7-aarch64-linux-gnu cpp-aarch64-linux-gnu gcc-7-aarch64-linux-gnu gcc-7-aarch64-linux-gnu-base gcc-7-cross-base gcc-8-cross-base gcc-aarch64-linux-gnu gcc-multilib libasan4-arm64-cross libatomic1-arm64-cross libc6-arm64-cross libc6-dev-arm64-cross libgcc-7-dev-arm64-cross libgcc1-arm64-cross libgomp1-arm64-cross libitm1-arm64-cross liblsan0-arm64-cross libstdc++6-arm64-cross libtsan0-arm64-cross libubsan0-arm64-cross linux-libc-dev-arm64-cross
Reading package lists… Done
Building dependency tree
Reading state information… Done
gcc-multilib is already the newest version (4:7.4.0-1ubuntu2.3).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
gcc-7-aarch64-linux-gnu : Conflicts: gcc-multilib but 4:7.4.0-1ubuntu2.3 is to be installed
gcc-multilib : Conflicts: gcc-7-aarch64-linux-gnu
Conflicts: gcc-7-aarch64-linux-gnu:i386
E: Unable to correct problems, you have held broken packages.
Could not install all requested build packages: binutils-aarch64-linux-gnu cpp-7-aarch64-linux-gnu cpp-aarch64-linux-gnu gcc-7-aarch64-linux-gnu gcc-7-aarch64-linux-gnu-base gcc-7-cross-base gcc-8-cross-base gcc-aarch64-linux-gnu gcc-multilib libasan4-arm64-cross libatomic1-arm64-cross libc6-arm64-cross libc6-dev-arm64-cross libgcc-7-dev-arm64-cross libgcc1-arm64-cross libgomp1-arm64-cross libitm1-arm64-cross liblsan0-arm64-cross libstdc++6-arm64-cross libtsan0-arm64-cross libubsan0-arm64-cross linux-libc-dev-arm64-cross

Below mentioned are the snippets from snapcraft.yaml

type: kernel
architectures: [ arm64 ]


build-packages:
- cpio
- libssl-dev
- flex
- autoconf
- bison

How can I solve the broken package issues ?

I am not seeing the package issues after adding the gcc-multilib and automake.
But I noticed sometimes,snapcraft says compiler is not found during the kernel snap preparation process.

I could see shared kernel snaps are expecting kernel-image-target: bzImage.
Is that mandatory to use bzImage?

it totally depends on your hardware i’d say … some arm64 boards can not use compressed kernels, there the target would just be Image i suppose …

Yes, That’s correct. So is it okay to use kernel-image-target: Image ?

it should (i havent tried in a while TBH)

:slightly_smiling_face: Okay…I will check and update

Respective change has to be made in snappy_boot environment variable to boot the required image format . Is my understanding correct?

IIRC the snapcraft kernel plugin then renames the file to kernel.img and u-boot should just find it under this name, so you should not need to mangle the variables … indeed you need to make sure that your u-boot runs booti, not bootz to boot the uncompressed img …

My hardware expects Image.gz and kernel-image-target: Image.gz works for me

1 Like

I understand kernel gadget snap build process places initrd.
Getting initramfs console during booting up and observed below logs

findfs: unable to resolve ‘LABEL=writable’
done.
the requried kernel commandline snap_core is not set

I did some search in forum and found like adding kernel-initrd-modules can help this issues. I am loading the UC from SD card. mmc-block is already enable in kernel.

In such case, kernel-initrd-modules:mmc-block entry required?

How can I investigate more on this issue?

You need to have your device boot with the bootloader environment variables and kernel command line setup as described in https://snapcraft.io/docs/ubuntu-core-boot-modes. TLDR is that snap_core should point to the base snap that you are booting with and snap_kernel should point to the kernel snap that you are booting with

How can I get base snap information? I understand it should be something like
snap_core=core_xxxx.snap. Do I need to refer 4 digit number from seed.manifest?

Do we need to set snap_core manually always?

findfs: unable to resolve ‘LABEL=writable’
done.

I am booting from MicroSD and it was not getting detected. I have corrected and prepared kernel snap. It helped me to solve unable to resolve ‘LABEL=writable’ issue. Adding this information for readers whoever facing similar issues.

After, correcting mmc issues, I am able to boot further and came to below point.
[ OK ] Started Start the snapd services from the snapd snap.
[ OK ] Started Ubuntu Core Firstboot Configuration tty1.
[ OK ] Started Ubuntu Core Firstboot Configuration ttymxc3.
[ OK ] Reached target Multi-User System.
[ OK ] Reached target Graphical Interface.
Starting Update UTMP about System Runlevel Changes…
[ OK ] Started Update UTMP about System Runlevel Changes.

error: cannot obtain system details: cannot communicate with server: Get http://localhost/v2/system-info: dial unix /run/snapd.socket: connect: connection refused
Press enter to configure.

no, all this information is put in place by ubuntu-image at image build time, it is important that your gadget snap is set up correctly for this though, so snapd can set your cmdline in the image …

I am not getting out further from Network Connection…
After “Done” option from Network connection, I could see 66% and then getting Network configuration timed out; please verify your settings message.
Am I missing anything in Kernel snap?

a driver or firmware for your network card ?

Is network mandatory for UC boot?

it is mandatory if you want to use console-conf to create a user to be able to log in (which pulls the ssh key from login.ubuntu.com)