Fix i586 compatibility and remove swap (it doesn't work with our stripped kernel anyway and isn't really needed), RollingGirl-SE version, installer script refinements

This commit is contained in:
markmental 2026-09-11 13:15:55 -04:00
commit 674592d883
4 changed files with 46 additions and 53 deletions

View file

@ -18,7 +18,7 @@ same CD carries a built-in hard disk installer (`mentalnet-install`).
| Component | Requirement | | Component | Requirement |
|-------------|----------------------------------------------------------| |-------------|----------------------------------------------------------|
| CPU | i586 (generic Pentium) or any newer x86 | | CPU | i586 (Pentium / Pentium MMX) or any newer x86; `uname -m` reports `i586` |
| RAM | 128 MB minimum (64 MB usually works) | | RAM | 128 MB minimum (64 MB usually works) |
| CD drive | IDE/ATAPI CD-ROM (PIIX-era ATA controller) | | CD drive | IDE/ATAPI CD-ROM (PIIX-era ATA controller) |
| Display | VGA text console, PS/2 keyboard/mouse | | Display | VGA text console, PS/2 keyboard/mouse |
@ -28,7 +28,7 @@ same CD carries a built-in hard disk installer (`mentalnet-install`).
### Installing to a hard disk ### Installing to a hard disk
- IDE/ATA disk with at least **400 MB** free (the whole disk is wiped) - IDE/ATA disk with at least **1 GiB** free (the whole disk is wiped)
- The machine must be able to boot from CD (El Torito, BIOS boot) - The machine must be able to boot from CD (El Torito, BIOS boot)
--- ---
@ -167,7 +167,7 @@ Log in and run `mentalnet-install`:
``` ```
Disk to install to (e.g. sda): sda Disk to install to (e.g. sda): sda
Type YES to continue: YES Type YES to continue: YES
Create a swap partition? [y/N]: y Proceed with installation? [y/N]: y
``` ```
When it prints `Installation complete!`: When it prints `Installation complete!`:
@ -208,13 +208,15 @@ config) should show `EXT4-fs (sda1): mounted ... r/w` and
- **Disk to install to** — e.g. `sda` (the installer lists - **Disk to install to** — e.g. `sda` (the installer lists
detected disks with their sizes first) detected disks with their sizes first)
- **Type YES** — destroys everything on that disk - **Type YES** — destroys everything on that disk
- **Create a swap partition? [y/N]** — recommended on machines - the new partition table is then shown — sanity-check the disk
with little RAM; the swap is sized at 2x RAM, capped at 512 MB size before continuing
- **Proceed with installation? [y/N]** — final confirmation before
anything is written to the disk
5. The installer then: 5. The installer then:
- writes a fresh MBR partition table (root partition starts at - writes a fresh MBR partition table (root partition starts at
sector 2048, leaving room for the GRUB core image) sector 2048, leaving room for the GRUB core image)
- creates an ext4 filesystem labelled `rootfs` (+ swap if chosen) - creates an ext4 filesystem labelled `rootfs`
- copies the whole system from the CD - copies the whole system from the CD
- generates `/etc/fstab` - generates `/etc/fstab`
- installs GRUB to the MBR and writes the boot menu - installs GRUB to the MBR and writes the boot menu
@ -251,12 +253,13 @@ The installed GRUB menu has a 5s timeout and boots automatically.
|---------|--------------------| |---------|--------------------|
| **How to tell which build a VM is actually running** | At the login prompt the build stamp is printed (`Mentalnet GNU/Linux build YYYYMMDD-HHMMSS`); inside the guest check `cat /etc/os-release` (`BUILD_ID=`) or `cat /proc/version`. Useful kernel build markers: `#3 ... 18:45:02` predates the rtl8139 fix, `#4 ... 20:24:17` is the first build with 8139cp. | | **How to tell which build a VM is actually running** | At the login prompt the build stamp is printed (`Mentalnet GNU/Linux build YYYYMMDD-HHMMSS`); inside the guest check `cat /etc/os-release` (`BUILD_ID=`) or `cat /proc/version`. Useful kernel build markers: `#3 ... 18:45:02` predates the rtl8139 fix, `#4 ... 20:24:17` is the first build with 8139cp. |
| **Booting the CD runs an older install instead of the live system** | Fixed: the live CD's GRUB core hardcodes `root=(cd)` (the El Torito boot CD itself), so the boot chain never touches any attached disk and an existing Mentalnet install can no longer hijack it. On builds older than this fix, the CD's GRUB searched for `/boot/bzImage` (or a marker file), and since BIOS enumerates disks before the CD, the search landed on the installed system first. | | **Booting the CD runs an older install instead of the live system** | Fixed: the live CD's GRUB core hardcodes `root=(cd)` (the El Torito boot CD itself), so the boot chain never touches any attached disk and an existing Mentalnet install can no longer hijack it. On builds older than this fix, the CD's GRUB searched for `/boot/bzImage` (or a marker file), and since BIOS enumerates disks before the CD, the search landed on the installed system first. |
| **Boots on Pentium Pro/i686 but hangs at kernel start on Pentium/Pentium MMX (i586)** | Fixed: the kernel is now built for `CONFIG_M586` with `CONFIG_X86_GENERIC` (no CMOV instructions). Builds before this fix used `i386_defconfig`'s `CONFIG_M686` default, which emits CMOV - instant invalid-opcode crash on real i586 CPUs. |
| **Proxmox: VM boots an older build despite uploading a new ISO** | Proxmox keeps every upload as a separate storage volume, and a VM's CD/DVD drive points at a specific **volume** — renaming or re-uploading a file never updates an existing drive (checksums of the new file do not help either). Delete the stale volume, upload the unique-named ISO from the build log, attach it in Hardware, and check Boot Order (an installed disk can also shadow the CD). | | **Proxmox: VM boots an older build despite uploading a new ISO** | Proxmox keeps every upload as a separate storage volume, and a VM's CD/DVD drive points at a specific **volume** — renaming or re-uploading a file never updates an existing drive (checksums of the new file do not help either). Delete the stale volume, upload the unique-named ISO from the build log, attach it in Hardware, and check Boot Order (an installed disk can also shadow the CD). |
| GRUB menu does not appear, or the machine reboots before booting, in QEMU | Try more RAM (`-m 256`). Memory pressure during development was the culprit more than once. | | GRUB menu does not appear, or the machine reboots before booting, in QEMU | Try more RAM (`-m 256`). Memory pressure during development was the culprit more than once. |
| Kernel panic: `Unable to mount root fs` | The CD drive is on an unsupported controller. The kernel targets PIIX-era IDE/ATA; modern SATA-only setups are out of scope. | | Kernel panic: `Unable to mount root fs` | The CD drive is on an unsupported controller. The kernel targets PIIX-era IDE/ATA; modern SATA-only setups are out of scope. |
| `Remounting root filesystem read-write ... failed` on live boot | Cosmetic. The CD root is read-only by design; all writes go to tmpfs. | | `Remounting root filesystem read-write ... failed` on live boot | Cosmetic. The CD root is read-only by design; all writes go to tmpfs. |
| Installer: `/dev/sdX1 did not appear after partitioning` | The kernel was still re-reading the partition table. Simply run the installer again. | | Installer: `/dev/sdX1 did not appear after partitioning` | The kernel was still re-reading the partition table. Simply run the installer again. |
| Installer: `disk is too small` | At least 400 MB is needed. | | Installer: `disk is too small` | At least 1 GiB is needed. |
| Forgot the password | It is `mnlinux` (set at build time in the Buildroot config). | | Forgot the password | It is `mnlinux` (set at build time in the Buildroot config). |
| No network | Check the NIC against the supported list in section 1. QEMU/Proxmox: `rtl8139`, `virtio-net-pci`, `ne2k_pci` or the default e1000 all work. | | No network | Check the NIC against the supported list in section 1. QEMU/Proxmox: `rtl8139`, `virtio-net-pci`, `ne2k_pci` or the default e1000 all work. |

View file

@ -152,3 +152,10 @@ CONFIG_NFT_NAT=y
CONFIG_NFT_MASQ=y CONFIG_NFT_MASQ=y
CONFIG_NFT_REJECT=y CONFIG_NFT_REJECT=y
CONFIG_NFT_REJECT_INET=y CONFIG_NFT_REJECT_INET=y
# --- CPU family: true i586 (Pentium/MMX) support ---
# i386_defconfig targets M686 (Pentium Pro), which emits CMOV and hangs
# real i586 machines. M586 + GENERIC keeps compatibility with 586 and up.
CONFIG_M586=y
# CONFIG_M686 is not set
CONFIG_X86_GENERIC=y

View file

@ -5,11 +5,12 @@
# Run as root on the live system: mentalnet-install # Run as root on the live system: mentalnet-install
# #
# The installed system boots from its own MBR (GRUB) with the root # The installed system boots from its own MBR (GRUB) with the root
# filesystem on a single ext4 partition (plus optional swap). # filesystem on a single ext4 partition.
set -u set -u
MIN_DISK_SECTORS=819200 # 400 MiB minimum target disk MIN_DISK_SECTORS=2097152 # 1 GiB minimum target disk (rootfs is ~150MB,
# and old disks are cheap)
BOOT_START_SECTORS=2048 # first sector of root: leaves the MBR gap BOOT_START_SECTORS=2048 # first sector of root: leaves the MBR gap
# free for the GRUB core.img embedding # free for the GRUB core.img embedding
MNT=/mnt/hd MNT=/mnt/hd
@ -28,7 +29,7 @@ trap cleanup EXIT
[ "$(id -u)" -eq 0 ] || die "please run as root" [ "$(id -u)" -eq 0 ] || die "please run as root"
for t in fdisk mkfs.ext4 mkswap grub-install; do for t in fdisk mkfs.ext4 grub-install; do
command -v "$t" >/dev/null 2>&1 || die "required tool '$t' not found" command -v "$t" >/dev/null 2>&1 || die "required tool '$t' not found"
done done
@ -88,39 +89,12 @@ printf ' Type YES to continue: '
read -r ANSWER read -r ANSWER
[ "${ANSWER:-}" = "YES" ] || { msg "Aborted."; exit 0; } [ "${ANSWER:-}" = "YES" ] || { msg "Aborted."; exit 0; }
# --- swap? ---------------------------------------------------------------
printf ' Create a swap partition? [y/N]: '
read -r SWAPANS
SWAP=0
case "${SWAPANS:-}" in
y|Y|yes|Yes|YES) SWAP=1 ;;
esac
SWAP_SECTORS=0
if [ "$SWAP" -eq 1 ]; then
MEM_KB=$(awk '/^MemTotal:/{print $2}' /proc/meminfo)
SWAP_MIB=$((MEM_KB / 1024 * 2))
[ "$SWAP_MIB" -gt 512 ] && SWAP_MIB=512
[ "$SWAP_MIB" -lt 32 ] && SWAP_MIB=32
SWAP_SECTORS=$((SWAP_MIB * 2048))
msg " Swap partition: ${SWAP_MIB} MiB"
fi
# --- partition ----------------------------------------------------------- # --- partition -----------------------------------------------------------
msg " Partitioning $DEV (MBR, root at sector $BOOT_START_SECTORS) ..." msg " Partitioning $DEV (MBR, root at sector $BOOT_START_SECTORS) ..."
if [ "$SWAP" -eq 1 ]; then printf 'o\nn\np\n1\n%d\n%d\na\n1\nw\n' \
P1_END=$((SIZE - SWAP_SECTORS - 1)) "$BOOT_START_SECTORS" "$((SIZE - 1))" \
P2_START=$((SIZE - SWAP_SECTORS)) | fdisk -u "$DEV" >/dev/null || die "fdisk failed"
printf 'o\nn\np\n1\n%d\n%d\nn\np\n2\n%d\n%d\nt\n2\n82\na\n1\nw\n' \
"$BOOT_START_SECTORS" "$P1_END" \
"$P2_START" "$((SIZE - 1))" \
| fdisk -u "$DEV" >/dev/null || die "fdisk failed"
else
printf 'o\nn\np\n1\n%d\n%d\na\nw\n' \
"$BOOT_START_SECTORS" "$((SIZE - 1))" \
| fdisk -u "$DEV" >/dev/null || die "fdisk failed"
fi
ROOTPART="${DEV}1" ROOTPART="${DEV}1"
i=0 i=0
@ -131,15 +105,22 @@ while [ ! -b "$ROOTPART" ] && [ "$i" -lt 10 ]; do
done done
[ -b "$ROOTPART" ] || die "$ROOTPART did not appear after partitioning" [ -b "$ROOTPART" ] || die "$ROOTPART did not appear after partitioning"
# --- show the result and get final confirmation --------------------------
msg ""
msg " New partition table on $DEV:"
fdisk -l "$DEV"
msg ""
printf ' Proceed with installation? [y/N]: '
read -r GO
case "${GO:-}" in
y|Y|yes|Yes|YES) ;;
*) msg "Aborted."; exit 0 ;;
esac
# --- filesystems --------------------------------------------------------- # --- filesystems ---------------------------------------------------------
msg " Creating ext4 filesystem on $ROOTPART ..." msg " Creating ext4 filesystem on $ROOTPART ..."
mkfs.ext4 -F -L rootfs "$ROOTPART" >/dev/null || die "mkfs.ext4 failed" mkfs.ext4 -F -L rootfs "$ROOTPART" >/dev/null || die "mkfs.ext4 failed"
if [ "$SWAP" -eq 1 ]; then
msg " Creating swap on ${DEV}2 ..."
mkswap "${DEV}2" >/dev/null || die "mkswap failed"
fi
# --- copy the live system ------------------------------------------------ # --- copy the live system ------------------------------------------------
# /mnt lives on the read-only CD, so put a writable tmpfs over it to # /mnt lives on the read-only CD, so put a writable tmpfs over it to
# get a usable mount point # get a usable mount point
@ -166,6 +147,11 @@ done
# mount points that live in tmpfs on the CD # mount points that live in tmpfs on the CD
mkdir -p "$MNT/proc" "$MNT/sys" "$MNT/dev" "$MNT/tmp" "$MNT/run" "$MNT/mnt" mkdir -p "$MNT/proc" "$MNT/sys" "$MNT/dev" "$MNT/tmp" "$MNT/run" "$MNT/mnt"
# the live system's resolv.conf is a symlink into tmpfs (udhcpc writes
# through it on the CD); on the disk udhcpc needs a real file
rm -f "$MNT/etc/resolv.conf"
: > "$MNT/etc/resolv.conf"
# CD-only artifacts must not end up on the disk # CD-only artifacts must not end up on the disk
rm -f "$MNT/boot/grub/grub-eltorito.img" rm -f "$MNT/boot/grub/grub-eltorito.img"
@ -181,9 +167,6 @@ tmpfs /tmp tmpfs mode=1777 0 0
tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0 tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
sysfs /sys sysfs defaults 0 0 sysfs /sys sysfs defaults 0 0
EOF EOF
if [ "$SWAP" -eq 1 ]; then
printf '%s none swap sw 0 0\n' "${DEV}2" >> "$MNT/etc/fstab"
fi
# --- bootloader ---------------------------------------------------------- # --- bootloader ----------------------------------------------------------
msg " Writing bootloader configuration ..." msg " Writing bootloader configuration ..."
@ -205,7 +188,6 @@ msg " Installation complete!"
msg " ============================================================" msg " ============================================================"
msg "" msg ""
msg " Root partition : $ROOTPART (ext4)" msg " Root partition : $ROOTPART (ext4)"
[ "$SWAP" -eq 1 ] && msg " Swap : ${DEV}2 (${SWAP_MIB} MiB)"
msg " Login : root / mnlinux" msg " Login : root / mnlinux"
msg "" msg ""
msg " Remove the CD and reboot: poweroff" msg " Remove the CD and reboot: poweroff"

View file

@ -14,7 +14,8 @@
set -e set -e
TARGET_DIR="${1}" TARGET_DIR="${1}"
STAMP="$(date +%Y%m%d-%H%M%S)" #STAMP="$(date +%Y%m%d-%H%M%S)"
STAMP='R1 "RollingGirl-SE"'
IMAGES_DIR="$(dirname "${TARGET_DIR}")/images" IMAGES_DIR="$(dirname "${TARGET_DIR}")/images"
# record the stamp for post-image.sh # record the stamp for post-image.sh
@ -26,10 +27,10 @@ echo "${STAMP}" > "${IMAGES_DIR}/.mn-build-stamp"
OS_RELEASE="${TARGET_DIR}/usr/lib/os-release" OS_RELEASE="${TARGET_DIR}/usr/lib/os-release"
cat > "${OS_RELEASE}" <<EOF cat > "${OS_RELEASE}" <<EOF
NAME="Mentalnet GNU/Linux" NAME="Mentalnet GNU/Linux"
VERSION="0.1 (intel32, build ${STAMP})" VERSION="(build ${STAMP})"
ID=mentalnet ID=mentalnet
VERSION_ID="0.1" VERSION_ID="R1"
PRETTY_NAME="Mentalnet GNU/Linux intel32 0.1 (build ${STAMP})" PRETTY_NAME="Mentalnet GNU/Linux (build ${STAMP})"
BUILD_ID="${STAMP}" BUILD_ID="${STAMP}"
EOF EOF