Don't duplicate initrd and kernel files

Bug #1674965 reported by Paolo Pisati
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Triaged
Low
Paolo Pisati

Bug Description

Stop duplicating kernel and initrd files in the kernel snap, use symlinks instead - as a side effect we trim +10MB from the kernel snap:

Before:

$ ls -la squashfs-root/
total 27604
drwxrwxr-x 5 flag flag 4096 mar 22 12:20 .
drwxr-xr-x 29 flag flag 4096 mar 22 12:21 ..
-rw-rw-r-- 2 flag flag 6531440 mar 22 12:20 bzImage-4.9.0+
drwxrwxr-x 36 flag flag 4096 mar 22 12:20 firmware
-rw-rw-r-- 2 flag flag 5807334 mar 22 12:20 initrd-4.9.0+.img
-rw-rw-r-- 2 flag flag 5807334 mar 22 12:20 initrd.img
-rw-rw-r-- 2 flag flag 6531440 mar 22 12:20 kernel.img
drwxrwxr-x 2 flag flag 4096 mar 22 12:20 meta
drwxrwxr-x 3 flag flag 4096 mar 22 12:20 modules
-rw-rw-r-- 1 flag flag 3559958 mar 22 12:20 System.map-4.9.0+

With this change:

$ ls -la squashfs-root/
total 15552
drwxrwxr-x 5 flag flag 4096 mar 22 12:12 .
drwxr-xr-x 29 flag flag 4096 mar 22 12:13 ..
-rw-rw-r-- 1 flag flag 6531216 mar 22 12:12 bzImage-4.9.0+
drwxrwxr-x 36 flag flag 4096 mar 22 12:12 firmware
-rw-rw-r-- 1 flag flag 5806664 mar 22 12:12 initrd-4.9.0+.img
lrwxrwxrwx 1 flag flag 17 mar 22 12:13 initrd.img -> initrd-4.9.0+.img
lrwxrwxrwx 1 flag flag 14 mar 22 12:13 kernel.img -> bzImage-4.9.0+
drwxrwxr-x 2 flag flag 4096 mar 22 12:12 meta
drwxrwxr-x 3 flag flag 4096 mar 22 12:12 modules
-rw-rw-r-- 1 flag flag 3559958 mar 22 12:12 System.map-4.9.0+

Revision history for this message
Oliver Grawert (ogra) wrote :

is there any need to have the versioned files at all ?

iirc we do not ever use them anyway, so they would only be relevant for users poking around inside the snap to actually see the versioning (which snap list would hopefully tell them without tinkering).

image building will only handle the unversioned variants. (in that light it might probably also be cleverer to flip around the logic and make the versioned file a symlink to the unversioned one)

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

we are currently creating hardlinks, the PR switches that to symlinks. I am not sure what the gain is

Revision history for this message
Sergio Schvezov (sergiusens) wrote :
Changed in snapcraft:
importance: Undecided → Low
status: New → In Progress
assignee: nobody → Paolo Pisati (p-pisati)
Changed in snapcraft:
status: In Progress → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.