aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2021-12-27 01:30:05 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2021-12-27 01:30:05 +0100
commitc142732367dde6a2e350b33dfebbfbcd8bd891ce (patch)
tree39905bd6d26e28e3dd8263c112a45f93165d54e3
parent1ed54c427769a1f4225e47947948d70f2c3d48a0 (diff)
downloadmitjafelicijan.com-c142732367dde6a2e350b33dfebbfbcd8bd891ce.tar.gz
New post: Golang as PID 1
-rw-r--r--Makefile3
-rw-r--r--assets/pid1/qemu.log320
-rw-r--r--assets/pid1/unikernels.pngbin0 -> 48567 bytes
-rw-r--r--assets/pid1/unikernels.svg578
-rw-r--r--posts/2021-12-25-running-golang-application-as-pid1.md229
5 files changed, 1130 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 450f700..049c04b 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,9 @@ build:
33 alternator --build 33 alternator --build
34 rm template/openring-build.html 34 rm template/openring-build.html
35 35
36server:
37 python3 -m http.server 8000 --directory public
38
36deploy: build 39deploy: build
37 cd public && scp -r * root@165.22.87.180:/var/www/html/mitjafelicijan.com/ 40 cd public && scp -r * root@165.22.87.180:/var/www/html/mitjafelicijan.com/
38 ssh root@165.22.87.180 chown www-data:www-data /var/www/html/mitjafelicijan.com/ -Rf 41 ssh root@165.22.87.180 chown www-data:www-data /var/www/html/mitjafelicijan.com/ -Rf
diff --git a/assets/pid1/qemu.log b/assets/pid1/qemu.log
new file mode 100644
index 0000000..11be312
--- /dev/null
+++ b/assets/pid1/qemu.log
@@ -0,0 +1,320 @@
1[ 0.000000] Linux version 5.15.7 (m@khan) (gcc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7), GNU ld version 2.37-10.fc35) #7 SMP Mon Dec 13 10:23:25 CET 2021
2[ 0.000000] Command line: console=ttyS0
3[ 0.000000] x86/fpu: x87 FPU will use FXSAVE
4[ 0.000000] signal: max sigframe size: 1440
5[ 0.000000] BIOS-provided physical RAM map:
6[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
7[ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
8[ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
9[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000007fdffff] usable
10[ 0.000000] BIOS-e820: [mem 0x0000000007fe0000-0x0000000007ffffff] reserved
11[ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
12[ 0.000000] NX (Execute Disable) protection: active
13[ 0.000000] SMBIOS 2.8 present.
14[ 0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-6.fc35 04/01/2014
15[ 0.000000] tsc: Fast TSC calibration failed
16[ 0.000000] last_pfn = 0x7fe0 max_arch_pfn = 0x400000000
17[ 0.000000] x86/PAT: Configuration [0-7]: WB WC UC- UC WB WP UC- WT
18[ 0.000000] found SMP MP-table at [mem 0x000f5c40-0x000f5c4f]
19[ 0.000000] RAMDISK: [mem 0x07e06000-0x07fdffff]
20[ 0.000000] ACPI: Early table checksum verification disabled
21[ 0.000000] ACPI: RSDP 0x00000000000F5A80 000014 (v00 BOCHS )
22[ 0.000000] ACPI: RSDT 0x0000000007FE1905 000034 (v01 BOCHS BXPC 00000001 BXPC 00000001)
23[ 0.000000] ACPI: FACP 0x0000000007FE17B9 000074 (v01 BOCHS BXPC 00000001 BXPC 00000001)
24[ 0.000000] ACPI: DSDT 0x0000000007FE0040 001779 (v01 BOCHS BXPC 00000001 BXPC 00000001)
25[ 0.000000] ACPI: FACS 0x0000000007FE0000 000040
26[ 0.000000] ACPI: APIC 0x0000000007FE182D 000078 (v01 BOCHS BXPC 00000001 BXPC 00000001)
27[ 0.000000] ACPI: HPET 0x0000000007FE18A5 000038 (v01 BOCHS BXPC 00000001 BXPC 00000001)
28[ 0.000000] ACPI: WAET 0x0000000007FE18DD 000028 (v01 BOCHS BXPC 00000001 BXPC 00000001)
29[ 0.000000] ACPI: Reserving FACP table memory at [mem 0x7fe17b9-0x7fe182c]
30[ 0.000000] ACPI: Reserving DSDT table memory at [mem 0x7fe0040-0x7fe17b8]
31[ 0.000000] ACPI: Reserving FACS table memory at [mem 0x7fe0000-0x7fe003f]
32[ 0.000000] ACPI: Reserving APIC table memory at [mem 0x7fe182d-0x7fe18a4]
33[ 0.000000] ACPI: Reserving HPET table memory at [mem 0x7fe18a5-0x7fe18dc]
34[ 0.000000] ACPI: Reserving WAET table memory at [mem 0x7fe18dd-0x7fe1904]
35[ 0.000000] No NUMA configuration found
36[ 0.000000] Faking a node at [mem 0x0000000000000000-0x0000000007fdffff]
37[ 0.000000] NODE_DATA(0) allocated [mem 0x07e02000-0x07e05fff]
38[ 0.000000] Zone ranges:
39[ 0.000000] DMA [mem 0x0000000000001000-0x0000000000ffffff]
40[ 0.000000] DMA32 [mem 0x0000000001000000-0x0000000007fdffff]
41[ 0.000000] Normal empty
42[ 0.000000] Movable zone start for each node
43[ 0.000000] Early memory node ranges
44[ 0.000000] node 0: [mem 0x0000000000001000-0x000000000009efff]
45[ 0.000000] node 0: [mem 0x0000000000100000-0x0000000007fdffff]
46[ 0.000000] Initmem setup node 0 [mem 0x0000000000001000-0x0000000007fdffff]
47[ 0.000000] On node 0, zone DMA: 1 pages in unavailable ranges
48[ 0.000000] On node 0, zone DMA: 97 pages in unavailable ranges
49[ 0.000000] On node 0, zone DMA32: 32 pages in unavailable ranges
50[ 0.000000] ACPI: PM-Timer IO Port: 0x608
51[ 0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
52[ 0.000000] IOAPIC[0]: apic_id 0, version 32, address 0xfec00000, GSI 0-23
53[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
54[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
55[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
56[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
57[ 0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
58[ 0.000000] ACPI: Using ACPI (MADT) for SMP configuration information
59[ 0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
60[ 0.000000] smpboot: Allowing 1 CPUs, 0 hotplug CPUs
61[ 0.000000] PM: hibernation: Registered nosave memory: [mem 0x00000000-0x00000fff]
62[ 0.000000] PM: hibernation: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
63[ 0.000000] PM: hibernation: Registered nosave memory: [mem 0x000a0000-0x000effff]
64[ 0.000000] PM: hibernation: Registered nosave memory: [mem 0x000f0000-0x000fffff]
65[ 0.000000] [mem 0x08000000-0xfffbffff] available for PCI devices
66[ 0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1910969940391419 ns
67[ 0.000000] setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:1 nr_node_ids:1
68[ 0.000000] percpu: Embedded 52 pages/cpu s174360 r8192 d30440 u2097152
69[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 31968
70[ 0.000000] Policy zone: DMA32
71[ 0.000000] Kernel command line: console=ttyS0
72[ 0.000000] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes, linear)
73[ 0.000000] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
74[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
75[ 0.000000] Memory: 94464K/130552K available (14350K kernel code, 2582K rwdata, 3596K rodata, 1368K init, 1488K bss, 35828K reserved, 0K cma-reserved)
76[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
77[ 0.000000] rcu: Hierarchical RCU implementation.
78[ 0.000000] rcu: RCU event tracing is enabled.
79[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=1.
80[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 100 jiffies.
81[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
82[ 0.000000] NR_IRQS: 4352, nr_irqs: 256, preallocated irqs: 16
83[ 0.000000] random: get_random_bytes called from start_kernel+0x492/0x65f with crng_init=0
84[ 0.000000] Console: colour VGA+ 80x25
85[ 0.000000] printk: console [ttyS0] enabled
86[ 0.000000] ACPI: Core revision 20210730
87[ 0.000000] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604467 ns
88[ 0.002000] APIC: Switch to symmetric I/O mode setup
89[ 0.005000] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
90[ 0.013000] tsc: Unable to calibrate against PIT
91[ 0.014000] tsc: using HPET reference calibration
92[ 0.014000] tsc: Detected 3189.099 MHz processor
93[ 0.001005] clocksource: tsc-early: mask: 0xffffffffffffffff max_cycles: 0x2df8103a89b, max_idle_ns: 440795220785 ns
94[ 0.002672] Calibrating delay loop (skipped), value calculated using timer frequency.. 6378.19 BogoMIPS (lpj=3189099)
95[ 0.002960] pid_max: default: 32768 minimum: 301
96[ 0.003627] LSM: Security Framework initializing
97[ 0.004329] SELinux: Initializing.
98[ 0.005051] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
99[ 0.005202] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
100[ 0.020479] process: using AMD E400 aware idle routine
101[ 0.020699] Last level iTLB entries: 4KB 512, 2MB 255, 4MB 127
102[ 0.020832] Last level dTLB entries: 4KB 512, 2MB 255, 4MB 127, 1GB 0
103[ 0.021165] Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization
104[ 0.021438] Spectre V2 : Mitigation: Full AMD retpoline
105[ 0.021586] Spectre V2 : Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch
106[ 0.238228] Freeing SMP alternatives memory: 44K
107[ 0.242641] random: fast init done
108[ 0.350203] smpboot: CPU0: AMD QEMU Virtual CPU version 2.5+ (family: 0xf, model: 0x6b, stepping: 0x1)
109[ 0.355136] Performance Events: PMU not available due to virtualization, using software events only.
110[ 0.356607] rcu: Hierarchical SRCU implementation.
111[ 0.360890] smp: Bringing up secondary CPUs ...
112[ 0.361082] smp: Brought up 1 node, 1 CPU
113[ 0.361253] smpboot: Max logical packages: 1
114[ 0.361394] smpboot: Total of 1 processors activated (6378.19 BogoMIPS)
115[ 0.371481] devtmpfs: initialized
116[ 0.378162] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275000 ns
117[ 0.378478] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
118[ 0.381522] PM: RTC time: 00:19:47, date: 2021-12-27
119[ 0.384915] NET: Registered PF_NETLINK/PF_ROUTE protocol family
120[ 0.387403] audit: initializing netlink subsys (disabled)
121[ 0.391765] audit: type=2000 audit(1640564386.402:1): state=initialized audit_enabled=0 res=1
122[ 0.392916] thermal_sys: Registered thermal governor 'step_wise'
123[ 0.392950] thermal_sys: Registered thermal governor 'user_space'
124[ 0.393202] cpuidle: using governor menu
125[ 0.394085] ACPI: bus type PCI registered
126[ 0.396583] PCI: Using configuration type 1 for base access
127[ 0.415012] Kprobes globally optimized
128[ 0.416844] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
129[ 0.420649] cryptomgr_test (20) used greatest stack depth: 15680 bytes left
130[ 0.426071] ACPI: Added _OSI(Module Device)
131[ 0.426182] ACPI: Added _OSI(Processor Device)
132[ 0.426279] ACPI: Added _OSI(3.0 _SCP Extensions)
133[ 0.426376] ACPI: Added _OSI(Processor Aggregator Device)
134[ 0.426606] ACPI: Added _OSI(Linux-Dell-Video)
135[ 0.426709] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
136[ 0.426821] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
137[ 0.439511] ACPI: 1 ACPI AML tables successfully acquired and loaded
138[ 0.452709] ACPI: Interpreter enabled
139[ 0.453468] ACPI: PM: (supports S0 S3 S4 S5)
140[ 0.453603] ACPI: Using IOAPIC for interrupt routing
141[ 0.454022] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
142[ 0.455266] ACPI: Enabled 2 GPEs in block 00 to 0F
143[ 0.480013] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
144[ 0.480702] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI HPX-Type3]
145[ 0.481425] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
146[ 0.483666] PCI host bridge to bus 0000:00
147[ 0.483848] pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window]
148[ 0.484096] pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window]
149[ 0.484237] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
150[ 0.484480] pci_bus 0000:00: root bus resource [mem 0x08000000-0xfebfffff window]
151[ 0.484578] pci_bus 0000:00: root bus resource [mem 0x100000000-0x17fffffff window]
152[ 0.484870] pci_bus 0000:00: root bus resource [bus 00-ff]
153[ 0.486588] pci 0000:00:00.0: [8086:1237] type 00 class 0x060000
154[ 0.492625] pci 0000:00:01.0: [8086:7000] type 00 class 0x060100
155[ 0.493621] pci 0000:00:01.1: [8086:7010] type 00 class 0x010180
156[ 0.495015] pci 0000:00:01.1: reg 0x20: [io 0xc040-0xc04f]
157[ 0.495760] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io 0x01f0-0x01f7]
158[ 0.495936] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io 0x03f6]
159[ 0.496095] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io 0x0170-0x0177]
160[ 0.496598] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io 0x0376]
161[ 0.497793] pci 0000:00:01.3: [8086:7113] type 00 class 0x068000
162[ 0.498219] pci 0000:00:01.3: quirk: [io 0x0600-0x063f] claimed by PIIX4 ACPI
163[ 0.498384] pci 0000:00:01.3: quirk: [io 0x0700-0x070f] claimed by PIIX4 SMB
164[ 0.499487] pci 0000:00:02.0: [1234:1111] type 00 class 0x030000
165[ 0.500186] pci 0000:00:02.0: reg 0x10: [mem 0xfd000000-0xfdffffff pref]
166[ 0.500569] pci 0000:00:02.0: reg 0x18: [mem 0xfebf0000-0xfebf0fff]
167[ 0.502569] pci 0000:00:02.0: reg 0x30: [mem 0xfebe0000-0xfebeffff pref]
168[ 0.508052] pci 0000:00:03.0: [8086:100e] type 00 class 0x020000
169[ 0.508590] pci 0000:00:03.0: reg 0x10: [mem 0xfebc0000-0xfebdffff]
170[ 0.509075] pci 0000:00:03.0: reg 0x14: [io 0xc000-0xc03f]
171[ 0.511015] pci 0000:00:03.0: reg 0x30: [mem 0xfeb80000-0xfebbffff pref]
172[ 0.517286] ACPI: PCI: Interrupt link LNKA configured for IRQ 10
173[ 0.518032] ACPI: PCI: Interrupt link LNKB configured for IRQ 10
174[ 0.518504] ACPI: PCI: Interrupt link LNKC configured for IRQ 11
175[ 0.518920] ACPI: PCI: Interrupt link LNKD configured for IRQ 11
176[ 0.519208] ACPI: PCI: Interrupt link LNKS configured for IRQ 9
177[ 0.521412] iommu: Default domain type: Translated
178[ 0.521589] iommu: DMA domain TLB invalidation policy: lazy mode
179[ 0.524448] pci 0000:00:02.0: vgaarb: setting as boot VGA device
180[ 0.524569] pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
181[ 0.524633] pci 0000:00:02.0: vgaarb: bridge control possible
182[ 0.524846] vgaarb: loaded
183[ 0.526151] SCSI subsystem initialized
184[ 0.528124] ACPI: bus type USB registered
185[ 0.528600] usbcore: registered new interface driver usbfs
186[ 0.528917] usbcore: registered new interface driver hub
187[ 0.529156] usbcore: registered new device driver usb
188[ 0.529593] pps_core: LinuxPPS API ver. 1 registered
189[ 0.529693] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
190[ 0.529916] PTP clock support registered
191[ 0.531428] Advanced Linux Sound Architecture Driver Initialized.
192[ 0.538313] NetLabel: Initializing
193[ 0.538413] NetLabel: domain hash size = 128
194[ 0.538513] NetLabel: protocols = UNLABELED CIPSOv4 CALIPSO
195[ 0.539300] NetLabel: unlabeled traffic allowed by default
196[ 0.540192] PCI: Using ACPI for IRQ routing
197[ 0.541336] hpet: 3 channels of 0 reserved for per-cpu timers
198[ 0.541742] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
199[ 0.541934] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
200[ 0.547124] clocksource: Switched to clocksource tsc-early
201[ 0.589778] VFS: Disk quotas dquot_6.6.0
202[ 0.590116] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
203[ 0.591999] pnp: PnP ACPI init
204[ 1.348853] pnp: PnP ACPI: found 6 devices
205[ 1.363393] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
206[ 1.364026] NET: Registered PF_INET protocol family
207[ 1.364871] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
208[ 1.369722] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear)
209[ 1.369973] TCP established hash table entries: 1024 (order: 1, 8192 bytes, linear)
210[ 1.370241] TCP bind hash table entries: 1024 (order: 2, 16384 bytes, linear)
211[ 1.370483] TCP: Hash tables configured (established 1024 bind 1024)
212[ 1.371348] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
213[ 1.371835] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
214[ 1.373053] NET: Registered PF_UNIX/PF_LOCAL protocol family
215[ 1.374701] RPC: Registered named UNIX socket transport module.
216[ 1.375153] RPC: Registered udp transport module.
217[ 1.375280] RPC: Registered tcp transport module.
218[ 1.375386] RPC: Registered tcp NFSv4.1 backchannel transport module.
219[ 1.377429] pci_bus 0000:00: resource 4 [io 0x0000-0x0cf7 window]
220[ 1.377567] pci_bus 0000:00: resource 5 [io 0x0d00-0xffff window]
221[ 1.377738] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff window]
222[ 1.377893] pci_bus 0000:00: resource 7 [mem 0x08000000-0xfebfffff window]
223[ 1.378032] pci_bus 0000:00: resource 8 [mem 0x100000000-0x17fffffff window]
224[ 1.378574] pci 0000:00:01.0: PIIX3: Enabling Passive Release
225[ 1.378817] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
226[ 1.378993] pci 0000:00:01.0: Activating ISA DMA hang workarounds
227[ 1.379296] pci 0000:00:02.0: Video device with shadowed ROM at [mem 0x000c0000-0x000dffff]
228[ 1.379537] PCI: CLS 0 bytes, default 64
229[ 1.385473] Unpacking initramfs...
230[ 1.394653] Initialise system trusted keyrings
231[ 1.395898] workingset: timestamp_bits=56 max_order=15 bucket_order=0
232[ 1.400517] Freeing initrd memory: 1896K
233[ 1.409899] NFS: Registering the id_resolver key type
234[ 1.410240] Key type id_resolver registered
235[ 1.410358] Key type id_legacy registered
236[ 1.436299] Key type asymmetric registered
237[ 1.436505] Asymmetric key parser 'x509' registered
238[ 1.436899] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
239[ 1.437334] io scheduler mq-deadline registered
240[ 1.437848] io scheduler kyber registered
241[ 1.440723] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
242[ 1.443386] ACPI: button: Power Button [PWRF]
243[ 1.445654] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
244[ 1.447264] 00:04: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
245[ 1.450740] Non-volatile memory driver v1.3
246[ 1.451106] Linux agpgart interface v0.103
247[ 1.467087] loop: module loaded
248[ 1.474468] scsi host0: ata_piix
249[ 1.476252] scsi host1: ata_piix
250[ 1.476701] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc040 irq 14
251[ 1.476882] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc048 irq 15
252[ 1.481539] libphy: Fixed MDIO Bus: probed
253[ 1.482188] e100: Intel(R) PRO/100 Network Driver
254[ 1.482313] e100: Copyright(c) 1999-2006 Intel Corporation
255[ 1.482507] e1000: Intel(R) PRO/1000 Network Driver
256[ 1.482702] e1000: Copyright (c) 1999-2006 Intel Corporation.
257[ 1.616439] ACPI: \_SB_.LNKC: Enabled at IRQ 11
258[ 1.649465] ata2.00: ATAPI: QEMU DVD-ROM, 2.5+, max UDMA/100
259[ 1.664135] scsi 1:0:0:0: CD-ROM QEMU QEMU DVD-ROM 2.5+ PQ: 0 ANSI: 5
260[ 1.693021] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
261[ 1.693338] cdrom: Uniform CD-ROM driver Revision: 3.20
262[ 1.723925] sr 1:0:0:0: Attached scsi generic sg0 type 5
263[ 1.946674] e1000 0000:00:03.0 eth0: (PCI:33MHz:32-bit) 52:54:00:12:34:56
264[ 1.947107] e1000 0000:00:03.0 eth0: Intel(R) PRO/1000 Network Connection
265[ 1.947650] e1000e: Intel(R) PRO/1000 Network Driver
266[ 1.947749] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
267[ 1.947947] sky2: driver version 1.30
268[ 1.948805] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
269[ 1.948993] ehci-pci: EHCI PCI platform driver
270[ 1.949218] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
271[ 1.949394] ohci-pci: OHCI PCI platform driver
272[ 1.949636] uhci_hcd: USB Universal Host Controller Interface driver
273[ 1.950082] usbcore: registered new interface driver usblp
274[ 1.950302] usbcore: registered new interface driver usb-storage
275[ 1.951012] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
276[ 1.954333] serio: i8042 KBD port at 0x60,0x64 irq 1
277[ 1.954634] serio: i8042 AUX port at 0x60,0x64 irq 12
278[ 1.957984] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
279[ 1.960071] rtc_cmos 00:05: RTC can wake from S4
280[ 1.964738] rtc_cmos 00:05: registered as rtc0
281[ 1.965357] rtc_cmos 00:05: alarms up to one day, y3k, 242 bytes nvram, hpet irqs
282[ 1.966676] device-mapper: ioctl: 4.45.0-ioctl (2021-03-22) initialised: dm-devel@redhat.com
283[ 1.967364] hid: raw HID events driver (C) Jiri Kosina
284[ 1.968571] usbcore: registered new interface driver usbhid
285[ 1.968750] usbhid: USB HID core driver
286[ 1.974818] Initializing XFRM netlink socket
287[ 1.975673] NET: Registered PF_INET6 protocol family
288[ 1.981212] Segment Routing with IPv6
289[ 1.981421] In-situ OAM (IOAM) with IPv6
290[ 1.982292] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
291[ 1.984278] NET: Registered PF_PACKET protocol family
292[ 1.984857] Key type dns_resolver registered
293[ 1.985989] IPI shorthand broadcast: enabled
294[ 1.986261] sched_clock: Marking stable (1999028700, -13430834)->(1985937339, -339473)
295[ 1.987965] registered taskstats version 1
296[ 1.988095] Loading compiled-in X.509 certificates
297[ 1.991283] PM: Magic number: 1:335:305
298[ 1.991523] tty tty34: hash matches
299[ 1.991951] printk: console [netcon0] enabled
300[ 1.992067] netconsole: network logging started
301[ 1.994549] cfg80211: Loading compiled-in X.509 certificates for regulatory database
302[ 2.004972] kworker/u2:2 (64) used greatest stack depth: 14856 bytes left
303[ 2.012521] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
304[ 2.013924] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
305[ 2.014318] cfg80211: failed to load regulatory.db
306[ 2.016106] ALSA device list:
307[ 2.016329] No soundcards found.
308[ 2.053176] Freeing unused kernel image (initmem) memory: 1368K
309[ 2.056095] Write protecting the kernel read-only data: 20480k
310[ 2.058248] Freeing unused kernel image (text/rodata gap) memory: 2032K
311[ 2.058811] Freeing unused kernel image (rodata/data gap) memory: 500K
312[ 2.059164] Run /init as init process
313Hello from Golang
314[ 2.386879] tsc: Refined TSC clocksource calibration: 3192.032 MHz
315[ 2.387114] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x2e02e31fa14, max_idle_ns: 440795264947 ns
316[ 2.387380] clocksource: Switched to clocksource tsc
317[ 2.587895] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3
318Hello from Golang
319Hello from Golang
320Hello from Golang
diff --git a/assets/pid1/unikernels.png b/assets/pid1/unikernels.png
new file mode 100644
index 0000000..16026ed
--- /dev/null
+++ b/assets/pid1/unikernels.png
Binary files differ
diff --git a/assets/pid1/unikernels.svg b/assets/pid1/unikernels.svg
new file mode 100644
index 0000000..77d1547
--- /dev/null
+++ b/assets/pid1/unikernels.svg
@@ -0,0 +1,578 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
4<svg
5 width="210mm"
6 height="297mm"
7 viewBox="0 0 210 297"
8 version="1.1"
9 id="svg5"
10 inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
11 sodipodi:docname="unikernels.svg"
12 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
13 inkscape:export-xdpi="127.98862"
14 inkscape:export-ydpi="127.98862"
15 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
16 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
17 xmlns="http://www.w3.org/2000/svg"
18 xmlns:svg="http://www.w3.org/2000/svg">
19 <sodipodi:namedview
20 id="namedview7"
21 pagecolor="#ffffff"
22 bordercolor="#666666"
23 borderopacity="1.0"
24 inkscape:pageshadow="2"
25 inkscape:pageopacity="0.0"
26 inkscape:pagecheckerboard="0"
27 inkscape:document-units="mm"
28 showgrid="false"
29 inkscape:zoom="1.4948513"
30 inkscape:cx="431.48104"
31 inkscape:cy="473.6257"
32 inkscape:window-width="1887"
33 inkscape:window-height="913"
34 inkscape:window-x="1859"
35 inkscape:window-y="48"
36 inkscape:window-maximized="0"
37 inkscape:current-layer="layer1"
38 showguides="true"
39 inkscape:guide-bbox="true" />
40 <defs
41 id="defs2" />
42 <g
43 inkscape:label="Layer 1"
44 inkscape:groupmode="layer"
45 id="layer1">
46 <g
47 id="g98495"
48 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
49 inkscape:export-xdpi="127.98862"
50 inkscape:export-ydpi="127.98862">
51 <rect
52 style="fill:#ececec;stroke:none;stroke-width:0.318966;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
53 id="rect18248"
54 width="65.511665"
55 height="75.571449"
56 x="5.6951494"
57 y="75.506912"
58 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
59 inkscape:export-xdpi="127.98862"
60 inkscape:export-ydpi="127.98862" />
61 <rect
62 style="fill:#ececec;stroke:none;stroke-width:0.318966;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
63 id="rect18418"
64 width="65.511665"
65 height="75.571449"
66 x="72.166878"
67 y="75.506912"
68 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
69 inkscape:export-xdpi="127.98862"
70 inkscape:export-ydpi="127.98862" />
71 <rect
72 style="fill:#ececec;stroke:none;stroke-width:0.318966;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
73 id="rect18420"
74 width="65.511665"
75 height="75.571449"
76 x="138.63863"
77 y="75.506912"
78 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
79 inkscape:export-xdpi="127.98862"
80 inkscape:export-ydpi="127.98862" />
81 <text
82 xml:space="preserve"
83 style="font-style:normal;font-variant:normal;font-weight:900;font-stretch:normal;font-size:2.82222px;line-height:1.25;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Heavy';fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
84 x="25.735832"
85 y="144.60236"
86 id="text18439"
87 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
88 inkscape:export-xdpi="127.98862"
89 inkscape:export-ydpi="127.98862"><tspan
90 sodipodi:role="line"
91 id="tspan18437"
92 style="font-style:normal;font-variant:normal;font-weight:800;font-stretch:normal;font-size:2.82222px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Ultra-Bold';fill:#000000;stroke-width:0.264583"
93 x="25.735832"
94 y="144.60236">VIRTUAL MACHINE</tspan></text>
95 <g
96 id="g50691"
97 transform="translate(0,-101.60001)"
98 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
99 inkscape:export-xdpi="127.98862"
100 inkscape:export-ydpi="127.98862">
101 <rect
102 style="fill:#f9f9f9;stroke:none;stroke-width:0.429153;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
103 id="rect38097-3"
104 width="50.57568"
105 height="8.4333"
106 x="13.294504"
107 y="213.63496"
108 ry="1.5" />
109 <text
110 xml:space="preserve"
111 style="font-style:normal;font-variant:normal;font-weight:900;font-stretch:normal;font-size:2.46944px;line-height:1.25;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Heavy';fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
112 x="24.263063"
113 y="218.54855"
114 id="text32261"><tspan
115 sodipodi:role="line"
116 id="tspan32259"
117 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.46944px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';fill:#4d4d4d;stroke-width:0.264583"
118 x="24.263063"
119 y="218.54855">HOST OS / HYPERVISOR</tspan></text>
120 </g>
121 <rect
122 style="fill:#f9f9f9;stroke:none;stroke-width:0.499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
123 id="rect38097"
124 width="22.000685"
125 height="26.315866"
126 x="13.294504"
127 y="184.14406"
128 ry="1.5"
129 transform="translate(0,-102.12917)" />
130 <text
131 xml:space="preserve"
132 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
133 x="24.336025"
134 y="204.21999"
135 id="text38435"
136 transform="translate(0,-102.12917)"><tspan
137 sodipodi:role="line"
138 id="tspan38433"
139 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
140 x="24.336025"
141 y="204.48907">VIRTUAL</tspan><tspan
142 sodipodi:role="line"
143 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
144 x="24.336025"
145 y="206.28824"
146 id="tspan38945">MACHINE</tspan></text>
147 <text
148 xml:space="preserve"
149 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
150 x="24.336025"
151 y="198.19913"
152 id="text41165"
153 transform="translate(0,-102.12917)"><tspan
154 sodipodi:role="line"
155 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
156 x="24.336025"
157 y="198.19913"
158 id="tspan41163">GUEST OS</tspan></text>
159 <text
160 xml:space="preserve"
161 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
162 x="24.336025"
163 y="189.40337"
164 id="text42587"
165 transform="translate(0,-102.12917)"><tspan
166 sodipodi:role="line"
167 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
168 x="24.336025"
169 y="189.67245"
170 id="tspan42585">TARGET</tspan><tspan
171 sodipodi:role="line"
172 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
173 x="24.336025"
174 y="191.47162"
175 id="tspan42611">SOFTWARE</tspan></text>
176 <g
177 id="g50696"
178 transform="translate(0,-99.483339)"
179 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
180 inkscape:export-xdpi="127.98862"
181 inkscape:export-ydpi="127.98862">
182 <rect
183 style="fill:#f9f9f9;stroke:none;stroke-width:0.429153;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
184 id="rect48544"
185 width="50.57568"
186 height="8.4333"
187 x="13.294504"
188 y="223.15991"
189 ry="1.5" />
190 <text
191 xml:space="preserve"
192 style="font-style:normal;font-variant:normal;font-weight:900;font-stretch:normal;font-size:2.46944px;line-height:1.25;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Heavy';fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
193 x="31.535746"
194 y="228.24654"
195 id="text47169"><tspan
196 sodipodi:role="line"
197 id="tspan47167"
198 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.46944px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';fill:#4d4d4d;stroke-width:0.264583"
199 x="31.535746"
200 y="228.24654">HARDWARE</tspan></text>
201 </g>
202 <g
203 id="g48202"
204 transform="translate(28.574999,-102.12917)"
205 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
206 inkscape:export-xdpi="127.98862"
207 inkscape:export-ydpi="127.98862">
208 <rect
209 style="fill:#f9f9f9;stroke:none;stroke-width:0.499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
210 id="rect48184"
211 width="22.000685"
212 height="26.315866"
213 x="13.294504"
214 y="184.14406"
215 ry="1.5" />
216 <text
217 xml:space="preserve"
218 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
219 x="24.336025"
220 y="204.21999"
221 id="text48190"><tspan
222 sodipodi:role="line"
223 id="tspan48186"
224 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
225 x="24.336025"
226 y="204.48907">VIRTUAL</tspan><tspan
227 sodipodi:role="line"
228 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
229 x="24.336025"
230 y="206.28824"
231 id="tspan48188">MACHINE</tspan></text>
232 <text
233 xml:space="preserve"
234 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
235 x="24.336025"
236 y="198.19913"
237 id="text48194"><tspan
238 sodipodi:role="line"
239 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
240 x="24.336025"
241 y="198.19913"
242 id="tspan48192">GUEST OS</tspan></text>
243 <text
244 xml:space="preserve"
245 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
246 x="24.336025"
247 y="189.40337"
248 id="text48200"><tspan
249 sodipodi:role="line"
250 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
251 x="24.336025"
252 y="189.67245"
253 id="tspan48196">TARGET</tspan><tspan
254 sodipodi:role="line"
255 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
256 x="24.336025"
257 y="191.47162"
258 id="tspan48198">SOFTWARE</tspan></text>
259 </g>
260 <text
261 xml:space="preserve"
262 style="font-style:normal;font-variant:normal;font-weight:900;font-stretch:normal;font-size:2.82222px;line-height:1.25;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Heavy';fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
263 x="95.948242"
264 y="144.60236"
265 id="text51110"
266 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
267 inkscape:export-xdpi="127.98862"
268 inkscape:export-ydpi="127.98862"><tspan
269 sodipodi:role="line"
270 id="tspan51108"
271 style="font-style:normal;font-variant:normal;font-weight:800;font-stretch:normal;font-size:2.82222px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Ultra-Bold';fill:#000000;stroke-width:0.264583"
272 x="95.948242"
273 y="144.60236">CONTAINERS</tspan></text>
274 <g
275 id="g51118"
276 transform="translate(66.675002,-101.60001)"
277 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
278 inkscape:export-xdpi="127.98862"
279 inkscape:export-ydpi="127.98862">
280 <rect
281 style="fill:#f9f9f9;stroke:none;stroke-width:0.429153;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
282 id="rect51112"
283 width="50.57568"
284 height="8.4333"
285 x="13.294504"
286 y="213.63496"
287 ry="1.5" />
288 <text
289 xml:space="preserve"
290 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.46944px;line-height:1.25;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
291 x="33.144272"
292 y="218.54855"
293 id="text51116"><tspan
294 sodipodi:role="line"
295 id="tspan51114"
296 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.46944px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';fill:#4d4d4d;stroke-width:0.264583"
297 x="33.144272"
298 y="218.54855">HOST OS</tspan></text>
299 </g>
300 <g
301 id="g51138"
302 transform="translate(66.675002,-102.12917)"
303 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
304 inkscape:export-xdpi="127.98862"
305 inkscape:export-ydpi="127.98862">
306 <rect
307 style="fill:#f9f9f9;stroke:none;stroke-width:0.499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
308 id="rect51120"
309 width="22.000685"
310 height="26.315866"
311 x="13.294504"
312 y="184.14406"
313 ry="1.5" />
314 <text
315 xml:space="preserve"
316 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
317 x="24.336025"
318 y="206.33662"
319 id="text51126"><tspan
320 sodipodi:role="line"
321 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
322 x="24.336025"
323 y="206.33662"
324 id="tspan51124">CONTAINER</tspan></text>
325 <text
326 xml:space="preserve"
327 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
328 x="24.336025"
329 y="198.19913"
330 id="text51130"><tspan
331 sodipodi:role="line"
332 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
333 x="24.336025"
334 y="198.46822"
335 id="tspan51128">PROGRAMS &amp;</tspan><tspan
336 sodipodi:role="line"
337 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
338 x="24.336025"
339 y="200.26738"
340 id="tspan56912">LIBRARIES</tspan></text>
341 <text
342 xml:space="preserve"
343 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
344 x="24.336025"
345 y="189.40337"
346 id="text51136"><tspan
347 sodipodi:role="line"
348 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
349 x="24.336025"
350 y="189.67245"
351 id="tspan51132">TARGET</tspan><tspan
352 sodipodi:role="line"
353 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
354 x="24.336025"
355 y="191.47162"
356 id="tspan51134">SOFTWARE</tspan></text>
357 </g>
358 <g
359 id="g51146"
360 transform="translate(66.675002,-99.483339)"
361 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
362 inkscape:export-xdpi="127.98862"
363 inkscape:export-ydpi="127.98862">
364 <rect
365 style="fill:#f9f9f9;stroke:none;stroke-width:0.429153;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
366 id="rect51140"
367 width="50.57568"
368 height="8.4333"
369 x="13.294504"
370 y="223.15991"
371 ry="1.5" />
372 <text
373 xml:space="preserve"
374 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.46944px;line-height:1.25;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
375 x="31.535746"
376 y="228.24654"
377 id="text51144"><tspan
378 sodipodi:role="line"
379 id="tspan51142"
380 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.46944px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';fill:#4d4d4d;stroke-width:0.264583"
381 x="31.535746"
382 y="228.24654">HARDWARE</tspan></text>
383 </g>
384 <g
385 id="g51166"
386 transform="translate(95.250005,-102.12917)"
387 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
388 inkscape:export-xdpi="127.98862"
389 inkscape:export-ydpi="127.98862">
390 <rect
391 style="fill:#f9f9f9;stroke:none;stroke-width:0.499999;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
392 id="rect51148"
393 width="22.000685"
394 height="26.315866"
395 x="13.294504"
396 y="184.14406"
397 ry="1.5" />
398 <text
399 xml:space="preserve"
400 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
401 x="24.336025"
402 y="206.33662"
403 id="text51154"><tspan
404 sodipodi:role="line"
405 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
406 x="24.336025"
407 y="206.33662"
408 id="tspan51152">CONTAINER</tspan></text>
409 <text
410 xml:space="preserve"
411 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
412 x="24.336025"
413 y="198.19913"
414 id="text51158"><tspan
415 sodipodi:role="line"
416 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
417 x="24.336025"
418 y="198.46822"
419 id="tspan51156">PROGRAMS &amp;</tspan><tspan
420 sodipodi:role="line"
421 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
422 x="24.336025"
423 y="200.26738"
424 id="tspan64780">LIBRARIES</tspan></text>
425 <text
426 xml:space="preserve"
427 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
428 x="24.336025"
429 y="189.40337"
430 id="text51164"><tspan
431 sodipodi:role="line"
432 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
433 x="24.336025"
434 y="189.67245"
435 id="tspan51160">TARGET</tspan><tspan
436 sodipodi:role="line"
437 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
438 x="24.336025"
439 y="191.47162"
440 id="tspan51162">SOFTWARE</tspan></text>
441 </g>
442 <text
443 xml:space="preserve"
444 style="font-style:normal;font-variant:normal;font-weight:900;font-stretch:normal;font-size:2.82222px;line-height:1.25;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Heavy';fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
445 x="162.66873"
446 y="144.60236"
447 id="text74212"
448 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
449 inkscape:export-xdpi="127.98862"
450 inkscape:export-ydpi="127.98862"><tspan
451 sodipodi:role="line"
452 id="tspan74210"
453 style="font-style:normal;font-variant:normal;font-weight:800;font-stretch:normal;font-size:2.82222px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Ultra-Bold';fill:#000000;stroke-width:0.264583"
454 x="162.66873"
455 y="144.60236">UNIKERNELS</tspan></text>
456 <g
457 id="g74220"
458 transform="translate(132.82087,-101.60001)"
459 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
460 inkscape:export-xdpi="127.98862"
461 inkscape:export-ydpi="127.98862">
462 <rect
463 style="fill:#f9f9f9;stroke:none;stroke-width:0.429153;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
464 id="rect74214"
465 width="50.57568"
466 height="8.4333"
467 x="13.294504"
468 y="213.63496"
469 ry="1.5" />
470 <text
471 xml:space="preserve"
472 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.46944px;line-height:1.25;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
473 x="30.66217"
474 y="218.54855"
475 id="text74218"><tspan
476 sodipodi:role="line"
477 id="tspan74216"
478 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.46944px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';fill:#4d4d4d;stroke-width:0.264583"
479 x="30.66217"
480 y="218.54855">HYPERVISOR</tspan></text>
481 </g>
482 <g
483 id="g74240"
484 transform="translate(132.82087,-102.12917)"
485 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
486 inkscape:export-xdpi="127.98862"
487 inkscape:export-ydpi="127.98862">
488 <rect
489 style="fill:#f9f9f9;stroke:none;stroke-width:0.377825;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
490 id="rect74222"
491 width="22.000685"
492 height="15.026576"
493 x="13.294504"
494 y="195.43335"
495 ry="0.85651237" />
496 <text
497 xml:space="preserve"
498 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
499 x="24.336025"
500 y="202.66647"
501 id="text74232"><tspan
502 sodipodi:role="line"
503 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
504 x="24.336025"
505 y="202.93556"
506 id="tspan74228">UNIKERNEL &amp;</tspan><tspan
507 sodipodi:role="line"
508 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
509 x="24.336025"
510 y="204.73473"
511 id="tspan74230">APPLICATION</tspan></text>
512 </g>
513 <g
514 id="g74248"
515 transform="translate(132.82087,-99.483339)"
516 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
517 inkscape:export-xdpi="127.98862"
518 inkscape:export-ydpi="127.98862">
519 <rect
520 style="fill:#f9f9f9;stroke:none;stroke-width:0.429153;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
521 id="rect74242"
522 width="50.57568"
523 height="8.4333"
524 x="13.294504"
525 y="223.15991"
526 ry="1.5" />
527 <text
528 xml:space="preserve"
529 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.46944px;line-height:1.25;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
530 x="31.535746"
531 y="228.24654"
532 id="text74246"><tspan
533 sodipodi:role="line"
534 id="tspan74244"
535 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.46944px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';fill:#4d4d4d;stroke-width:0.264583"
536 x="31.535746"
537 y="228.24654">HARDWARE</tspan></text>
538 </g>
539 <g
540 id="g85408"
541 transform="translate(161.34783,-102.25244)"
542 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
543 inkscape:export-xdpi="127.98862"
544 inkscape:export-ydpi="127.98862">
545 <rect
546 style="fill:#f9f9f9;stroke:none;stroke-width:0.377825;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
547 id="rect85400"
548 width="22.000685"
549 height="15.026576"
550 x="13.294504"
551 y="195.43335"
552 ry="0.85651237" />
553 <text
554 xml:space="preserve"
555 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;line-height:0.85;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#4d4d4d;fill-opacity:1;stroke:none;stroke-width:0.264583"
556 x="24.336025"
557 y="202.66647"
558 id="text85406"><tspan
559 sodipodi:role="line"
560 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
561 x="24.336025"
562 y="202.93556"
563 id="tspan85402">UNIKERNEL &amp;</tspan><tspan
564 sodipodi:role="line"
565 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:2.11667px;font-family:'SF Pro Display';-inkscape-font-specification:'SF Pro Display Bold';text-align:center;text-anchor:middle;fill:#4d4d4d;stroke-width:0.264583"
566 x="24.336025"
567 y="204.73473"
568 id="tspan85404">APPLICATION</tspan></text>
569 </g>
570 </g>
571 <g
572 id="g48182"
573 transform="translate(0,-102.12917)"
574 inkscape:export-filename="/home/m/Vault/projects/mitjafelicijan.com/assets/pid1/unikernels.png"
575 inkscape:export-xdpi="127.98862"
576 inkscape:export-ydpi="127.98862" />
577 </g>
578</svg>
diff --git a/posts/2021-12-25-running-golang-application-as-pid1.md b/posts/2021-12-25-running-golang-application-as-pid1.md
new file mode 100644
index 0000000..1eef97b
--- /dev/null
+++ b/posts/2021-12-25-running-golang-application-as-pid1.md
@@ -0,0 +1,229 @@
1---
2Title: Running Golang application as PID 1 with Linux kernel
3Description: Running Golang application as PID 1 with Linux kernel
4Slug: running-golang-application-as-pid1
5Listing: true
6Created: 2021-12-25
7Tags: []
8---
9
10
11
12I have been reading a lot about [unikernernels](https://en.wikipedia.org/wiki/Unikernel) lately and found them very intriguing. When you push away all the marketing speak and look at the idea, it makes a lot of sense.
13
14> A unikernel is a specialized, single address space machine image constructed by using library operating systems. ([Wikipedia](https://en.wikipedia.org/wiki/Unikernel))
15
16I really like the explanation from the article [Unikernels: Rise of the Virtual Library Operating System](https://queue.acm.org/detail.cfm?id=2566628). Really worth a read.
17
18If we compare a normal operating system to a unikernel side by side, they would look something like this.
19
20![Virtual machines vs Containers vs Unikernels](/assets/pid1/unikernels.png)
21
22From this image, we can see how the complexity significantly decreases with the use of Unikernels. This comes with a price, of course. Unikernels are hard to get running and require a lot of work since you don't have an actual proper kernel running in the background providing network access and drivers etc.
23
24So as a half step to make the stack simpler, I started looking into using Linux kernel as a base and going from there. I came across this [Youtube video talking about Building the Simplest Possible Linux System](https://www.youtube.com/watch?v=Sk9TatW9ino) by [Rob Landley](https://landley.net) and apart from statically compiling the application to be run as PID1 there was really no other obstacles.
25
26## What is PID 1?
27
28PID 1 is the first process that Linux kernel starts after the boot process. It also has a couple of unique properties that are unique to it.
29
30- When the process with PID 1 dies for any reason, all other processes are killed with KILL signal.
31- When any process having children dies for any reason, its children are re-parented to process with PID 1.
32- Many signals which have default action of Term do not have one for PID 1.
33- When the process with PID 1 dies for any reason, kernel panics, which result in system crash.
34
35PID 1 is considered as an Init application which takes care of running other and handling services like:
36
37- sshd,
38- nginx,
39- pulseaudio,
40- etc.
41
42If you are on a Linux machine, you can check what your process is with PID 1 by running the following.
43
44```sh
45$ cat /proc/1/status
46Name: systemd
47Umask: 0000
48State: S (sleeping)
49Tgid: 1
50Ngid: 0
51Pid: 1
52PPid: 0
53...
54```
55
56As we can see on my machine the process with id of 1 is [systemd](https://systemd.io/) which is a software suite that provides an array of system components for Linux operating systems. If you look closely you can also see that the `PPid` (process id of the parent process) is `0` which additionally confirms that this process doesn't have a parent.
57
58## So why even run application as PID 1 instead of just using a container?
59
60Containers are wonderful, but they come with a lot of baggage. And because they are in their nature layered, the images require quite a lot of space and also a lot of additional software to handle them. They are not as lightweight as they seem, and many popular images require 500 MB plus disk space.
61
62The idea of running this as PID 1 would result in a significantly smaller footprint, as we will see later in the post.
63
64> You could run a simple init system inside Docker container described more in this article [Docker and the PID 1 zombie reaping problem](https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/).
65
66## The plan
67
681. Compile Linux kernel with the default definitions.
692. Prepare a Hello World application in Golang that is statically compiled.
703. Run it with [QEMU](https://www.qemu.org/) and providing Golang application as init application / PID 1.
71
72For the sake of simplicity we will not be cross-compiling any of it and just use the 64bit version.
73
74## Compiling Linux kernel
75
76```sh
77wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.7.tar.xz
78tar xf linux-5.15.7.tar.xz
79
80cd linux-5.15.7
81
82make clean
83
84# read more about this https://stackoverflow.com/a/41886394
85make defconfig
86
87time make -j `nproc`
88
89cd ..
90```
91
92At this point we have kernel image that is located in `arch/x86_64/boot/bzImage`. We will use this this in QEMU later.
93
94To make our lives a bit easier lets move the kernel image to another place. Lets create a folder `bin/` in the root of our project with `mkdir -p bin`.
95
96
97At this point we can copy `bzImage` to `bin/` folder with `cp linux-5.15.7/arch/x86_64/boot/bzImage bin/bzImage`.
98
99The folder structure of this experiment should look like this.
100
101```
102pid1/
103 bin/
104 bzImage
105 linux-5.15.7/
106 linux-5.15.7.tar.xz
107```
108
109## Preparing PID 1 application in Golang
110
111This step is relatively easy. The only thing we must have in mind that we will need to compile the binary as a static one.
112
113Let's create `init.go` file in the root of the project.
114
115```go
116package main
117
118import (
119 "fmt"
120 "time"
121)
122
123func main() {
124 for {
125 fmt.Println("Hello from Golang")
126 time.Sleep(1 * time.Second)
127 }
128}
129```
130
131If you notice, we have a forever loop in the main, with a simple sleep of 1 second to not overwhelm the CPU.
132
133There are two ways of compiling Golang application. Statically and dynamically.
134
135To statically compile the binary, use the following command.
136
137```sh
138go build -ldflags="-extldflags=-static" init.go
139```
140
141We can also check if the binary is statically compiled with:
142
143```sh
144$ file init
145init: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=Ypu8Zw_4NBxm1Yxg2OYO/H5x721rQ9uTPiDVh-VqP/vZN7kXfGG1zhX_qdHMgH/9vBfmK81tFrygfOXDEOo, not stripped
146
147$ ldd init
148not a dynamic executable
149```
150
151At this point, we need to create [initramfs](https://www.linuxfromscratch.org/blfs/view/svn/postlfs/initramfs.html) (abbreviated from "initial RAM file system", is the successor of initrd. It is a cpio archive of the initial file system that gets loaded into memory during the Linux startup process).
152
153```sh
154echo init | cpio -o --format=newc > initramfs
155mv initramfs bin/initramfs
156```
157
158The projects at this stage should look like this.
159
160```
161pid1/
162 bin/
163 bzImage
164 initramfs
165 linux-5.15.7/
166 linux-5.15.7.tar.xz
167 init.go
168```
169
170## Running all of it with QEMU
171
172[QEMU](https://www.qemu.org/) is a free and open-source hypervisor. It emulates the machine's processor through dynamic binary translation and provides a set of different hardware and device models for the machine, enabling it to run a variety of guest operating systems.
173
174```sh
175qemu-system-x86_64 -serial stdio -kernel bin/bzImage -initrd bin/initramfs -append "console=ttyS0" -m 128
176```
177
178```sh
179$ qemu-system-x86_64 -serial stdio -kernel bin/bzImage -initrd bin/initramfs -append "console=ttyS0" -m 128
180[ 0.000000] Linux version 5.15.7 (m@khan) (gcc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7), GNU ld version 2.37-10.fc35) #7 SMP Mon Dec 13 10:23:25 CET 2021
181[ 0.000000] Command line: console=ttyS0
182[ 0.000000] x86/fpu: x87 FPU will use FXSAVE
183[ 0.000000] signal: max sigframe size: 1440
184[ 0.000000] BIOS-provided physical RAM map:
185[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
186[ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
187[ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
188[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000007fdffff] usable
189[ 0.000000] BIOS-e820: [mem 0x0000000007fe0000-0x0000000007ffffff] reserved
190[ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
191[ 0.000000] NX (Execute Disable) protection: active
192[ 0.000000] SMBIOS 2.8 present.
193[ 0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-6.fc35 04/01/2014
194[ 0.000000] tsc: Fast TSC calibration failed
195...
196[ 2.016106] ALSA device list:
197[ 2.016329] No soundcards found.
198[ 2.053176] Freeing unused kernel image (initmem) memory: 1368K
199[ 2.056095] Write protecting the kernel read-only data: 20480k
200[ 2.058248] Freeing unused kernel image (text/rodata gap) memory: 2032K
201[ 2.058811] Freeing unused kernel image (rodata/data gap) memory: 500K
202[ 2.059164] Run /init as init process
203Hello from Golang
204[ 2.386879] tsc: Refined TSC clocksource calibration: 3192.032 MHz
205[ 2.387114] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x2e02e31fa14, max_idle_ns: 440795264947 ns
206[ 2.387380] clocksource: Switched to clocksource tsc
207[ 2.587895] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3
208Hello from Golang
209Hello from Golang
210Hello from Golang
211```
212
213The whole [log file here](/assets/pid1/qemu.log).
214
215## Size comparison
216
217The cool thing about this approach is that the Linux kernel and the application together only take around 12 MB, which is impressive as hell. And we need to also know that the size of bzImage (Linux kernel) could be greatly decreased by going into `make menuconfig` and removing a ton of features from the kernel, making the size even smaller. I managed to get kernel size down to 2 MB and still working properly.
218
219```sh
220total 12M
221-rw-r--r--. 1 m m 9.3M Dec 13 10:24 bzImage
222-rw-r--r--. 1 m m 1.9M Dec 27 01:19 initramfs
223```
224
225## Is running applications as PID 1 even worth it?
226
227Well, the answer to this is not as simple as one would think. Sometimes it is and sometimes it's not. For embedded systems and very specialized applications it is worth for sure. But in normal uses, I don't think so. It was an interesting exercise in compiling kernels and looking at the guts of the Linux kernel, but sticking to containers for most of the things is a better option in my opinion.
228
229An interesting experiment would be creating an image that supports networking and could be deployed to AWS as an EC2 instance and observing how it fares. But in that case, we would need to write some sort of supervisor that would run on a separate EC2 that would check if other EC2 instances are running properly. Remember that if your application fails, kernel panics and the whole machine is inoperable in this case.