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

refactor: streamline git fetch and reset logic in build process

+9 -22
+9 -22
build.ts
··· 131 "linux-stable", 132 ]); 133 } else { 134 - // Update existing checkout to the desired ref 135 - await run([ 136 - "git", 137 - "-C", 138 - "linux-stable", 139 - "fetch", 140 - "--tags", 141 - "--force", 142 - "origin", 143 - ]); 144 - 145 // Shallow-fetch the specific ref (works for both branches and tags) 146 try { 147 await run([ ··· 151 "fetch", 152 "--depth=1", 153 "origin", 154 - `${REF}:${REF}`, 155 ]); 156 } catch { 157 - await run([ 158 - "git", 159 - "-C", 160 - "linux-stable", 161 - "fetch", 162 - "origin", 163 - `${REF}:${REF}`, 164 - ]); 165 } 166 167 await run(["git", "-C", "linux-stable", "checkout", "-f", REF]); 168 } ··· 176 await Deno.writeTextFile(".config", cfg); 177 } 178 179 - await Deno.copyFile(".config", "linux-stable/.config"); 180 181 - Deno.chdir("linux-stable"); 182 183 const nproc = await getNproc(); 184 const makeProcess = new Deno.Command("make", {
··· 131 "linux-stable", 132 ]); 133 } else { 134 // Shallow-fetch the specific ref (works for both branches and tags) 135 try { 136 await run([ ··· 140 "fetch", 141 "--depth=1", 142 "origin", 143 + REF, 144 ]); 145 } catch { 146 + await run(["git", "-C", "linux-stable", "fetch", "origin", REF]); 147 } 148 + 149 + await run(["git", "-C", "linux-stable", "reset", "--hard", REF]); 150 151 await run(["git", "-C", "linux-stable", "checkout", "-f", REF]); 152 } ··· 160 await Deno.writeTextFile(".config", cfg); 161 } 162 163 + Deno.chdir("linux-stable"); 164 + 165 + await run(["rm", "-rf", "Documentation/Kbuild"]); 166 + await run(["make", "mrproper"]); 167 168 + await Deno.copyFile("../.config", ".config"); 169 170 const nproc = await getNproc(); 171 const makeProcess = new Deno.Command("make", {