Same binary, every build

In Uncategorized on February 4, 2010 at 11:47 pm

Wouldn’t it be nice if you did a make today and a make a week from now, and if nothing had changed, you got the same binaries? This is quite useful when trying to reproduce old firmware images.

I set out trying to carry out this task:

  • Replace all references to the current date (__DATE__) with references to the last modification time of the file from your revision control system (CVS $Date$).
  • Pass the --user=0 and --group=0 arguments to tar so that the same user is listed for every build.
  • Use touch before running tar or gzip to likewise set the modification date of any binaries. I have a small C program that will go through a tar file and “fix” the modification dates.

I’m still working on a program to have the e2fs UUID be the MD5 or such of the contained binaries. I’m not sure I want to go ahead with this, it’s something I ran into quickly when trying to reproduce a file system image bit-for-bit.

%d bloggers like this: