Can you please use triple backticks above and below pasted content, else it is really hard to read (and losses formatting too)
this is my auto-import.assert, when insert the udisk, it alway tell me to “Press enter to configure”.
MxZc2QJWIe09yxtEQ3yfFbHd56xWZ9HW is the brand-id used in the model assertion you used for building the image, then i’m out of ideas here, perhaps @pedronis can help further …
EDIT: oh, wait … (the broken formatting tricked me) … your model assertion of the device seems to be rsb4220, but your system-user assertion defines
model: advantech, this cant work indeed, the name of the model needs to match.
How can I add a boot start script into core image (not that by snap insatll to insatll)?
that is , when I use ubuntu-image generate a image, the scripts is in the /writeable/etc/…/.
you can just put it on the SD card after you wrote the image to SD …
When I try to access EMMC/SD/udisk flash， which interface I should use？
do you mean from a snap package ? there is no interface for general disk access, a snap will only be able to access certain bits of the filesystem in context of its own sandboxing …
the list of environment variables that point to writable locations on disk is in:
How can I make our am335x device support usb-gadget function in ubuntu core snap?
how can add the interface for the gadget-init.sh ?
if you use your own kernel snap you can simply compile g_serial (and all its dependencies) into the kernel … alternatively you can also use:
kernel-initrd-modules: - g_serial - u_serial - usb_f_acm - libcomposite
in the snapcraft.yaml of your kernel snap in case you are fine to load g_serial as module and only have the serial port available once the initrd is unpacked …
one other (rather hackish) approach is to use an initrd snippet in your gadget that puts a script and systemd unit in place on first boot …
an example for a gadget that ships an initrd snippet is:
How can I enable the watchdog in my app snap？ apparmor always denied the app as below：
Log: apparmor=“DENIED” operation=“open” profile=“snap.block-test.watchdog” name="/dev/watchdog" pid=2355 comm=“AutoRun_WTD” requested_mask=“w” denied_mask=“w” fsuid=0 ouid=0
Hardware watchdog is supported by default after snapd 2.34.
You can use the “snap set” command to config the watchdog parameters.
$ snap set core watchdog.runtime-timeout=1m
Set a timeout value in seconds (or in other time units if suffixed with “ms”, “min”, “h”, “d”, “w”). The watchdog hardware (/dev/watchdog) or the kernel option systemd.watchdog-device=) will be programmed to automatically reboot the system if it is not contacted within the specified timeout interval.
$ snap set core watchdog.shutdown-timeout=10m
It works as a safety net to ensure that the reboot takes place even if a clean reboot attempt times out. Note that the shutdown-timeout applies only to the second phase of the reboot, i.e. after all regular services are already terminated, and after the system and service manager process (PID 1) got replaced by the systemd-shutdown binary.
The backend is integrated with systemd, you can check the configuration in /etc/systemd/system.conf.d/10-snapd-watchdog.conf
 Merge pull request #5309 from alfonsosanchezbeato/support-systemd-wat… · snapcore/snapd@a64ba63 - https://github.com/snapcore/snapd/commit/a64ba631863bc9bfab8d2f98a4df8a0ac4974935
The initrd.img in my image generated by ubuntu-image seem to be different from core.snap. It seem to be the one in kernel.snap. And ubuntu-image do not put the one in core.snap in the image file.What is the different between the two initrd.img files?
When you build the kernel snap, snapcraft downloads the core snap and copies initrd.img-core into your kernel snap, if you added any extra
kernel-initrd-firmware: in your snapcraft.yaml it will re-pack this initrd and add the required modules.
The one in core is the generic initrd containing all generic scripts and bits needed to boot. Most of the time this is simply copied directly in place from the core snap, only if your snapcraft.yaml of the kernel snap enforces the use extra firmare or modules via the above options it is modified.
The initrd used during boot is always the one coming from the kernel snap. At image build time ubuntu-image will take care that it lives in a place where your boot setup can find it via the
snap_kernel= uboot.env variable.