kernel
This commit is contained in:
parent
8d4e6db7d2
commit
214e7342ae
2 changed files with 52 additions and 3 deletions
17
index.ts
17
index.ts
|
@ -1,15 +1,26 @@
|
||||||
import { mkdir, mkdtemp } from "node:fs/promises";
|
import { mkdir, mkdtemp } from "node:fs/promises";
|
||||||
import { tmpdir } from "node:os";
|
import { tmpdir } from "node:os";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
import { cwd } from "node:process";
|
||||||
import { Alpine } from "./alpine.js";
|
import { Alpine } from "./alpine.js";
|
||||||
import { spawn } from "./helpers.js";
|
import { spawn } from "./helpers.js";
|
||||||
|
import { setupKernel } from "./kernel.js";
|
||||||
import { Runit } from "./runit/index.js";
|
import { Runit } from "./runit/index.js";
|
||||||
|
|
||||||
{
|
{
|
||||||
|
console.time("Building");
|
||||||
|
|
||||||
const rootfsDir = await mkdtemp(path.join(tmpdir(), "define-alpine-"));
|
const rootfsDir = await mkdtemp(path.join(tmpdir(), "define-alpine-"));
|
||||||
console.debug(rootfsDir);
|
console.debug(rootfsDir);
|
||||||
const alpine = await Alpine.makeWorld({ dir: rootfsDir });
|
const alpine = await Alpine.makeWorld({ dir: rootfsDir });
|
||||||
const runit = await Runit.setup(alpine);
|
const runit = await Runit.setup(alpine);
|
||||||
|
await setupKernel(alpine);
|
||||||
|
|
||||||
|
console.timeEnd("Building");
|
||||||
|
|
||||||
|
const artifactsDir = path.join(cwd(), "artifacts/");
|
||||||
|
await mkdir(artifactsDir);
|
||||||
|
|
||||||
// await makeService({
|
// await makeService({
|
||||||
// parentDir: rootfsDir,
|
// parentDir: rootfsDir,
|
||||||
// name: "grafana",
|
// name: "grafana",
|
||||||
|
@ -17,9 +28,9 @@ import { Runit } from "./runit/index.js";
|
||||||
// setup: async (dir) => {},
|
// setup: async (dir) => {},
|
||||||
// initScript: async (dir) => {},
|
// initScript: async (dir) => {},
|
||||||
// });
|
// });
|
||||||
try {
|
// try {
|
||||||
await spawn("sudo", ["chroot", rootfsDir], { stdio: "inherit" });
|
// await spawn("sudo", ["chroot", rootfsDir], { stdio: "inherit" });
|
||||||
} catch {}
|
// } catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// interface Service {}
|
// interface Service {}
|
||||||
|
|
38
kernel.ts
Normal file
38
kernel.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import { Alpine } from "./alpine";
|
||||||
|
|
||||||
|
export async function setupKernel(alpine: Alpine): Promise<void> {
|
||||||
|
await alpine.writeFile(
|
||||||
|
"/etc/update-extlinux.conf",
|
||||||
|
`# configuration for extlinux config builder
|
||||||
|
|
||||||
|
# Overwrite current /boot/extlinux.conf.
|
||||||
|
overwrite=1
|
||||||
|
|
||||||
|
# vesa_menu
|
||||||
|
# use fancy vesa menu (vesamenu.c32) menus, won't work with serial
|
||||||
|
vesa_menu=1
|
||||||
|
|
||||||
|
#default_kernel_opts=quiet
|
||||||
|
default_kernel_opts=
|
||||||
|
modules=loop,squashfs,sd-mod,usb-storage,ext4,vfat
|
||||||
|
|
||||||
|
# root device - if not specified, will be guessed using
|
||||||
|
# blkid -o export /dev/root
|
||||||
|
root=/dev/sda
|
||||||
|
|
||||||
|
# if set to non-zero, update-extlinux will be a lot more verbose.
|
||||||
|
verbose=0
|
||||||
|
|
||||||
|
hidden=0
|
||||||
|
timeout=3
|
||||||
|
default=lts
|
||||||
|
`
|
||||||
|
);
|
||||||
|
|
||||||
|
await alpine.writeFile(
|
||||||
|
"/etc/mkinitfs/mkinitfs.conf",
|
||||||
|
'features="squashfs ata base cdrom ext4 keymap kms mmc nvme scsi usb virtio"'
|
||||||
|
);
|
||||||
|
|
||||||
|
await alpine.addPackages(["linux-virt"]);
|
||||||
|
}
|
Loading…
Reference in a new issue