# NebOS top-level build. # # Source tree: # boot/ real-mode boot sector, MBR, VESA stage, UEFI loader (boot/efi) # kernel/ the 32-bit kernel (kernel.ld, drivers, services) # common/ freestanding code linked into both the kernel and userland # include/ ABI headers shared by boot, kernel, userland and host tools # user/apps// one directory per ring-3 program (ucmd_.c + its modules) # user/lib// ring-3 libraries (libc, ngui, ufont, img, tls, uhttp, ...) # tools/ host-side tools (mkpack, mkrootfs, kexec_send, ...) # host/ Linux SDL3 browser harness # # Intermediate objects go to build/ (mirroring the source paths). The images # and the artifacts the dev workflow uses (kernel.elf, kernel.bin, floppy.img, # usb.img, usb-efi.img, BOOTX64.EFI, cmds.pack, browser.elf, ...) stay at the # top level, so every make target and command line works as before. CC = gcc AS = as LD = ld OBJCOPY = objcopy B = build # -march=i586: first-gen Pentium (P5); avoids CMOV etc. (P6+) CFLAGS = -ffreestanding -fno-pie -m32 -march=i586 -nostdlib -fno-stack-protector \ -fno-asynchronous-unwind-tables -mno-sse -mno-sse2 -mno-mmx \ -Wall -Wextra -O2 -c # Ring-3 objects are compiled with function sections so the browser link can # drop code it never reaches; the legacy rootfs pack is close to its cap. SECTION_CFLAGS = -ffunction-sections -fdata-sections # Header dependencies are generated by the compiler (build/**/*.d). DEPFLAGS = -MMD -MP ASFLAGS = --32 # NOWM=1 builds a diagnostic kernel that boots to the console without the # window manager (make nowm). NOWM ?= 0 ifeq ($(NOWM),1) CFLAGS += -DNOWM endif # Include paths. The kernel sees only its own headers plus the shared ABI and # common code; ring-3 code sees the user libraries. Quoted includes of a # file's own directory need no -I (e.g. an app's private headers). USER_LIB_DIRS = $(sort $(dir $(wildcard user/lib/*/))) USER_LIB_DIRS := $(filter-out user/lib/libc/,$(USER_LIB_DIRS)) KERNEL_INC = -Iinclude -Icommon -Ikernel USER_INC = -Iinclude -Icommon -Iuser $(patsubst %/,-I%,$(USER_LIB_DIRS)) LIBC_INC = -Iuser/lib/libc/include # QuickJS (third_party/quickjs, see its VENDOR file) is the browser's # JavaScript engine. -nostdinc keeps host headers from leaking into the # freestanding build; __nebos__ selects the local patches. QJS_DIR = third_party/quickjs QJS_CFLAGS = $(CFLAGS) -O1 $(SECTION_CFLAGS) -nostdinc $(LIBC_INC) \ -I$(QJS_DIR) -fno-builtin -w -D__nebos__ -U__linux__ \ -U__gnu_linux__ -U__unix__ -U__GLIBC__ -DNDEBUG \ -DCONFIG_VERSION='"2026-06-04"' QJS_OBJS = $(addprefix $(B)/$(QJS_DIR)/,quickjs.o cutils.o dtoa.o \ libregexp.o libunicode.o) # UEFI loader: a PE32+ x86-64 EFI application built with the mingw toolchain. # The kernel itself stays 32-bit; the loader leaves long mode before jumping. EFI_CC ?= x86_64-w64-mingw32-gcc EFI_AS ?= x86_64-w64-mingw32-as EFI_CFLAGS = -ffreestanding -fno-stack-protector -mno-red-zone -fno-builtin \ -fno-asynchronous-unwind-tables -fno-unwind-tables -O2 \ -Wall -Wextra -Iinclude -Ikernel -Iboot/efi -I$(B)/boot/efi EFI_LDFLAGS = -nostdlib -Wl,--subsystem,10 -Wl,-e,efi_main \ -Wl,--image-base,0x0 -Wl,--dynamicbase \ -Wl,--enable-reloc-section -Wl,--no-insert-timestamp .PHONY: all clean run run-smp run-floppy run-usb run-uhci run-ehci run-ehci-asix run-xhci run-xhci-asix run-net run-rndis run-e1000 run-ahci run-amd test-amd test-usb test-install run-serial floppy usb uefi run-uefi test-uefi flash dev net-dev net-install cmds-dev net-cmds browser-dev gallery-dev compat-serve netmon monitor test-crypto test-wpa test-ccmp test-images test-images-asan test-libc test-js test-font test-font-asan test-svg test-touchpad test-chat test-chat-e2e test-wifi-store test-cursors fonts kernel-dev kernel-net-dev rootfs nowm all: floppy.img usb.img final.bin root.img image.bin # ---- Generic compile rules ------------------------------------------------- # # Per-object variations are target-specific variables on the .o: # OPT optimisation override appended after CFLAGS' -O2 (-Os, -Oz) # XFLAGS extra flags (function sections, libc headers, -fwrapv, ...) $(B)/kernel/%.o: kernel/%.c @mkdir -p $(@D) $(CC) $(CFLAGS) $(OPT) $(XFLAGS) $(KERNEL_INC) $(DEPFLAGS) -o $@ $< $(B)/common/%.o: common/%.c @mkdir -p $(@D) $(CC) $(CFLAGS) $(SECTION_CFLAGS) -Icommon $(DEPFLAGS) -o $@ $< # Ring-3 C: by default the libc headers are visible (the old ucmd_%.o rule); # objects that were always built freestanding clear XFLAGS below. $(B)/user/%.o: XFLAGS = $(LIBC_INC) $(B)/user/%.o: user/%.c @mkdir -p $(@D) $(CC) $(CFLAGS) $(OPT) $(XFLAGS) $(USER_INC) $(DEPFLAGS) -o $@ $< $(B)/%.o: %.S @mkdir -p $(@D) $(AS) $(ASFLAGS) -I$(/dev/null printf '\x55\xaa' >> $@ rm -f $@.tmp # Byte offsets inside boot.bin (see boot.S). Keep decimal: dd's seek= does not # parse 0x… literals (it silently treats them as 0) and the error is hidden by # the 2>/dev/null below. # 62 = kernel_sectors field (0x3E) # 64 = kernel_lba field (0x40, word; LBA 64 fits in the low byte) # 66 = pack_lba field (0x42, dword; rootfs image LBA) KERNEL_SECTORS_OFFSET = 62 BOOT_SECTOR_START_OFFSET = 64 PACK_LBA_OFFSET = 66 # USB rootfs partition (type 0x7F) and UEFI ESP (type 0xEF). Partition 1 # has room for a 512 KB kernel; the rootfs starts after it at LBA 1088. # The header and the 242 KB gzip pack are still inside the first 1.44 MB. ROOTFS_LBA = 1088 ROOTFS_SECTORS = 16384 ESP_LBA = 18432 # Patch a little-endian 16/32-bit value into a boot-sector copy. Usage: # $(call patch16,file,offset,value) # (shell snippets are inlined below because make functions cannot easily # expand `$$(...)` arithmetic; the helpers keep the rules readable.) patch32 = printf "$$(printf '\\x%02x\\x%02x\\x%02x\\x%02x' \ $$(( ( ($(2)) >> 0) & 0xFF )) $$(( ( ($(2)) >> 8) & 0xFF )) \ $$(( ( ($(2)) >> 16) & 0xFF )) $$(( ( ($(2)) >> 24) & 0xFF )))" | \ dd of=$(1) bs=1 seek=$(3) conv=notrunc 2>/dev/null patch16 = printf "$$(printf '\\x%02x\\x%02x' \ $$(( ( ($(2)) >> 0) & 0xFF )) $$(( ( ($(2)) >> 8) & 0xFF )))" | \ dd of=$(1) bs=1 seek=$(3) conv=notrunc 2>/dev/null floppy.img: boot.bin kernel.bin rootfs.bin SECTORS=$$(( ($$(stat -c%s kernel.bin) + 511) / 512 )); \ cp boot.bin $@.boot.tmp; \ $(call patch16,$@.boot.tmp,$$SECTORS,$(KERNEL_SECTORS_OFFSET)); \ $(call patch32,$@.boot.tmp,1 + SECTORS,$(PACK_LBA_OFFSET)); \ cat $@.boot.tmp kernel.bin > $@; \ PAD=$$(( SECTORS * 512 - $$(stat -c%s kernel.bin) )); \ dd if=/dev/zero bs=1 count=$$PAD 2>/dev/null >> $@; \ cat rootfs.bin >> $@; \ SIZE=$$(stat -c%s $@); \ if [ $$SIZE -gt 1474560 ]; then \ echo "error: floppy.img is $$SIZE bytes; max is 1474560"; \ rm -f $@; exit 1; \ fi; \ truncate -s 1474560 $@; \ rm -f $@.boot.tmp usb.img: mbr.bin boot.bin kernel.bin cmds.img SECTORS=$$(( ($$(stat -c%s kernel.bin) + 511) / 512 )); \ cp boot.bin $@.boot.tmp; \ $(call patch16,$@.boot.tmp,$$SECTORS,$(KERNEL_SECTORS_OFFSET)); \ printf '\x40' | dd of=$@.boot.tmp bs=1 seek=$(BOOT_SECTOR_START_OFFSET) conv=notrunc 2>/dev/null; \ $(call patch32,$@.boot.tmp,$(ROOTFS_LBA),$(PACK_LBA_OFFSET)); \ cat mbr.bin > $@; \ dd if=/dev/zero bs=512 count=62 2>/dev/null >> $@; \ cat $@.boot.tmp kernel.bin >> $@; \ truncate -s 9M $@; \ dd if=cmds.img of=$@ bs=512 seek=$(ROOTFS_LBA) conv=notrunc 2>/dev/null; \ printf '\x00\x11\x12\x00\x7f\x16\x15\x01\x40\x04\x00\x00\x00\x40\x00\x00' | \ dd of=$@ bs=1 seek=462 conv=notrunc 2>/dev/null; \ rm -f $@.boot.tmp image.bin: floppy.img cp floppy.img image.bin final.bin: boot.bin kernel.bin rootfs.bin SECTORS=$$(( ($$(stat -c%s kernel.bin) + 511) / 512 )); \ cp boot.bin $@.boot.tmp; \ $(call patch16,$@.boot.tmp,$$SECTORS,$(KERNEL_SECTORS_OFFSET)); \ $(call patch32,$@.boot.tmp,1 + SECTORS,$(PACK_LBA_OFFSET)); \ cat $@.boot.tmp kernel.bin > $@; \ PAD=$$(( SECTORS * 512 - $$(stat -c%s kernel.bin) )); \ dd if=/dev/zero bs=1 count=$$PAD 2>/dev/null >> $@; \ cat rootfs.bin >> $@; \ rm -f $@.boot.tmp # ---- UEFI loader and dual-boot USB image ------------------------------- # # The legacy image (usb.img) is left byte-for-byte alone. usb-efi.img copies # it, adds a third MBR partition (type 0xEF, starting at the old 64 MB end) # and writes a small FAT16 ESP there. BIOS booting still uses the active # partition 1 at LBA 63; UEFI finds BOOTX64.EFI in the ESP. $(B)/boot/efi/efi_entry.h: kernel.elf @mkdir -p $(@D) @entry=$$(nm kernel.elf | awk '/ T kernel_entry$$/{print $$1}'); \ if [ -z "$$entry" ]; then echo "efi: kernel_entry not found" >&2; exit 1; fi; \ printf '#define KERNEL_ENTRY 0x%s\n' "$$entry" > $@ $(B)/boot/efi/main.o: boot/efi/main.c $(B)/boot/efi/efi_entry.h @mkdir -p $(@D) $(EFI_CC) $(EFI_CFLAGS) $(DEPFLAGS) -c -o $@ $< # payload.S embeds kernel.bin and cmds_pack_gz.bin (top level) and tramp.bin. $(B)/boot/efi/payload.o: boot/efi/payload.S kernel.bin cmds_pack_gz.bin $(B)/boot/efi/tramp.bin $(EFI_AS) --64 -I$(B)/boot/efi -o $@ $< $(B)/boot/efi/tramp.o: boot/efi/tramp.S @mkdir -p $(@D) $(AS) --64 -o $@ $< $(B)/boot/efi/tramp.elf: $(B)/boot/efi/tramp.o boot/efi/tramp.ld $(LD) -T boot/efi/tramp.ld -nostdlib -m elf_x86_64 -o $@ $< $(B)/boot/efi/tramp.bin: $(B)/boot/efi/tramp.elf $(OBJCOPY) -O binary $< $@ BOOTX64.EFI: $(B)/boot/efi/main.o $(B)/boot/efi/payload.o $(EFI_CC) $(EFI_LDFLAGS) -o $@ $^ ESP_SECTORS = 16384 esp.img: BOOTX64.EFI truncate -s $$(( $(ESP_SECTORS) * 512 )) $@ mkfs.fat -F 16 -s 2 -n NEBOSESP $@ mmd -i $@ ::/EFI mmd -i $@ ::/EFI/BOOT mcopy -i $@ BOOTX64.EFI ::/EFI/BOOT/BOOTX64.EFI usb-efi.img: usb.img esp.img cp usb.img $@ # The legacy partition is a raw kernel blob with a deliberately empty # BPB (boot.S), so neither UEFI firmware nor VFS mistakes it for FAT. # Partition 3: ESP at LBA 18432, type 0xEF, 8 MB (partition 2 is the # rootfs at LBA 1088 written by usb.img). printf '\x00\xfe\xff\xff\xef\xfe\xff\xff\x00\x48\x00\x00\x00\x40\x00\x00' | \ dd of=$@ bs=1 seek=478 conv=notrunc 2>/dev/null dd if=esp.img of=$@ bs=512 seek=$(ESP_LBA) conv=notrunc 2>/dev/null truncate -s $$(( ($(ESP_LBA) + $(ESP_SECTORS)) * 512 )) $@ uefi: usb-efi.img # ---- Ring-3 libraries ------------------------------------------------------ U = $(B)/user UL = $(B)/user/lib # libc: a static archive linked only into commands that use it. The archive # means apps that never reference malloc/string keep paying nothing, and # --gc-sections drops unused functions from the members that are pulled. LIBC_OBJS = $(addprefix $(UL)/libc/,malloc.o string.o strdup.o stdlib.o \ ucmd_mem.o setjmp.o errno.o div64.o dtoa.o stdio.o \ stdio_file.o math.o time.o) LIBC_A = $(UL)/libc/libc.a $(filter-out %/setjmp.o,$(LIBC_OBJS)): OPT = -Os $(filter-out %/setjmp.o,$(LIBC_OBJS)): XFLAGS = $(SECTION_CFLAGS) -fno-builtin $(LIBC_INC) $(LIBC_A): $(LIBC_OBJS) rm -f $@ ar rcs $@ $^ # 8x16 bitmap font and DEFLATE: shared with the kernel (common/). FONT16 = $(B)/common/font_8x16.o INFLATE = $(B)/common/inflate.o # Fixed-point TrueType text engine, linked only into GUI commands. UFONT_OBJS = $(addprefix $(UL)/ufont/,ufont.o ufont_ttf.o ufont_draw.o ufont_file.o) $(UFONT_OBJS): OPT = -Os $(UFONT_OBJS): XFLAGS = $(SECTION_CFLAGS) $(LIBC_INC) $(UL)/ufont/ufont_ttf.o: OPT = -O2 # WOFF 1.0 unwrapping needs inflate, so only the browser links it. UFONT_WOFF = $(UL)/ufont/ufont_woff.o $(UFONT_WOFF): OPT = -Os $(UFONT_WOFF): XFLAGS = $(SECTION_CFLAGS) $(LIBC_INC) # ngui: the userland immediate-mode GUI toolkit. -Os: every GUI app links # the whole toolkit, and the rootfs pack has a cap. NGUI = $(UL)/ngui/ngui.o $(NGUI): OPT = -Os $(NGUI): XFLAGS = $(SECTION_CFLAGS) $(LIBC_INC) NGUI_APP = $(NGUI) $(FONT16) $(UFONT_OBJS) # Window-manager/terminal drawing helpers (wm and term). UWM = $(UL)/uwm/uwm_lib.o $(UWM): OPT = -Os $(UWM): XFLAGS = $(SECTION_CFLAGS) $(LIBC_INC) # Image library: pure freestanding decoders + RGB565 compositing. IMGLIB_OBJS = $(addprefix $(UL)/img/,img.o img_mem.o img_blit.o img_png.o \ img_bmp.o img_gif.o img_jpeg.o img_tga.o img_pnm.o img_ico.o \ img_pam.o img_gif_anim.o img_file.o) IMG_DECODE_OBJS = $(addprefix $(UL)/img/,img.o img_mem.o img_blit.o img_png.o \ img_bmp.o img_gif.o img_jpeg.o img_tga.o img_pnm.o img_ico.o \ img_pam.o) $(IMGLIB_OBJS): XFLAGS = $(SECTION_CFLAGS) # The integer IDCT deliberately relies on 32-bit wrap-around. $(UL)/img/img_jpeg.o: XFLAGS = $(SECTION_CFLAGS) -fwrapv # TLS 1.3/1.2 client library (curl, chat and the browser; see tls.h). The # crypto files are pure freestanding C, so tls_test exercises them on the # host (make test-crypto). TLS 1.2 adds AES-128-GCM (on wpa_crypto.c's AES) # and P-256 ECDH. TLSLIB_OBJS = $(addprefix $(UL)/tls/,tls_sha256.o tls_chacha20.o tls_x25519.o \ tls_gcm.o tls_p256.o wpa_crypto.o tls_rng.o tls.o) $(TLSLIB_OBJS): XFLAGS = $(SECTION_CFLAGS) $(UL)/tls/wpa_crypto.o: OPT = -O2 # Shared HTTP/TLS client (curl, the browser and chat), its cookie jar and the # JSON parser. The jar and the parser have host tests (make test-chat). UHTTP_OBJS = $(UL)/uhttp/uhttp.o $(UL)/uhttp/uhttp_cookie.o UJSON = $(UL)/ujson/ujson.o $(UHTTP_OBJS) $(UJSON): XFLAGS = $(SECTION_CFLAGS) $(UL)/uhttp/uhttp_cookie.o $(UJSON): OPT = -Os # WiFi saved-network list (wifi, netmenu) and the WPA2-PSK supplicant. WIFI_STORE = $(UL)/wifi/wifi_store.o WPA_OBJS = $(UL)/wifi/wpa.o $(UL)/tls/wpa_crypto.o $(UL)/wifi/wpa.o: OPT = -Os $(UL)/wifi/wpa.o: XFLAGS = $(SECTION_CFLAGS) # ---- Ring-3 programs ------------------------------------------------------- # # Every program lives in user/apps// with its entry file ucmd_.c # and is packed as bin/. New command: create user/apps// # ucmd_.c and add to UCMDS (the order is the pack order). A # single-file command needs nothing else; one that links libraries gets an # explicit .elf rule below. UCMDS = cpuinfo ls cat save rm mkdir rmdir \ meminfo mouseinfo storage top process bootscan \ clock colors edit wm term spin \ netinfo netip netdns host dhcp \ netsend netrecv ping pong netlog \ netconsole netregs netloop netreset net100 netmac curl \ files view sensors powerinfo mines solitaire \ settime date gallery websrv browser chat \ wifi netmenu disks membench app = $(U)/apps/$(1)/ucmd_$(1) UCMD_ELFS = $(foreach a,$(UCMDS),$(call app,$(a)).elf) .PRECIOUS: $(UCMD_ELFS) UCMD_LD = user/ucmd.ld # Link a ring-3 ELF at USER_BASE, dropping unreferenced sections. ULINK = $(LD) -T $(UCMD_LD) -z max-page-size=0x100 --gc-sections -nostdlib \ -m elf_i386 -o $@ $(filter-out $(UCMD_LD),$^) && \ $(OBJCOPY) --strip-all $@ $@ # Single-file commands: no libc, no section GC. $(U)/apps/%.elf: $(U)/apps/%.o $(UCMD_LD) $(LD) -T $(UCMD_LD) -z max-page-size=0x100 -nostdlib -m elf_i386 -o $@ $< $(OBJCOPY) --strip-all $@ $@ # Objects that were always compiled without the libc headers. $(call app,edit).o $(call app,wm).o $(call app,files).o $(call app,mines).o \ $(call app,settime).o $(call app,solitaire).o $(U)/apps/gallery/gallery.o \ $(U)/apps/hello/hello.o: XFLAGS = $(call app,settime).o $(call app,solitaire).o: OPT = -Os # Both link with --gc-sections; the section-per-function build lets the pack # drop their unreachable helpers (the rootfs cap is tight). $(call app,wm).o: XFLAGS = $(SECTION_CFLAGS) $(call app,view).o: XFLAGS = $(SECTION_CFLAGS) $(LIBC_INC) $(call app,wm).o $(call app,view).o: OPT = -Os # membench times memcpy/memset over a libc heap buffer. $(call app,membench).elf: $(call app,membench).o $(UCMD_LD) $(LIBC_A) $(ULINK) # websrv buffers its whole PUT/GET body on the libc heap. $(call app,websrv).elf: $(call app,websrv).o $(UCMD_LD) $(LIBC_A) $(ULINK) # edit draws text itself, so it links the 8x16 font into its ELF. $(call app,edit).elf: $(call app,edit).o $(FONT16) $(UCMD_LD) $(LD) -T $(UCMD_LD) -z max-page-size=0x100 -nostdlib -m elf_i386 -o $@ $(filter %.o,$^) $(OBJCOPY) --strip-all $@ $@ # The ring-3 WM draws its own chrome; term renders its own cells. term also # reads the kernel's key codes (io.h) and VFS_PATH_MAX (vfs.h). $(call app,term).o: XFLAGS = $(LIBC_INC) -Ikernel $(call app,wm).elf: $(call app,wm).o $(UWM) $(FONT16) $(UFONT_OBJS) $(UCMD_LD) $(LIBC_A) $(ULINK) $(call app,term).elf: $(call app,term).o $(UWM) $(FONT16) $(UFONT_OBJS) $(UCMD_LD) $(LIBC_A) $(ULINK) # ngui canvas apps. $(call app,files).elf: $(call app,files).o $(NGUI_APP) $(UCMD_LD) $(LIBC_A) $(ULINK) # Task manager: process table with CPU, memory and network history graphs. $(call app,process).elf: $(call app,process).o $(NGUI_APP) $(UCMD_LD) $(LIBC_A) $(ULINK) # Boot scan window: live tail of the bootscan kernel thread's serial output. $(call app,bootscan).elf: $(call app,bootscan).o $(NGUI_APP) $(UCMD_LD) $(LIBC_A) $(ULINK) $(call app,bootscan).o: OPT = -Os $(call app,mines).elf: $(call app,mines).o $(NGUI_APP) $(UCMD_LD) $(LIBC_A) $(ULINK) $(call app,settime).elf: $(call app,settime).o $(NGUI_APP) $(UCMD_LD) $(LIBC_A) $(ULINK) $(call app,solitaire).elf: $(call app,solitaire).o $(NGUI_APP) $(UCMD_LD) $(LIBC_A) $(ULINK) $(call app,view).elf: $(call app,view).o $(IMGLIB_OBJS) $(INFLATE) $(NGUI_APP) $(UCMD_LD) $(LIBC_A) $(ULINK) $(call app,curl).elf: $(call app,curl).o $(UHTTP_OBJS) $(IMG_DECODE_OBJS) $(INFLATE) $(TLSLIB_OBJS) $(UCMD_LD) $(LIBC_A) $(ULINK) $(call app,wifi).elf: $(call app,wifi).o $(WIFI_STORE) $(WPA_OBJS) $(UL)/tls/tls_rng.o $(UL)/tls/tls_sha256.o $(UCMD_LD) $(LIBC_A) $(ULINK) # Control panel: NIC list, WiFi scan, saved networks, power and date/time. $(call app,netmenu).elf: $(call app,netmenu).o $(WIFI_STORE) $(NGUI_APP) $(UCMD_LD) $(LIBC_A) $(ULINK) # Storage manager: devices, partitions, mount policies, format/install. $(call app,disks).elf: $(call app,disks).o $(NGUI_APP) $(UCMD_LD) $(LIBC_A) $(ULINK) # chat: native Cloudron Chat client (ngui + uhttp/TLS + cookie jar + JSON + # the native OIDC login driver). CHAT_LOGIN = $(U)/apps/chat/chat_login.o $(CHAT_LOGIN): OPT = -Os $(CHAT_LOGIN): XFLAGS = $(SECTION_CFLAGS) $(call app,chat).o: OPT = -Os $(call app,chat).o: XFLAGS = $(SECTION_CFLAGS) $(LIBC_INC) $(call app,chat).elf: $(call app,chat).o $(CHAT_LOGIN) $(UJSON) $(UHTTP_OBJS) $(NGUI_APP) $(IMG_DECODE_OBJS) $(INFLATE) $(TLSLIB_OBJS) $(UCMD_LD) $(LIBC_A) $(ULINK) # gallery: a live showcase of every ngui widget and primitive. The real ELF # ships in the rootfs pack as bin/gallery.app; ucmd_gallery.c (in UCMDS) is # the tiny PATH launcher (which also accepts /share/GALLERY). gallery.elf: $(U)/apps/gallery/gallery.o $(NGUI_APP) $(UCMD_LD) $(LIBC_A) $(ULINK) # browser: the real app ships as bin/browser.app in the full pack (and # BROWSER on root.img, which floppy boots use) # because it links ngui, the image library, TLS, uhttp and QuickJS; # ucmd_browser.c is the tiny PATH launcher. Compiled with function sections # and linked with --gc-sections: unreachable image, TLS and UI paths are # dropped. BR = $(U)/apps/browser BROWSER_OBJS = $(BR)/browser.o $(BR)/browser_html.o $(BR)/svg_raster.o \ $(BR)/js_browser.o $(BR)/js_mu.o $(BROWSER_OBJS): OPT = -Os $(BROWSER_OBJS): XFLAGS = $(SECTION_CFLAGS) $(LIBC_INC) $(BR)/browser_html.o: XFLAGS = $(SECTION_CFLAGS) $(BR)/js_mu.o: XFLAGS = $(SECTION_CFLAGS) -Wno-unused-parameter $(LIBC_INC) -I$(QJS_DIR) browser.elf: $(BR)/browser.o $(BR)/browser_html.o $(BR)/svg_raster.o $(BR)/js_browser.o $(BR)/js_prelude.o $(UHTTP_OBJS) $(NGUI_APP) $(UFONT_WOFF) $(IMGLIB_OBJS) $(INFLATE) $(TLSLIB_OBJS) $(BR)/js_mu.o $(QJS_OBJS) $(UCMD_LD) $(LIBC_A) $(ULINK) # hello: the first ring-3 test program (its own linker script). $(U)/apps/hello/hello.elf: $(U)/apps/hello/hello.o user/apps/hello/hello.ld $(LD) -T user/apps/hello/hello.ld -nostdlib -m elf_i386 -o $@ $< $(OBJCOPY) --strip-all $@ $@ # ---- Linux host browser harness (browser-host / host-curl) ------------------- # # The browser talks to the same small SYS_* ABI as on NebOS; host/syscall.c # implements it with Linux files, BSD sockets, fork/exec and an SDL3 window. # The target images and browser.elf are not involved. Build 32-bit so the # pointer-through-int syscall ABI and the ring-3 allocator behave like the # board. SDL3 is only a development dependency for the window backend. HOST_CC ?= gcc HOST_BUILD = host/build HOST_CFLAGS = -m32 -O1 -g -Wall -Wextra -Wno-unused-parameter \ -Wno-sign-compare -Wno-unused-function -Wno-format-truncation \ -fno-strict-aliasing -fno-omit-frame-pointer $(USER_INC) \ -Ihost/include -Ithird_party/quickjs -I/usr/include/SDL3 \ -DUCMD_HOST -DJS_MU_HOST -D__nebos__ -D_GNU_SOURCE \ -DCONFIG_VERSION='"2026-06-04"' # The ring-3 allocator is reused on the host: rename its entry points so # glibc and SDL keep their own malloc. libc/malloc.c and every app object # must use the same set. HOST_APP_MALLOC_DEFS = -Dmalloc=libc_malloc -Dfree=libc_free \ -Dcalloc=libc_calloc -Drealloc=libc_realloc \ -Dmalloc_usable_size=libc_malloc_usable_size \ -Dheap_reset=libc_heap_reset HOST_APP_CFLAGS = $(HOST_CFLAGS) $(HOST_APP_MALLOC_DEFS) HOST_LDFLAGS = -m32 -no-pie -L/usr/lib32 HOST_LDLIBS = -lSDL3 -lm -lpthread -ldl HOST_IMGLIB_SRCS = $(addprefix user/lib/img/,img.c img_mem.c img_blit.c \ img_png.c img_bmp.c img_gif.c img_jpeg.c img_tga.c img_pnm.c \ img_ico.c img_pam.c img_gif_anim.c img_file.c) HOST_TLS_SRCS = $(addprefix user/lib/tls/,tls_sha256.c tls_chacha20.c \ tls_x25519.c tls_gcm.c tls_p256.c wpa_crypto.c tls_rng.c tls.c) HOST_QUERY_SRCS = $(addprefix $(QJS_DIR)/,quickjs.c cutils.c dtoa.c \ libregexp.c libunicode.c) HOST_UHTTP_SRCS = user/lib/uhttp/uhttp.c user/lib/uhttp/uhttp_cookie.c HOST_BROWSER_APP_SRCS = $(addprefix user/apps/browser/,browser.c \ browser_html.c svg_raster.c js_browser.c) \ $(HOST_UHTTP_SRCS) user/lib/ngui/ngui.c \ common/font_8x16.c \ $(addprefix user/lib/ufont/,ufont.c ufont_ttf.c \ ufont_draw.c ufont_file.c ufont_woff.c) \ $(HOST_IMGLIB_SRCS) common/inflate.c $(HOST_TLS_SRCS) \ user/apps/browser/js_mu.c user/lib/libc/malloc.c \ $(HOST_QUERY_SRCS) HOST_CURL_APP_SRCS = user/apps/curl/ucmd_curl.c $(HOST_UHTTP_SRCS) \ $(HOST_IMGLIB_SRCS) common/inflate.c $(HOST_TLS_SRCS) \ user/lib/libc/malloc.c HOST_COMMON_SRCS = host/host.c host/syscall.c host/fs.c host/net.c \ host/proc.c host/heap.c host/window.c \ host/window_sdl3.c host/window_headless.c HOST_COMMON_OBJS = $(addprefix $(HOST_BUILD)/,$(HOST_COMMON_SRCS:.c=.o)) HOST_BROWSER_APP_OBJS = $(addprefix $(HOST_BUILD)/,$(HOST_BROWSER_APP_SRCS:.c=.o)) HOST_CURL_APP_OBJS = $(addprefix $(HOST_BUILD)/,$(HOST_CURL_APP_SRCS:.c=.o)) HOST_BROWSER_OBJS = $(HOST_BUILD)/host/main.o $(HOST_COMMON_OBJS) \ $(HOST_BROWSER_APP_OBJS) $(HOST_BUILD)/js_prelude.o HOST_CURL_OBJS = $(HOST_BUILD)/host/curl_main.o $(HOST_COMMON_OBJS) \ $(HOST_CURL_APP_OBJS) $(HOST_BUILD)/%.o: %.c @mkdir -p $(dir $@) $(HOST_CC) $(HOST_APP_CFLAGS) $(HOST_EXTRA) $(DEPFLAGS) -c -o $@ $< # Host support files use glibc malloc directly, never the renamed arena. $(HOST_BUILD)/host/%.o: host/%.c @mkdir -p $(dir $@) $(HOST_CC) $(HOST_CFLAGS) $(DEPFLAGS) -c -o $@ $< $(HOST_BUILD)/js_prelude.o: user/apps/browser/js_prelude.S $(BR)/js_prelude.min.js @mkdir -p $(dir $@) $(HOST_CC) -m32 -Wa,-I$(BR) -c -o $@ $< $(HOST_BUILD)/user/apps/browser/browser.o: HOST_EXTRA = -D_start=browser_start $(HOST_BUILD)/user/apps/curl/ucmd_curl.o: HOST_EXTRA = -D_start=curl_start browser-host: host-curl $(HOST_BROWSER_OBJS) | icons/adwaita16.icn $(HOST_CC) $(HOST_LDFLAGS) -o $@ $(filter-out host-curl,$^) $(HOST_LDLIBS) host-curl: $(HOST_CURL_OBJS) $(HOST_CC) $(HOST_LDFLAGS) -o $@ $^ $(HOST_LDLIBS) # ---- Host tests (no kernel needed) ----------------------------------------- UFONT_TEST_SRCS = $(addprefix user/lib/ufont/,ufont_test.c ufont.c ufont_ttf.c ufont_draw.c ufont_woff.c) common/inflate.c ufont_test: $(UFONT_TEST_SRCS) user/lib/ufont/ufont.h user/lib/ufont/ufont_internal.h fonts/emoji.ttf testdata/fonts/sans.woff gcc -O2 -Wall -Wextra -Iinclude -Icommon -o $@ $(UFONT_TEST_SRCS) test-font: ufont_test ./ufont_test test-font-asan: $(UFONT_TEST_SRCS) user/lib/ufont/ufont.h user/lib/ufont/ufont_internal.h fonts/emoji.ttf testdata/fonts/sans.woff gcc -O1 -g -fsanitize=address,undefined -Iinclude -Icommon -o ufont_test_asan $(UFONT_TEST_SRCS) ./ufont_test_asan fonts: tools/subset_fonts.sh SVG_SRCS = user/apps/browser/svg_test.c user/apps/browser/svg_raster.c svg_test: $(SVG_SRCS) user/apps/browser/svg_raster.h gcc -O1 -g -Wall -Wextra -fsanitize=address,undefined -o $@ $(SVG_SRCS) -lm test-svg: svg_test ./svg_test touchpad_gesture_test: kernel/touchpad_gesture_test.c kernel/touchpad_gesture.c kernel/touchpad_gesture.h gcc -O2 -Wall -Wextra -o $@ kernel/touchpad_gesture_test.c kernel/touchpad_gesture.c test-touchpad: touchpad_gesture_test ./touchpad_gesture_test # Host tests for the chat client's pure modules: JSON, cookie jar and the # login page/reply/config parsers. CHAT_TEST_CFLAGS = -O1 -g -Wall -Wextra -fsanitize=address,undefined $(USER_INC) ujson_test: user/lib/ujson/ujson_test.c user/lib/ujson/ujson.c user/lib/ujson/ujson.h gcc $(CHAT_TEST_CFLAGS) -o $@ user/lib/ujson/ujson_test.c user/lib/ujson/ujson.c uhttp_cookie_test: user/lib/uhttp/uhttp_cookie_test.c user/lib/uhttp/uhttp_cookie.c user/lib/uhttp/uhttp_cookie.h gcc $(CHAT_TEST_CFLAGS) -o $@ user/lib/uhttp/uhttp_cookie_test.c user/lib/uhttp/uhttp_cookie.c chat_login_test: user/apps/chat/chat_login_test.c user/apps/chat/chat_login.c user/apps/chat/chat_login.h user/lib/ujson/ujson.c gcc $(CHAT_TEST_CFLAGS) -DCHAT_LOGIN_PURE -o $@ user/apps/chat/chat_login_test.c user/apps/chat/chat_login.c user/lib/ujson/ujson.c test-chat: ujson_test uhttp_cookie_test chat_login_test ./ujson_test ./uhttp_cookie_test ./chat_login_test # QEMU end-to-end chat test against tools/mock_chat.py (ports 18080/18081 on # the host, 10.0.2.2 in the guest). CHAT_E2E=--totp|--consent|--passkey| # --wrong selects a login variant; screenshots land in chat-test-out/. CHAT_E2E ?= test-chat-e2e: floppy.img root.img python3 tools/qmp_chat_test.py $(CHAT_E2E) TLS_TEST_SRCS = $(addprefix user/lib/tls/,tls_test.c tls_sha256.c tls_chacha20.c \ tls_x25519.c tls_gcm.c tls_p256.c wpa_crypto.c) tls_test: $(TLS_TEST_SRCS) $(wildcard user/lib/tls/*.h) gcc -O2 -o $@ $(TLS_TEST_SRCS) test-crypto: tls_test ./tls_test wpa_test: user/lib/wifi/wpa_test.c user/lib/wifi/wpa.c user/lib/tls/wpa_crypto.c user/lib/wifi/wpa.h user/lib/tls/wpa_crypto.h gcc -O2 -Wall -Wextra -Iuser/lib/tls -o $@ user/lib/wifi/wpa_test.c user/lib/wifi/wpa.c user/lib/tls/wpa_crypto.c test-wpa: wpa_test ./wpa_test wifi_store_test: user/lib/wifi/wifi_store_test.c user/lib/wifi/wifi_store.c user/lib/wifi/wifi_store.h include/wifi_cfg.h include/syscall.h gcc -m32 -O2 -Wall -Wextra -Iinclude -Iuser -o $@ user/lib/wifi/wifi_store_test.c test-wifi-store: wifi_store_test ./wifi_store_test ccmp_test: kernel/ccmp_test.c kernel/ccmp.c kernel/ccmp.h gcc -O2 -Wall -Wextra -o $@ kernel/ccmp_test.c test-ccmp: ccmp_test ./ccmp_test # Host image-library tests. The corpus and expected hashes are committed; # tools/gen_img_tests.py regenerates them. IMGTEST_SRCS = $(addprefix user/lib/img/,img_test.c img.c img_mem.c img_blit.c \ img_png.c img_bmp.c img_gif.c img_gif_anim.c img_jpeg.c img_tga.c \ img_pnm.c img_ico.c img_pam.c) common/inflate.c IMGTEST_DEPS = $(wildcard user/lib/img/*.h) common/inflate.h testdata/images/expected.h IMGTEST_INC = -I. -Icommon -Iinclude -Iuser img_test: $(IMGTEST_SRCS) $(IMGTEST_DEPS) gcc -O2 -fwrapv -Wall -Wextra $(IMGTEST_INC) -o $@ $(IMGTEST_SRCS) test-images: img_test ./img_test test-images-asan: $(IMGTEST_SRCS) $(IMGTEST_DEPS) # -fwrapv: the integer IDCT deliberately relies on 32-bit wrap-around. gcc -O1 -g -fwrapv -fsanitize=address,undefined $(IMGTEST_INC) -o img_test_asan $(IMGTEST_SRCS) ./img_test_asan # Host tests for the ring-3 libc. The malloc/free names are renamed so the # host libc (printf, rand, write) keeps working normally. HOST_MALLOC_DEFS = -Dmalloc=libc_malloc -Dfree=libc_free \ -Dcalloc=libc_calloc -Drealloc=libc_realloc \ -Dheap_reset=libc_heap_reset LT = $(B)/host-test/libc LSRC = user/lib/libc $(LT)/malloc_host.o: $(LSRC)/malloc.c @mkdir -p $(@D) gcc -O2 -Wall -Wextra $(LIBC_INC) -fno-builtin $(HOST_MALLOC_DEFS) $(DEPFLAGS) -c -o $@ $< $(LT)/test_host_mem.o: $(LSRC)/test_host_mem.c @mkdir -p $(@D) gcc -O2 -Wall -Wextra $(DEPFLAGS) -c -o $@ $< malloc_test: $(LSRC)/test_malloc.c $(LT)/malloc_host.o $(LT)/test_host_mem.o gcc -O2 -Wall -Wextra -o $@ $^ $(LT)/stdio_host.o: $(LSRC)/stdio.c @mkdir -p $(@D) gcc -O2 -Wall -Wextra $(LIBC_INC) -fno-builtin $(DEPFLAGS) -c -o $@ $< $(LT)/dtoa_host.o: $(LSRC)/dtoa.c @mkdir -p $(@D) gcc -O2 -Wall -Wextra $(LIBC_INC) -fno-builtin $(DEPFLAGS) -c -o $@ $< $(LT)/math_host.o: $(LSRC)/math.c @mkdir -p $(@D) gcc -O2 -Wall -Wextra $(LIBC_INC) -fno-builtin $(DEPFLAGS) -c -o $@ $< $(LT)/div64_host.o: $(LSRC)/div64.c @mkdir -p $(@D) gcc -O2 -Wall -Wextra $(DEPFLAGS) -c -o $@ $< format_test: $(LSRC)/test_format.c $(LT)/stdio_host.o $(LT)/dtoa_host.o gcc -O2 -Wall -Wextra -Wno-format-truncation $(LIBC_INC) -o $@ $^ math_test: $(LSRC)/test_math.c $(LT)/math_host.o gcc -O2 -Wall -Wextra -o $@ $^ -lm div64_test: $(LSRC)/test_div64.c $(LT)/div64_host.o gcc -O2 -Wall -Wextra -o $@ $^ setjmp_test: $(LSRC)/test_setjmp.c $(UL)/libc/setjmp.o gcc -m32 -O2 -Wall -Wextra $(LIBC_INC) -o $@ $^ test-libc: malloc_test format_test math_test div64_test setjmp_test ./malloc_test ./format_test ./math_test ./div64_test ./setjmp_test QJS_HOST_SRCS = $(addprefix $(QJS_DIR)/,quickjs.c cutils.c dtoa.c libregexp.c libunicode.c) JS_TEST_SRCS = user/apps/browser/js_test.c user/apps/browser/js_mu.c js_test: $(JS_TEST_SRCS) user/apps/browser/js_mu.h $(QJS_HOST_SRCS) $(wildcard $(QJS_DIR)/*.h) gcc -O1 -g -w -fsanitize=address,undefined -fno-sanitize=shift -Iinclude -Iuser -I$(QJS_DIR) -D__nebos__ -DJS_MU_HOST \ -DCONFIG_VERSION='"2026-06-04"' -o $@ $(JS_TEST_SRCS) $(QJS_HOST_SRCS) -lm test-js: js_test ./js_test # ---- Host tools ------------------------------------------------------------ mkpack: tools/mkpack.c gcc -O2 -o $@ $< mkrootfs: tools/mkrootfs.c include/rootfs.h gcc -O2 -Iinclude -o $@ $< mkrtwtbl: tools/mkrtwtbl.c include/rtl8821a_tbl.h third_party/rtw88/rtw8821a_table.inc gcc -O2 -Wall -Wextra -I. -Iinclude -o $@ $< kexec_send: tools/kexec_send.c gcc -O2 -o $@ $< netkexec_send: tools/netkexec_send.c gcc -O2 -o $@ $< netmonitor: tools/netmonitor.c gcc -O2 -o $@ $< mkicons: tools/mkicons.c include/icon_abi.h user/apps/browser/svg_raster.c user/apps/browser/svg_raster.h gcc -O2 -Wall -Wextra -Iinclude -o $@ tools/mkicons.c user/apps/browser/svg_raster.c -lm jsstrip: tools/jsstrip.c gcc -O2 -Wall -Wextra -o $@ $< # The browser prelude is embedded without its comments and indentation # (tools/jsstrip.c): ~3.5 KB of gzip in the rootfs pack. $(BR)/js_prelude.min.js: user/apps/browser/js_prelude.js jsstrip @mkdir -p $(@D) ./jsstrip $< $@ $(BR)/js_prelude.o: user/apps/browser/js_prelude.S $(BR)/js_prelude.min.js @mkdir -p $(@D) $(AS) $(ASFLAGS) -I$(BR) -o $@ $< mkcursors: tools/mkcursors.c include/cursor_abi.h gcc -O2 -Wall -Wextra -Iinclude -o $@ $< cursor_test: tools/cursor_test.c include/cursor_abi.h gcc -O1 -g -Wall -Wextra -fsanitize=address,undefined -Iinclude -o $@ $< # ---- Command pack (the system rootfs) --------------------------------------- # # The ring-3 command ELFs plus hello and the browser/gallery apps, packed # into bin/. See tools/mkpack.c, include/rootfs.h and kernel/ramfs.h. FONT_FILES = fonts/sans.ttf fonts/sans-b.ttf fonts/sans-i.ttf \ fonts/sans-bi.ttf fonts/mono.ttf fonts/emoji.ttf # Mouse cursors: the Adwaita theme's 24 px images (assets/cursors/adwaita/, # LGPL-3 / CC-BY-SA-3.0) converted to one NBCUR1 bundle (include/cursor_abi.h) # that kernel/cursor.c loads from /ramfs/cursors/adwaita24.cur. Full pack # only (~18 KB gzip): the floppy lite pack has no room, and its kernel keeps # the built-in 16x16 arrow. CURSOR_THEME = assets/cursors/adwaita CURSOR_FILE = cursors/adwaita24.cur $(CURSOR_FILE): mkcursors $(filter-out %/README %/COPYING%,$(wildcard $(CURSOR_THEME)/*)) @mkdir -p cursors ./mkcursors $(CURSOR_THEME) 24 $@ # Defined after CURSOR_FILE: make expands a rule's prerequisites at once. test-cursors: cursor_test $(CURSOR_FILE) ./cursor_test $(CURSOR_FILE) # UI icons: the Adwaita symbolic SVGs (assets/icons/adwaita/, LGPL-3 / # CC-BY-SA-3.0) rasterized by mkicons (with the browser's svg_raster.c) into # one NBICO1 bundle of 16 px coverage masks (include/icon_abi.h) that ngui # loads from /ramfs/icons/adwaita16.icn and tints. ~3.3 KB (~0.8 KB gzip), # so the floppy lite pack carries it as well. ICON_THEME = assets/icons/adwaita ICON_FILE = icons/adwaita16.icn $(ICON_FILE): mkicons $(wildcard $(ICON_THEME)/*.svg) @mkdir -p icons ./mkicons $(ICON_THEME) 16 $@ HELLO_ELF = $(U)/apps/hello/hello.elf PACK_FILES = $(foreach a,$(UCMDS),bin/$(a)=$(call app,$(a)).elf) \ bin/hello=$(HELLO_ELF) \ bin/gallery.app=gallery.elf \ $(foreach f,$(FONT_FILES),$(f)=$(f)) \ $(ICON_FILE)=$(ICON_FILE) PACK_DEPS = $(UCMD_ELFS) $(HELLO_ELF) browser.elf gallery.elf $(FONT_FILES) \ $(ICON_FILE) mkpack PACK_CURSOR_FILES = $(CURSOR_FILE)=$(CURSOR_FILE) # The browser (~500 KB gzip) is in the full pack only: a floppy boot runs it # from BROWSER on root.img, which the bin/browser launcher already tries. PACK_BROWSER_FILES = bin/browser.app=browser.elf # `install self` reads the flat kernel from the full pack. The lite/floppy # pack deliberately omits it (no room on a 1.44 MB disk). PACK_INSTALL_FILES = install/kernel.bin=kernel.bin # WiFi firmware (kernel/iwl_trans.c): the Intel 7265D/3165 (Chromebook, MVM) # and the 6200/6300 (ThinkPad X201, DVM). Taken from the host's # linux-firmware (`.zst` or plain); WIFI_FW_7265D / WIFI_FW_6000 override the # search. A machine without one still builds: the pack then has no # firmware/ entry for that card and `wifi` reports it missing. fw_search = $(firstword $(wildcard \ /usr/lib/firmware/intel/iwlwifi/$(1).zst /usr/lib/firmware/$(1).zst \ /usr/lib/firmware/intel/iwlwifi/$(1) /usr/lib/firmware/$(1) \ /lib/firmware/$(1))) WIFI_FW_7265D ?= $(call fw_search,iwlwifi-7265D-29.ucode) WIFI_FW_6000 ?= $(call fw_search,iwlwifi-6000-4.ucode) WIFI_FW_FILE = PACK_FW_FILES = # $(1) = file name in the pack, $(2) = host source. define wifi_fw_rule ifneq ($(2),) WIFI_FW_FILE += firmware/$(1) PACK_FW_FILES += firmware/$(1)=firmware/$(1) firmware/$(1): $(2) @mkdir -p firmware case "$$<" in *.zst) zstd -q -d -c "$$<" > $$@ ;; *) cp "$$<" $$@ ;; esac else $$(info note: $(1) not found; building the pack without it) endif endef $(eval $(call wifi_fw_rule,iwlwifi-7265D-29.ucode,$(WIFI_FW_7265D))) $(eval $(call wifi_fw_rule,iwlwifi-6000-4.ucode,$(WIFI_FW_6000))) # Realtek RTL8821AU USB sticks (kernel/rtl8821au.c): the rtw88 8051 firmware # from linux-firmware (WIFI_FW_8821A overrides the search) and the register # tables, generated from third_party/rtw88 by the host tool mkrtwtbl. Both # are only in the full pack, like the Intel firmware. WIFI_FW_8821A ?= $(firstword $(wildcard \ /usr/lib/firmware/rtw88/rtw8821a_fw.bin.zst \ /usr/lib/firmware/rtw88/rtw8821a_fw.bin \ /lib/firmware/rtw88/rtw8821a_fw.bin)) $(eval $(call wifi_fw_rule,rtw8821a_fw.bin,$(WIFI_FW_8821A))) WIFI_FW_FILE += firmware/rtl8821a.tbl PACK_FW_FILES += firmware/rtl8821a.tbl=firmware/rtl8821a.tbl firmware/rtl8821a.tbl: mkrtwtbl @mkdir -p firmware ./mkrtwtbl $@ cmds.pack: $(PACK_DEPS) $(WIFI_FW_FILE) $(CURSOR_FILE) kernel.bin ./mkpack $@ $(PACK_FILES) $(PACK_BROWSER_FILES) $(PACK_CURSOR_FILES) \ $(PACK_INSTALL_FILES) \ $(PACK_FW_FILES) # The floppy images cannot hold the ~1 MB firmware: they get the same pack # without firmware/* (and without the cursor bundle or bin/browser.app). cmds-lite.pack: $(PACK_DEPS) ./mkpack $@ $(PACK_FILES) # The boot-time rootfs is gzip-compressed; the raw cmds.pack is still what # cmds-dev/net-cmds send for a runtime replacement. Prefer libdeflate's # level 12 when it is installed: it saves about 8 KB over gzip -9 on the # current pack. The high-memory rootfs loader supports up to 2 MB; the # floppy images use the firmware-less lite pack (rootfs.bin). CMDS_GZ = $(shell command -v libdeflate-gzip >/dev/null 2>&1 && \ echo "libdeflate-gzip -12 -c" || echo "gzip -9 -n -c") CMDS_GZ_MAX = 2097152 cmds_lite_gz.bin: cmds-lite.pack $(CMDS_GZ) $< > $@ cmds_pack_gz.bin: cmds.pack $(CMDS_GZ) $< > $@ @sz=$$(stat -c%s $@); \ if [ $$sz -gt $(CMDS_GZ_MAX) ]; then \ echo "error: cmds_pack_gz.bin is $$sz bytes; the legacy rootfs cap is $(CMDS_GZ_MAX)"; \ rm -f $@; exit 1; \ fi # Rootfs image: one NBROOT1 header sector + the gzip pack (rootfs.h). # rootfs.bin (the lite pack, no firmware) is appended to the floppy images; # cmds.img is the 8 MB image flashed into the USB rootfs partition. rootfs.bin: cmds_lite_gz.bin mkrootfs ./mkrootfs $@ cmds_lite_gz.bin # Full NBROOT1 image (header + gzip pack, no partition padding) for the # network install path. `install self` uses the retained boot image instead. rootfs-full.bin: cmds_pack_gz.bin mkrootfs ./mkrootfs $@ cmds_pack_gz.bin rootfs: cmds.img cmds.img: cmds_pack_gz.bin mkrootfs ./mkrootfs $@ cmds_pack_gz.bin $$(( $(ROOTFS_SECTORS) * 512 )) # Diagnostic: no WM, boot console stays visible. Rebuild normally with # `make -B ...` afterwards (the objects carry -DNOWM). nowm: $(MAKE) NOWM=1 -B kernel.elf kernel.bin floppy.img usb.img usb-efi.img final.bin @echo "nowm: WM disabled; flash usb.img or usb-efi.img." root.img: browser.elf gallery.elf testdata/browser/demo.html testdata/browser/js.html testdata/browser/jsext.js testdata/images/rgb.bmp dd if=/dev/zero of=$@ bs=512 count=2880 2>/dev/null mkfs.fat -F 12 -n "ROOTDISK" $@ echo "Hello from the second floppy!" | mcopy -i $@ - ::HELLO.TXT echo "This is a test file on drive 1." | mcopy -i $@ - ::TEST.TXT mcopy -i $@ browser.elf ::BROWSER mcopy -i $@ gallery.elf ::GALLERY mcopy -i $@ testdata/browser/demo.html ::DEMO.HTM mcopy -i $@ testdata/browser/js.html ::JS.HTM mcopy -i $@ testdata/browser/jsext.js ::JSEXT.JS mcopy -i $@ testdata/images/rgb.bmp ::PIC.BMP OVMF ?= $(firstword $(wildcard /usr/share/ovmf/x64/OVMF.4m.fd /usr/share/OVMF/OVMF.4m.fd)) # Guest RAM for the QEMU targets, matching the 1 GB kernel ceiling (phys.h); # override with e.g. `make run QEMU_MEM=512M` (RAM above 1 GB is ignored). QEMU_MEM ?= 1G # root.img is deliberately not attached: a running QEMU may hold its write # lock, and the UEFI boot test does not need a second filesystem. run-uefi: usb-efi.img @test -n "$(OVMF)" || { echo "OVMF not found; set OVMF=/path/to/OVMF.4m.fd" >&2; exit 1; } qemu-system-x86_64 -M pc -m $(QEMU_MEM) -smp 4 -bios $(OVMF) -snapshot \ -drive file=usb-efi.img,format=raw,if=ide \ -device pci-ohci -device usb-mouse \ -device ne2k_pci,netdev=n0 -netdev user,id=n0 \ -serial file:/tmp/opencode/nebos-uefi-serial.log test-uefi: usb-efi.img @test -n "$(OVMF)" || { echo "OVMF not found; set OVMF=/path/to/OVMF.4m.fd" >&2; exit 1; } @rm -f /tmp/opencode/nebos-uefi-serial.log timeout 40 qemu-system-x86_64 -M pc -m $(QEMU_MEM) -smp 4 -bios $(OVMF) -snapshot \ -drive file=usb-efi.img,format=raw,if=ide \ -device pci-ohci -device usb-mouse \ -device ne2k_pci,netdev=n0 -netdev user,id=n0 \ -display none -serial file:/tmp/opencode/nebos-uefi-serial.log \ -no-reboot >/dev/null 2>&1 || true @grep -q "booted" /tmp/opencode/nebos-uefi-serial.log && \ echo "UEFI boot: OK (/tmp/opencode/nebos-uefi-serial.log)" || \ { echo "UEFI boot: FAILED"; tail -c 4000 /tmp/opencode/nebos-uefi-serial.log; exit 1; } run: image.bin root.img $(MAKE) run-floppy # Four logical CPUs (the Atom 330 topology). UP is still the default so a # machine without ACPI/MADT boots exactly as before. run-smp: floppy.img root.img qemu-system-i386 -M pc -m $(QEMU_MEM) -smp 4 -device pci-ohci -device usb-mouse -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy 2>/dev/null || \ qemu-system-x86_64 -M pc -m $(QEMU_MEM) -smp 4 -device pci-ohci -device usb-mouse -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy floppy: floppy.img usb: usb.img # Write the dual-boot USB image (legacy BIOS + UEFI) to a stick; prompts # before destroying anything. # make flash USB=/dev/sdX FORCE=1 skips the removable-device check. # make flash FLASH_IMG=usb.img legacy-only image # The UEFI half needs the mingw toolchain (EFI_CC); the legacy half does not. FLASH_IMG ?= usb-efi.img flash: $(FLASH_IMG) @tools/flash.sh "$(USB)" "$(FORCE)" "$(FLASH_IMG)" run-floppy: floppy.img root.img qemu-system-i386 -M pc -m $(QEMU_MEM) -device pci-ohci -device usb-mouse -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy 2>/dev/null || \ qemu-system-x86_64 -M pc -m $(QEMU_MEM) -device pci-ohci -device usb-mouse -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy run-usb: usb.img root.img qemu-system-i386 -M pc -m $(QEMU_MEM) -boot c -device pci-ohci -device usb-mouse -drive file=usb.img,format=raw,if=ide -drive file=root.img,format=raw,if=floppy 2>/dev/null || \ qemu-system-x86_64 -M pc -m $(QEMU_MEM) -boot c -device pci-ohci -device usb-mouse -drive file=usb.img,format=raw,if=ide -drive file=root.img,format=raw,if=floppy # UHCI variant (machines with an Intel/VIA-style controller, and the # regression test for the UHCI backend of the USB core). run-uhci: floppy.img root.img qemu-system-i386 -M pc -m $(QEMU_MEM) -device piix3-usb-uhci -device usb-mouse -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy 2>/dev/null || \ qemu-system-x86_64 -M pc -m $(QEMU_MEM) -device piix3-usb-uhci -device usb-mouse -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy # xHCI variant (Braswell/Intel PCH and other USB 3.0-only machines). run-xhci: floppy.img root.img qemu-system-i386 -M pc -m $(QEMU_MEM) -device qemu-xhci -device usb-mouse -device usb-kbd -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy 2>/dev/null || \ qemu-system-x86_64 -M pc -m $(QEMU_MEM) -device qemu-xhci -device usb-mouse -device usb-kbd -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy # RNDIS variant: QEMU's usb-net is a full-speed RNDIS function. It sits on # xHCI (QEMU's USB2 root ports), and `-nic none` keeps the PCI e1000 out of # the way so the phone/tethering link is the active NIC. run-rndis: floppy.img root.img qemu-system-i386 -M pc -m $(QEMU_MEM) -nic none -device qemu-xhci -device usb-mouse -device usb-kbd -device usb-net,netdev=n1 -netdev user,id=n1 -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy 2>/dev/null || \ qemu-system-x86_64 -M pc -m $(QEMU_MEM) -nic none -device qemu-xhci -device usb-mouse -device usb-kbd -device usb-net,netdev=n1 -netdev user,id=n1 -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy # EHCI variant (USB 2.0 high-speed root ports). usb-storage is high-speed # and lands on EHCI; the mouse/keyboard are full-speed and use the UHCI # companion, exercising the multi-controller USB core. run-ehci: floppy.img root.img qemu-system-i386 -M pc -m $(QEMU_MEM) -boot a -device usb-ehci,id=ehci0 -device piix3-usb-uhci,id=uhci0 \ -device usb-storage,bus=ehci0.0,drive=usbstick \ -drive if=none,id=usbstick,file=root.img,format=raw \ -device usb-mouse,bus=uhci0.0 -device usb-kbd,bus=uhci0.0 \ -drive file=floppy.img,format=raw,if=floppy 2>/dev/null || \ qemu-system-x86_64 -M pc -m $(QEMU_MEM) -boot a -device usb-ehci,id=ehci0 -device piix3-usb-uhci,id=uhci0 \ -device usb-storage,bus=ehci0.0,drive=usbstick \ -drive if=none,id=usbstick,file=root.img,format=raw \ -device usb-mouse,bus=uhci0.0 -device usb-kbd,bus=uhci0.0 \ -drive file=floppy.img,format=raw,if=floppy # Passthrough of the real ASIX AX88772 dongle (requires the host's asix # driver to be unbound and permission on /dev/bus/usb/...; typically run with # sudo). `-nic none` keeps the QEMU e1000 out of the way so the USB NIC is # the only netdev. ASIX_HOST ?= vendorid=0x0b95,productid=0x7720 run-ehci-asix: floppy.img root.img qemu-system-i386 -M pc -m $(QEMU_MEM) -nic none -device usb-ehci -device usb-host,$(ASIX_HOST) -serial file:/tmp/opencode/serial-asix.log -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy 2>/dev/null || \ qemu-system-x86_64 -M pc -m $(QEMU_MEM) -nic none -device usb-ehci -device usb-host,$(ASIX_HOST) -serial file:/tmp/opencode/serial-asix.log -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy run-xhci-asix: floppy.img root.img qemu-system-i386 -M pc -m $(QEMU_MEM) -nic none -device qemu-xhci -device usb-host,$(ASIX_HOST) -serial file:/tmp/opencode/serial-asix.log -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy 2>/dev/null || \ qemu-system-x86_64 -M pc -m $(QEMU_MEM) -nic none -device qemu-xhci -device usb-host,$(ASIX_HOST) -serial file:/tmp/opencode/serial-asix.log -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy # Network variant: a PCI NE2000 (RTL8029, the driver's QEMU match) on QEMU's # user-mode network (slirp). DHCP/DNS come from slirp, the host is 10.0.2.2 # (e.g. `python3 -m http.server` + `curl http://10.0.2.2:8000/` in a window). run-net: floppy.img root.img qemu-system-i386 -M pc -m $(QEMU_MEM) -device pci-ohci -device usb-mouse -device ne2k_pci,netdev=n0 -netdev user,id=n0,hostfwd=tcp::8080-:8080 -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy 2>/dev/null || \ qemu-system-x86_64 -M pc -m $(QEMU_MEM) -device pci-ohci -device usb-mouse -device ne2k_pci,netdev=n0 -netdev user,id=n0,hostfwd=tcp::8080-:8080 -drive file=floppy.img,format=raw,if=floppy -drive file=root.img,format=raw,if=floppy # Intel e1000 variant: QEMU's 82540EM exercises the e1000e driver's MAC/DMA # path. (The X201's 82577LM uses the same registers; only its PCH PHY is # different.) usb-kbd is there for headless QMP `send-key` typing. run-e1000: floppy.img root.img qemu-system-i386 -M pc -m $(QEMU_MEM) -device pci-ohci -device usb-mouse -device usb-kbd \ -device e1000,netdev=n0 -netdev user,id=n0,hostfwd=tcp::8080-:8080 \ -drive file=floppy.img,format=raw,if=floppy \ -drive file=root.img,format=raw,if=floppy 2>/dev/null || \ qemu-system-x86_64 -M pc -m $(QEMU_MEM) -device pci-ohci -device usb-mouse -device usb-kbd \ -device e1000,netdev=n0 -netdev user,id=n0,hostfwd=tcp::8080-:8080 \ -drive file=floppy.img,format=raw,if=floppy \ -drive file=root.img,format=raw,if=floppy # SATA/AHCI variant: an ICH9 AHCI controller with a test disk on port 0. # The disk image lives outside the repo and is created on first use; boot # stays on the floppy (order=a), the SATA disk shows up as sata0. SATA_IMG ?= /tmp/opencode/nebos-sata.img run-ahci: floppy.img root.img @test -f $(SATA_IMG) || truncate -s 512M $(SATA_IMG) qemu-system-i386 -M pc -m $(QEMU_MEM) -boot order=a -device pci-ohci -device usb-mouse \ -drive file=floppy.img,format=raw,if=floppy \ -drive file=root.img,format=raw,if=floppy \ -device ich9-ahci,id=sata \ -drive file=$(SATA_IMG),format=raw,if=none,id=satadisk \ -device ide-hd,drive=satadisk,bus=sata.0 2>/dev/null || \ qemu-system-x86_64 -M pc -m $(QEMU_MEM) -boot order=a -device pci-ohci -device usb-mouse \ -drive file=floppy.img,format=raw,if=floppy \ -drive file=root.img,format=raw,if=floppy \ -device ich9-ahci,id=sata \ -drive file=$(SATA_IMG),format=raw,if=none,id=satadisk \ -device ide-hd,drive=satadisk,bus=sata.0 # AMD Piledriver regression: QEMU's Opteron_G5 is the FX-6350's family 15h # model 2 CPU. Exercises the AMD CPUID/MTRR/xAPIC paths, the AMD thermal # probe, the IOAPIC mask and six-core ACPI SMP. QEMU has no SB950 or # RTL8111E, so the e1000/OHCI devices cover the rest of the boot path. run-amd: floppy.img root.img qemu-system-x86_64 -M pc -cpu Opteron_G5 -smp 6 -m $(QEMU_MEM) \ -device pci-ohci -device usb-mouse -device usb-kbd \ -device e1000,netdev=n0 -netdev user,id=n0 \ -drive file=floppy.img,format=raw,if=floppy \ -drive file=root.img,format=raw,if=floppy test-amd: floppy.img root.img @rm -f /tmp/opencode/nebos-amd-serial.log timeout 40 qemu-system-x86_64 -M pc -cpu Opteron_G5 -smp 6 -m $(QEMU_MEM) \ -device pci-ohci -device usb-mouse -device usb-kbd \ -device e1000,netdev=n0 -netdev user,id=n0 \ -drive file=floppy.img,format=raw,if=floppy \ -drive file=root.img,format=raw,if=floppy \ -display none -serial file:/tmp/opencode/nebos-amd-serial.log \ -no-reboot >/dev/null 2>&1 || true @grep -q "booted" /tmp/opencode/nebos-amd-serial.log && \ grep -q "smp cpus: 6" /tmp/opencode/nebos-amd-serial.log && \ grep -q "ioapic: masked" /tmp/opencode/nebos-amd-serial.log && \ grep -q "thermal: AMD family 15h" /tmp/opencode/nebos-amd-serial.log && \ ! grep -q "PIT NOT TICKING" /tmp/opencode/nebos-amd-serial.log && \ echo "AMD boot: OK (/tmp/opencode/nebos-amd-serial.log)" || \ { echo "AMD boot: FAILED"; tail -c 4000 /tmp/opencode/nebos-amd-serial.log; exit 1; } # Headless USB HID regression tests (QEMU + python3): cursor movement via # injected USB mouse reports and keyboard input via injected key events, # including hotplug. See tools/*.py. test-usb: floppy.img root.img python3 tools/qmp_cursor_test.py python3 tools/qmp_cursor_test.py --uhci python3 tools/qmp_cursor_test.py --uhci72 python3 tools/qmp_cursor_test.py --hotplug python3 tools/qmp_cursor_test.py --xhci python3 tools/qmp_cursor_test.py --ehci python3 tools/qmp_keyboard_test.py python3 tools/qmp_keyboard_test.py --hotplug python3 tools/qmp_keyboard_test.py --xhci python3 tools/qmp_keyboard_test.py --ehci # End-to-end installer test: boot the dual-boot USB image as an IDE disk, # attach the same image as a USB mass-storage source, type `install ide1` # on the terminal and verify + boot the cloned target. test-install: usb-efi.img python3 tools/qmp_install_test.py scp-final: final.bin scp final.bin root@192.168.0.136: ssh root@192.168.0.136 dd if=final.bin of=/dev/fd0 bs=512 scp-root: root.img scp root.img root@192.168.0.136: ssh root@192.168.0.136 dd if=root.img of=/dev/fd0 bs=512 SERIAL_DEV ?= /dev/ttyUSB0 SERIAL_BAUD ?= 115200 run-serial: @echo "Starting serial monitor on $(SERIAL_DEV) at $(SERIAL_BAUD) baud..." @echo "Type 'serial test' in the nebos terminal." @echo "Press Ctrl-A Ctrl-X to exit picocom." picocom $(SERIAL_DEV) --baud $(SERIAL_BAUD) monitor: @echo "Watching $(SERIAL_DEV) @ $(SERIAL_BAUD) baud (Ctrl-A Ctrl-X to exit)." @echo "Each 'make dev' reload prints: NebOS v booted" picocom $(SERIAL_DEV) --baud $(SERIAL_BAUD) dev: kernel.bin cmds_pack_gz.bin kexec_send @entry=$$(nm kernel.elf | awk '/ T kernel_entry$$/{print $$1}'); \ if [ -z "$$entry" ]; then echo "error: kernel_entry symbol not found"; exit 1; fi; \ echo "Sending kernel.bin + cmds_pack_gz.bin (entry 0x$$entry) via $(SERIAL_DEV) @ $(SERIAL_BAUD)..."; \ ./kexec_send $(SERIAL_DEV) $(SERIAL_BAUD) $$entry kernel.bin cmds_pack_gz.bin # Kernel-only fast path: the board keeps its running rootfs. kernel-dev: kernel.bin kexec_send @entry=$$(nm kernel.elf | awk '/ T kernel_entry$$/{print $$1}'); \ if [ -z "$$entry" ]; then echo "error: kernel_entry symbol not found"; exit 1; fi; \ echo "Sending kernel.bin only (entry 0x$$entry) via $(SERIAL_DEV) @ $(SERIAL_BAUD)..."; \ ./kexec_send $(SERIAL_DEV) $(SERIAL_BAUD) $$entry kernel.bin # Push just the command pack (cmds.pack) to a running board: no kernel # reload, the /ramfs contents are replaced in place. The board must be idle # at a prompt (the WM loop auto-detects the transfer). cmds-dev: cmds.pack kexec_send @echo "Sending cmds.pack via $(SERIAL_DEV) @ $(SERIAL_BAUD)..." ./kexec_send --payload $(SERIAL_DEV) $(SERIAL_BAUD) cmds.pack net-cmds: cmds.pack netkexec_send @echo "Sending cmds.pack to $(BOARD_IP):$(NETKEXEC_PORT)..." ./netkexec_send --payload $(BOARD_IP) $(NETKEXEC_PORT) cmds.pack # Development override: upload the real browser to the board's writable # /share; the bin/browser launcher prefers it over the pack copy. The board # must be running `websrv`; stop it before browsing HTTP, since the WebDAV # server owns the NIC. browser-dev: browser.elf @echo "Uploading browser.elf to http://$(BOARD_IP):8080/share/BROWSER..." curl -f -T browser.elf http://$(BOARD_IP):8080/share/BROWSER # gallery follows the same development-override model. gallery-dev: gallery.elf @echo "Uploading gallery.elf to http://$(BOARD_IP):8080/share/GALLERY..." curl -f -T gallery.elf http://$(BOARD_IP):8080/share/GALLERY # Browser compatibility ladder: serve testdata/browser/compat so the board # or a QEMU guest can open http://:$(COMPAT_PORT)/. COMPAT_PORT ?= 8000 compat-serve: @echo "Serving the browser compatibility ladder on port $(COMPAT_PORT)" python3 -m http.server -d testdata/browser/compat $(COMPAT_PORT) # Show the board's netlog stream (kernel debug + terminal text) like `make # monitor` does over serial. netmon: netmonitor @echo "Listening for netlog on UDP $(NETLOG_PORT) (Ctrl-C to exit)." ./netmonitor $(NETLOG_PORT) # Push a fresh kernel over Ethernet (the board auto-detects it from its idle # loop; no serial and no USB stick involved). BOARD_IP ?= 192.168.178.240 NETLOG_PORT ?= 19290 NETKEXEC_PORT ?= 19288 net-dev: kernel.bin cmds_pack_gz.bin netkexec_send @entry=$$(nm kernel.elf | awk '/ T kernel_entry$$/{print $$1}'); \ if [ -z "$$entry" ]; then echo "error: kernel_entry symbol not found"; exit 1; fi; \ echo "Sending kernel.bin + cmds_pack_gz.bin (entry 0x$$entry) to $(BOARD_IP):$(NETKEXEC_PORT)..."; \ ./netkexec_send $(BOARD_IP) $(NETKEXEC_PORT) 0x$$entry kernel.bin cmds_pack_gz.bin # Kernel-only fast path: the board keeps its running rootfs. kernel-net-dev: kernel.bin netkexec_send @entry=$$(nm kernel.elf | awk '/ T kernel_entry$$/{print $$1}'); \ if [ -z "$$entry" ]; then echo "error: kernel_entry symbol not found"; exit 1; fi; \ echo "Sending kernel.bin only (entry 0x$$entry) to $(BOARD_IP):$(NETKEXEC_PORT)..."; \ ./netkexec_send $(BOARD_IP) $(NETKEXEC_PORT) 0x$$entry kernel.bin # Persistent update: write P1/P2 on the target disk (P4/data is untouched), # then jump into the new kernel. TARGET=auto picks the only non-USB NebOS # disk; use NETINSTALL_TARGET=mmc0/sata0/... to override. NETINSTALL_TARGET ?= auto net-install: kernel.bin rootfs-full.bin netkexec_send @entry=$$(nm kernel.elf | awk '/ T kernel_entry$$/{print $$1}'); \ if [ -z "$$entry" ]; then echo "error: kernel_entry symbol not found"; exit 1; fi; \ echo "Persisting kernel.bin + rootfs-full.bin to $(NETINSTALL_TARGET) on $(BOARD_IP):$(NETKEXEC_PORT)..."; \ ./netkexec_send --install $(NETINSTALL_TARGET) $(BOARD_IP) $(NETKEXEC_PORT) 0x$$entry kernel.bin rootfs-full.bin clean: rm -rf $(B) host/build rm -f kernel.elf kernel.bin boot.bin mbr.bin boot.bin.tmp image.bin \ floppy.img usb.img usb-efi.img esp.img final.bin root.img \ BOOTX64.EFI browser.elf gallery.elf *.boot.tmp \ cmds.pack cmds-lite.pack cmds_pack_gz.bin cmds_lite_gz.bin \ rootfs.bin rootfs-full.bin cmds.img \ firmware/*.ucode firmware/*.tbl firmware/*.bin cursors/*.cur icons/*.icn \ mkpack mkrootfs mkrtwtbl mkcursors mkicons jsstrip cursor_test kexec_send netkexec_send netmonitor \ browser-host host-curl \ ufont_test ufont_test_asan svg_test touchpad_gesture_test \ ujson_test uhttp_cookie_test chat_login_test tls_test wpa_test \ wifi_store_test ccmp_test img_test img_test_asan malloc_test \ format_test math_test div64_test setjmp_test js_test # Compiler-generated header dependencies. -include $(shell find $(B) host/build -name '*.d' 2>/dev/null)