Porting ubuntu core to IMX6/am335x issue?


#1

Since this is not possible for booting ubuntu core without
initrd. and where can I get the initrd ? thanks!

Best Regards
QIng


#2

In reality, I can’t understand the uboot env as follow:
setenv mmcroot “/dev/disk/by-label/writable ${snappy_cmdline} snap_core=${snap_core} snap_kernel=${snap_kernel}”;
and
snappy_cmdline=rng_core.default_quality=700 net.ifnames=0 init=/lib/systemd/systemd ro panic=-1 fixrtc
is this fixed for every soc platform ? who process this argument? Can you give me a detailed explanation, it will be great!
Because I can’t see
any other information about ubuntu core for risc platform on other website, so thanks for your explanation!

Best Regards
Qing


#3

the initrd is automatically added to the kernel snap during the kernel snap creation by snapcraft.

it lives originally inside the core snap which is downloaded from the snap store during the kernel snap creation, it is then copied into the right place in the kernel snap so that ubuntu-image can put it in the right place during image creation.


#4

I get it, thanks very much!
Best Regards
Qing


#5

the “setenv mmcroot” call itself is device specific, it sets the kernel commandline in the example you gave. the content (adding the writable label as rootfs target, setting snap_kernel and snap_core) is generic and not device specific… i.e. your device might not use “mmcroot” but have some special script or variable to set the final boot commandline. if you port to a new device you should use the device specific command or variable that sets it … but every device will have to have the generic similar content on the resulting kernel comandline.

as you can see parts of this are set up in snappy_cmdline which is simply included in the device specific “setenv mmcroot”.

during boot the kernel snap_kernel and snap_core variables are read by the bootloader to find the kernel and initrd.

later after kernel and initrd are running the kernel cmdline is read by the initrd to find the writable partition, set system defaults that are required by Ubuntu Core and to find the core snap on top of the writable partition to then assemble a usable root filesystem to boot from. many/most of these values are also used by userspace tools during snap updates (i.e. snap_kernel and snap_core variables need to be updated by snapd when either of these packages is updated)


#6

Dear ogra:
thanks for your reply.
If I have a pre-built kernel image(dtb, zImage, and module.tar.gz), What should I do for genetating the kernel snap package? and how to write the yaml?
and where I will put these images into ?

thanks very much!

Best Regards
Qing


#7

you can use the nil plugin and an override-build scriptlet … there you can just use normal shell commands like cp and mkdir to copy your files into $SNAPCRAFT_PART_INSTALL into a proper directory tree …

just make sure your snapcraft.yaml has “Type: kernel” at the top, that should be enough.

Nore though that it is essential that all the right kernel config options are set in your binary kernel and the required patch sets (if it is an older one) for apparmor are included in the build.

for the initrd you can use snap download to download the core snap and extract the initrd.img from it (use the unsquashfs tool from the squashfs-tools package) then copy it into $SNAPCRAFT_PART_INSTALL


#8

Dear ogra:
Thank you very much!
It’s okay to generate the boot image.
But when boot steps, it is always blocked for configuring the network, When I set the DHCP on eth0 and press “Done”, it’s always like this picture ?


Can you give me some suggestions? thank you very much!

Best Regards
Qing


#9

And then: Network configuration timed out; please verify your settings. are showed.


#10

Does your kernel include the right modules and defaults to bring up your network card ?

is this a wireless or a wired card ? and if wireless, do you include the correct firmware ?


#11

It is wired card, and I can see that it has a correct IP by DHCP, but it always blocked and then show timeout.
So for, I can’t login the system .

Best Regards
Qing


#12

Dear ogra:
the login by network was failed.
Then, I want to login by a system user.
To create the system user , I need insert the udisk .
But am335x need load a module in rootfs startup to see a udisk.
modprobe g_multi ${g_storage} ${g_defaults} ${g_product} ${g_network}

How Can I modify the core? and the modification is allowed ?

Is it okay for me to do this job in initrd ?

Thank you very much!
Best Regards
Qing


#13

theoretically you would define initramfs-modules: in your kernel snap in snapcraft.yaml but that would mean you need to actually use the kernel plugin and build your kernel from source, which i understand you dont …

there are indeed ways to re-pack the initrd and hack it up to force-load your module though … but YMMV …

an easier way to debug this is probably to just use the SD card you boot from in a PC and inspect the logs from there … if you did not explicitly disable rsyslog it will create /writable/system-data/var/log/syslog (and there should also be a console-conf log in this dir), that you should be able to simply read when mounting the card on a desktop machine.


#14

Dear ogra:
Currently , Creating a system user is essential for us. So we must make sure that the udisk is available。

You said that we can modify the initrd for the our need. I want to know that the initrd need to be updated in future?
If the snapd will update the initrd, the system will can’t use the updated initrd(provided by ubuntu, standard ). ?..

And you said that we can use kernel plugin to build our kernel. maybe we need try to build kernel by kernel plugin instead of the pre-built image.
and I can use the kernel-initrd-modules to list we needed kernel modules. But the modules need some parameters when inserting. How can I do for this issue ?

Thanks

Best Regards
Qing


#15

you dont, snapd has a systemd job and udev rues that check for attached usb devices on every boot and at plug-in, just use an USB stick with a user assertion on it and it should be read.

the only valuable thing to have in the initrd is support to find your root disk (SD, mmc, USB or whatever else you have attached to run the system from) … everything else should really be handled after the rootfs is up. for that case /etc/modprobe.d is writable on the system, you can put something into it after you created the SD card in /writale/system-data/etc/modprobe.d (create that dir if needed) from a PC…


#16
Sep 12 09:45:40 localhost systemd-networkd[1219]: eth1: Configured

Sep 12 09:45:40 localhost systemd[1]: Starting Update resolvconf for networkd DNS…
Sep 12 09:45:40 localhost systemd-timesyncd[1442]: Network configuration changed, trying to establish connection.
Sep 12 09:45:40 localhost systemd[1]: Started Update resolvconf for networkd DNS.
Sep 12 09:45:40 localhost systemd-timesyncd[1442]: Synchronized to time server 91.189.94.4:123 (ntp.ubuntu.com).
Sep 12 09:45:41 localhost systemd[1]: Created slice system-console\x2dconf.slice.
Sep 12 09:45:41 localhost systemd[1]: Started Ubuntu Core Firstboot Configuration tty1.
Sep 12 09:45:42 localhost systemd[1]: Created slice system-serial\x2dconsole\x2dconf.slice.
Sep 12 09:45:42 localhost systemd[1]: Started Ubuntu Core Firstboot Configuration ttyO0.
Sep 12 09:45:42 localhost snapd[1642]: AppArmor status: apparmor is enabled and all features are available
Sep 12 09:45:42 localhost snapd[1642]: helpers.go:132: error trying to compare the snap system key: system-key missing on disk
Sep 12 09:45:43 localhost snapd[1642]: daemon.go:344: started snapd/2.35 (series 16) ubuntu-core/16 (armhf) linux/4.4.19-gff01773757.
Sep 12 09:45:43 localhost sshd-host-keygen[1566]: Creating SSH2 RSA key; this may take some time …
Sep 12 09:45:43 localhost systemd[1]: Started Snappy daemon.
Sep 12 09:45:43 localhost sshd-host-keygen[1566]: 2048 SHA256:cDAK4Rmtq/gX09FDABlM9eDjsyigKZk3rZTheGfEj9g root@localhost.localdomain (RSA)
Sep 12 09:45:43 localhost systemd[1]: Starting Auto import assertions from block devices…
Sep 12 09:45:43 localhost systemd[1]: Starting Wait until snapd is fully seeded…
Sep 12 09:45:43 localhost snap[1681]: cmd_auto_import.go:142: error: cannot import /run/snapd/auto-import/jGU3W1qJwmejxMtGQdaSw2iC3yNaPOcrrhu0vCI7M3_Rj6NiY5_u7KNsIjZT0V9k.assert: assert failed: cannot find account-key (BWDEoaqyr25nF5SNCvEv2v7QnM9QsfCc0PBMYD_i2NGSQ32EF2d4D0hqUel3m8ul)
Sep 12 09:45:43 localhost systemd[1]: Started Auto import assertions from block devices.


#17

When I creat the system user, these are some error message occur.
Can you give me some advice about it ?
Thank you very much!

Best Regards
Qing


#18

you need to make sure our system-user assertion is signed by the exact same key that was used to sign the model assertion, else the system will not accept it


#20

Dear ogra:
what’s mean the following information:
Starting Wait until snapd is fully seeded…
Sep 13 03:34:39 localhost snap[1447]: cmd_auto_import.go:145: imported /run/snapd/auto-import/OV2_YgCy3eT8mcHK90zFkqEhVqdecr299smXNJ8DBnVyAfsE2z1UcTGPlENVyUfS.assert
Sep 13 03:34:39 localhost systemd[1]: Started Wait until snapd is fully seeded.
Sep 13 03:34:39 localhost sh[815]: sed: can’t read /run/systemd/netif/leases/*: No such file or directory
Sep 13 03:34:39 localhost snapd[1412]: api.go:2183: ignoring system-user assertion for “root@localhost”: cannot add system-user “root@localhost”: “rsb4220” not in models [“rsb4220.model”]

Best Regards
Qing


#21

i dont think you can use “root” as username here (probably also not “admin”, not sure)