Simple script and config (type-safe) for building custom Linux kernels for Firecracker MicroVMs

refactor: improve git reset and cleanup process in build script

+14 -5
+14 -5
build.ts
··· 146 146 await run(["git", "-C", "linux-stable", "fetch", "origin", REF]); 147 147 } 148 148 149 - await run(["git", "-C", "linux-stable", "reset", "--hard", REF]); 149 + Deno.chdir("linux-stable"); 150 + 151 + await run(["rm", "-rf", "Documentation/Kbuild"]); 152 + await run(["make", "mrproper"]); 153 + await run([ 154 + "sh", 155 + "-c", 156 + "rm -rf include/uapi/linux/netfilter/xt_* include/uapi/linux/netfilter_ipv4/ipt_*.h include/uapi/linux/netfilter_ipv6/ip6t_*.h net/netfilter/xt_*.c rm -f tools/memory-model/litmus-tests", 157 + ]); 158 + 159 + await run(["git", "checkout", "-f", REF]); 150 160 151 - await run(["git", "-C", "linux-stable", "checkout", "-f", REF]); 161 + Deno.chdir(".."); 152 162 } 153 163 154 164 if (!(await Deno.stat(".config").catch(() => false))) { ··· 162 172 163 173 Deno.chdir("linux-stable"); 164 174 165 - await run(["rm", "-rf", "Documentation/Kbuild"]); 166 - await run(["make", "mrproper"]); 175 + await Deno.copyFile("../.config", ".config"); 167 176 168 - await Deno.copyFile("../.config", ".config"); 177 + await run(["make", "prepare"]); 169 178 170 179 const nproc = await getNproc(); 171 180 const makeProcess = new Deno.Command("make", {