aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch b/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch
new file mode 100644
index 0000000000..46014e7a32
--- /dev/null
+++ b/tools/mtd-utils/patches/320-mkfs.jffs2-SOURCE_DATE_EPOCH.patch
@@ -0,0 +1,62 @@
+Index: mtd-utils-1.5.2/mkfs.jffs2.c
+===================================================================
+--- mtd-utils-1.5.2.orig/mkfs.jffs2.c
++++ mtd-utils-1.5.2/mkfs.jffs2.c
+@@ -108,7 +108,7 @@ static char *rootdir = default_rootdir;
+ static int verbose = 0;
+ static int squash_uids = 0;
+ static int squash_perms = 0;
+-static int fake_times = 0;
++static time_t fixed_timestamp = -1;
+ int target_endian = __BYTE_ORDER;
+
+ uint32_t find_hardlink(struct filesystem_entry *e)
+@@ -249,8 +249,8 @@ static struct filesystem_entry *add_host
+ mode &= ~(S_ISUID | S_ISGID);
+ }
+ }
+- if (fake_times) {
+- timestamp = 0;
++ if (fixed_timestamp != -1) {
++ timestamp = fixed_timestamp;
+ }
+
+ entry = xcalloc(1, sizeof(struct filesystem_entry));
+@@ -1554,6 +1554,20 @@ void parse_image(){
+ close(in_fd);
+ }
+
++static void set_source_date_epoch() {
++ char *env = getenv("SOURCE_DATE_EPOCH");
++ char *endptr = env;
++ errno = 0;
++ if (env && *env) {
++ fixed_timestamp = strtoull(env, &endptr, 10);
++ if (errno || (endptr && *endptr != '\0')) {
++ fprintf(stderr, "Invalid SOURCE_DATE_EPOCH");
++ exit(1);
++ }
++ }
++}
++
++
+ int main(int argc, char **argv)
+ {
+ int c, opt;
+@@ -1572,6 +1586,7 @@ int main(int argc, char **argv)
+ warn_page_size = 1; /* warn user if page size not 4096 */
+
+ jffs2_compressors_init();
++ set_source_date_epoch();
+
+ while ((opt = getopt_long(argc, argv,
+ "D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0)
+@@ -1622,7 +1637,7 @@ int main(int argc, char **argv)
+ break;
+
+ case 'f':
+- fake_times = 1;
++ fixed_timestamp = 0;
+ break;
+
+ case 'h':
id='n176' href='#n176'>176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362