Building initramfs files from script results in binary not comparable
cmp files even though
diff -r /rootfs1/ /rootfs2/ exits with
diff finds no differences.
The differences I can find are the Access and Change dates. For example:
# stat /rootfs1/config File: /rootfs1/config Size: 275 Blocks: 8 IO Block: 4096 regular file Device: 28h/40d Inode: 119120 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2017-12-12 01:31:03.800453381 +0100 Modify: 2017-12-05 20:11:38.000000000 +0100 Change: 2017-12-12 01:02:38.607238288 +0100 Birth: - # stat /rootfs2/config File: /rootfs2/config Size: 275 Blocks: 8 IO Block: 4096 regular file Device: 28h/40d Inode: 119881 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2017-12-12 01:28:02.913799257 +0100 Modify: 2017-12-05 20:11:38.000000000 +0100 Change: 2017-12-12 01:20:44.920496295 +0100 Birth: -
I have checked that the
findcommand returns all directory items in exactly the same order, OK.
I tried to touch reference every entry in the directory structures to an identical source file. Still with no luck for creating an identical byte stream.
bsdcpioresulting initramfs images already differ at byte 5:
$ cmp /tmp/1.img /tmp/2.img
/tmp/rootfs1/initramfs.img /tmp/rootfs2/initramfs.img differ: char 5, line 1
mount -o remount,noatime /tmpdoes still update "time of last status change" according to
The bsdcpio scripting code is like:
pushd "$BUILDROOT" >/dev/null find -mindepth 1 -printf '%P\0' | LANG=C bsdcpio -0 -o -H newc | lz4 -l > "$out"
Is there any chance in having an identical output byte stream for consecutive script runs where $BUILDROOT is a new temporary folder on each run?