sysinst: what the tree already does about colours, whole-disk install and cgd ========================================================================== Source: the tree at /home/lotherk/src/makronix, src/usr.sbin/sysinst, import src/ pinned at e523df740 (NetBSD 11.99.9). Read 2026-11-06 with grep and sed, not yet read line by line. Everything below is a file:line of that tree. Size: 32471 lines in *.c, *.h, menus.*, msg.mi.en. Largest: partman.c (3440), mbr.c (3207), util.c (2793), disks.c (2782), label.c (2437), bsddisklabel.c (2039), gpt.c (1971). Documentation in the directory: sysinst.8, README.md_defs, TODO. sysinst.8 and TODO contain no mention of cgd or encryption (grep -i 'cgd|encrypt'). Colours ------- main.c:206-207 default colour pair: clr_arg.bg = COLOR_BLUE, .fg = COLOR_WHITE main.c:308 start_color() util.c:2187-2196 one pair only: bg and fg are clamped to <= COLOR_WHITE (the eight basic curses colours), init_pair(1, fg, bg), applied with wbkgd/wattrset to stdscr and mainwin run.c:395-396 the action window copies stdscr's background and attributes => The whole installer uses one colour pair out of eight colours. There is no init_color() call; a palette of arbitrary RGB values (CDE) is not expressible without adding one. Whole-disk install ------------------ part_edit.c:963 parts_use_wholedisk() part_edit.c:1035 set_use_entire_disk() part_edit.c:1081-1083 menu option MSG_Use_the_entire_disk msg.mi.en (ptnsizes): "The default is to allocate all the space to the root file system." A partition-size menu follows, in which the user may split /usr, /var, /home. => sysinst already has "use the entire disk" and a default layout; what is missing for the Makronix goal is skipping the questions around it. cgd --- partman.c (106 of the 111 "cgd" hits in the *.c files): the "extended partition manager" creates cgd volumes: menus for base device, encryption, key size, IV algorithm, key generation, verification (partman.c:1281-1360, msg.pm.en:115-121). msg.pm.en:68-71: "To use RAID, LVM, or CGD: 1) Create partitions with the appropriate type; 2) Create RAID/LVM VG/CGD using these partitions; 3) Save changes; 4) Create partitions for RAID/CGD ..." partman.c:1456-1497 pm_cgd_commit(): runs cgdconfig -g -V -i -k -o /tmp/cgd.N.conf then cgdconfig -V re-enter cgdN /tmp/cgd.N.conf i.e. it configures cgd inside the running installer. util.c:2468 have_cgd = binary_available("cgdconfig") Correction, 2026-11-06 (measured on an installed system, see the end of this file): the post-install config menu has an entry "m: Enable cgd (cryptographic disk configuration)", shown as YES (configmenu.c, two "cgd" hits, not read line by line). So the statement below that nothing enables cgd at boot is too strong: the config menu can. What is still true is that no code writes /etc/cgd/cgd.conf for a cgd volume created by the partition manager. What was NOT found (grep over *.c, *.h, menus.*, msg.*.en): - no match for 'etc/cgd', 'cgd=YES' or 'cgd.conf': nothing copies the cgd configuration into the target (add_rc_conf exists, util.c:2017, and is used for random_file, util.c:1618; the config menu sets rc.conf variables through its own table, configmenu.c); - no handling of an encrypted root: for RAID there is `raidctl -A root` (partman.c:2738-2751); there is no equivalent for cgd. => As the tree stands, sysinst can create and use a cgd volume during the installation, and the installed system would not know how to unlock it at boot. This agrees with the wiki page saved in cgdroot-guide.txt, which says the encrypted root is not supported by sysinst. Not yet read (to be read before designing the fork) --------------------------------------------------- - how the target /etc/fstab is written for a cgd device (partman.c:2641 and the commit path); - the cgdroot machinery of the tree: distrib/amd64/kmod-cgdroot, distrib/common/cgdroot.rc, list.cgdroot, mtree.cgdroot, and the loader's NAME= handling in sys/arch/i386/stand/lib/biosdisk.c; - whether sysinst offers the CD to be changed during an installation (multi-CD, GOAL.md). Measured: the installation flow on amd64/BIOS, 2026-11-06 -------------------------------------------------------- Driven by hand through tools/vmsh.sh on the CD built by `make iso' (log: build/logs/install-simple-bios-phase1-2026-11-06.log, console, 100662 bytes). The screens, in order, as the console printed them: 1. Terminal type (ENTER = vt220) 2. language menu (a: English) 3. main menu: "NetBSD-11.99.9 Install System" a: Install NetBSD to hard disk 4. "Shall we continue?" (Yes/No) 5. [Makronix] "Select the installation mode": a: Simple (recommended), b: Advanced, x: Abandon installation 6. "Available disks": a: wd0, b: Extended partitioning, x: Exit 7. [upstream, still asked in simple mode in that build] BIOS geometry: "a: This is the correct geometry" 8. "Ok, we are now ready to install NetBSD on your hard disk (wd0). ... last chance" Shall we continue? 9. newfs of dk0, then "Bootblocks selection" (a: BIOS console ... x: Continue; the default b: serial port com0 was the console in use) 10. "Install from": a: CD-ROM / DVD / install image media, b: HTTPS ... ("Sets selected 20") 11. extraction (kernel, modules, base, etc, comp, ... makronix); a notice that base32 is optional and not on the medium ("Hit enter to continue") 12. "extraction ... is complete" (Hit enter), then the root password prompt ("New password:", empty line accepted), then the entropy menu 13. config menu a..r (network, timezone, date, root shell, root password, binary packages, pkgsrc, sshd, ntpd, ..., xdm, cgd, lvm, raidframe, add a user, entropy, shell), x: Finished configuring 14. "The installation of NetBSD-11.99.9 is now complete" (Hit enter), main menu, d: Reboot the computer Second boot (disk only, qemu -no-reboot restarted without the CD): login: in 38 seconds (build/logs/install-simple-bios-phase2-login-2026-11-06.log). As root: /etc/mtree/set.makronix 1814864 bytes /usr/pkg/bin 51 entries; /usr/pkg/dt/bin has Xsession, dsdm, dtaction, ... /dev/dk0 17G root; gpt show wd0: PMBR, GPT, 18G FFS (index 1), 2G swap (2) Menu keys: a letter only selects, RETURN activates. Added 2026-11-06 (Makronix fork, measured) ------------------------------------------ Welcome screen: main.c, after init_lang(): msg_fmt_display(MSG_welcome, "%s", REL) and the menu `welcome` (menus.mi, one OK entry). Text in the five languages (msg.mi.*: welcome, welcome_ok). Seen on the CD under xterm-256color: "Welcome to the Makronix 11.99.9 installation", description, "Thank you for choosing Makronix.", "Press OK to continue." (build/logs/colours-xterm-2026-11-06.log). Colours: three pairs (util.c do_coloring, menuc patch 0009). Under xterm-256color sysinst sends OSC 4 for colour 4 (68/6E/82, slate), 6 (FF/FF/FF) and 7 (C5/B1/A8, window colour) -- same log. Install tests after both changes: install-simple.sh, install-cgd.sh -f bios and -f uefi, all exit 0 (build/logs/*-col3-2026-11-06.out). Not seen: the colours drawn on a screen (the log shows the escape sequences, not the pixels), and the translations.