Skip to content

Commit

Permalink
Fix(NODE-1285): Freeze clock when using faketime
Browse files Browse the repository at this point in the history
  • Loading branch information
Bownairo committed Feb 14, 2024
1 parent 3bdf0f0 commit a27b2f9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ic-os/bootloader/build-bootloader-tree.sh
Expand Up @@ -31,7 +31,7 @@ docker build --iidfile ${TMPDIR}/iidfile - <<<"
RUN mkdir -p /build/boot/efi/EFI/Boot
RUN grub-mkimage --version
RUN apt list --installed | grep grub
RUN faketime '1970-1-1 0' grub-mkimage -p '(,gpt2)/' -O x86_64-efi -o /build/boot/efi/EFI/Boot/bootx64.efi \
RUN faketime -f '1970-1-1 0:0:0' grub-mkimage -p '(,gpt2)/' -O x86_64-efi -o /build/boot/efi/EFI/Boot/bootx64.efi \
boot linux search normal configfile \
part_gpt btrfs ext2 fat iso9660 loopback \
test keystatus gfxmenu regexp probe \
Expand Down
9 changes: 5 additions & 4 deletions toolchains/sysimage/build_fat32_image.py
Expand Up @@ -38,12 +38,12 @@ def untar_to_fat32(tf, fs_basedir, out_file, path_transform):
if path == "":
continue
os.mkdir(os.path.join(fs_basedir, path))
subprocess.run(["faketime", "1970-1-1 0", "mmd", "-i", out_file, "::/" + path], check=True)
subprocess.run(["faketime", "-f", "1970-1-1 0:0:0", "mmd", "-i", out_file, "::/" + path], check=True)
elif member.type == tarfile.REGTYPE or member.type == tarfile.AREGTYPE:
with open(os.path.join(fs_basedir, path), "wb") as f:
f.write(tf.extractfile(member).read())
subprocess.run(
["faketime", "1970-1-1 0", "mcopy", "-o", "-i", out_file, os.path.join(fs_basedir, path), "::/" + path],
["faketime", "-f", "1970-1-1 0:0:0", "mcopy", "-o", "-i", out_file, os.path.join(fs_basedir, path), "::/" + path],
check=True,
)
else:
Expand All @@ -58,7 +58,8 @@ def install_extra_files(out_file, extra_files, path_transform):
subprocess.run(
[
"faketime",
"1970-1-1 0",
"-f",
"1970-1-1 0:0:0",
"mcopy",
"-o",
"-i",
Expand Down Expand Up @@ -132,7 +133,7 @@ def path_transform(path, limit_prefix=limit_prefix):
os.truncate(image_file, image_size)
subprocess.run(["/usr/sbin/mkfs.fat", "-F", "32", "-i", "0", image_file], check=True)
if image_label:
subprocess.run(["faketime", "1970-1-1 0", "/usr/sbin/fatlabel", image_file, image_label], check=True)
subprocess.run(["faketime", "-f", "1970-1-1 0:0:0", "/usr/sbin/fatlabel", image_file, image_label], check=True)

if in_file:
with tarfile.open(in_file, mode="r|*") as tf:
Expand Down
7 changes: 4 additions & 3 deletions toolchains/sysimage/build_vfat_image.py
Expand Up @@ -38,12 +38,12 @@ def untar_to_vfat(tf, fs_basedir, out_file, path_transform):
if path == "":
continue
os.mkdir(os.path.join(fs_basedir, path))
subprocess.run(["faketime", "1970-1-1 0", "mmd", "-i", out_file, "::/" + path], check=True)
subprocess.run(["faketime", "-f", "1970-1-1 0:0:0", "mmd", "-i", out_file, "::/" + path], check=True)
elif member.type == tarfile.REGTYPE or member.type == tarfile.AREGTYPE:
with open(os.path.join(fs_basedir, path), "wb") as f:
f.write(tf.extractfile(member).read())
subprocess.run(
["faketime", "1970-1-1 0", "mcopy", "-o", "-i", out_file, os.path.join(fs_basedir, path), "::/" + path],
["faketime", "-f", "1970-1-1 0:0:0", "mcopy", "-o", "-i", out_file, os.path.join(fs_basedir, path), "::/" + path],
check=True,
)
else:
Expand All @@ -58,7 +58,8 @@ def install_extra_files(out_file, extra_files, path_transform):
subprocess.run(
[
"faketime",
"1970-1-1 0",
"-f",
"1970-1-1 0:0:0",
"mcopy",
"-o",
"-i",
Expand Down

0 comments on commit a27b2f9

Please sign in to comment.