diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1a9f491 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +dist/* + +.gitignore +LICENSE +README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..849ddff --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +dist/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7743924 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +FROM rastasheep/ubuntu-sshd:18.04 + +# Buildroot version to use +ARG BUILD_ROOT_RELEASE=2018.02 +# Root password for SSH +ARG ROOT_PASSWORD=browser-vm + +# Copy v86 buildroot board config into image. +# NOTE: if you want to override this later to play with +# the config (e.g., run `make menuconfig`), mount a volume: +# docker run ... -v $PWD/buildroot-v86:/buildroot-v86 ... +COPY ./buildroot-v86 /buildroot-v86 + +# Setup SSH (for Windows users) and prepare apt-get +RUN echo 'root:${ROOT_PASSWORD}' | chpasswd; \ + # Install all Buildroot deps + sed -i 's|deb http://us.archive.ubuntu.com/ubuntu/|deb mirror://mirrors.ubuntu.com/mirrors.txt|g' /etc/apt/sources.list; \ + dpkg --add-architecture i386; \ + rm -rf /var/lib/apt/lists/*; \ + apt-get -q update; + +# Install all Buildroot deps and prepare buildroot +WORKDIR /root +RUN apt-get -q -y install \ + bc \ + build-essential \ + bzr \ + cpio \ + cvs \ + git \ + unzip \ + wget \ + libc6:i386 \ + libncurses5-dev \ + libssl-dev \ + rsync; \ + wget -c http://buildroot.org/downloads/buildroot-${BUILD_ROOT_RELEASE}.tar.gz; \ + tar axf buildroot-${BUILD_ROOT_RELEASE}.tar.gz; + +# configure the locales +ENV LANG='C' \ + LANGUAGE='en_US:en' \ + LC_ALL='C' \ + NOTVISIBLE="in users profile" \ + TERM=xterm + +# Buildroot will place built artifacts here at the end. +VOLUME /build + +WORKDIR /root/buildroot-${BUILD_ROOT_RELEASE} +ENTRYPOINT ["/buildroot-v86/build-v86.sh"] diff --git a/LICENSE b/LICENSE index 95559e6..c000e84 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 David Humphrey +Copyright (c) 2018-2019 David Humphrey Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index cfcaf57..351f843 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,200 @@ -# browser-vm -A small Linux x86 VM meant for use in the browser +# Browser VM + +A custom [Buildroot](https://buildroot.org/) config for a Linux x86 VM, meant to +be run in the browser. The resulting Linux ISO is meant to be run under +emulation in the browser via [v86](https://github.com/copy/v86), and includes: + +* a custom Linux 4.15 kernel, which strips out many unnecessary drivers, modules, etc. and adds [Plan 9 filesystem](https://www.kernel.org/doc/Documentation/filesystems/9p.txt) sharing +* a root filesystem and Unix commands via [BusyBox](https://busybox.net/) +* an ISO-based bootloader (i.e., we create a "DVD" that is booted by v86) + +Following the [Buildroot customization docs](https://buildroot.org/downloads/manual/manual.html#customize) +we create a folder `buildroot-v86/` with all the necessary config files, +filesystem overlay, and scripts necessary to build our distribution. + +## Running via Docker + +To build the Docker image: + +```bash +$ docker build -t buildroot . +``` + +And then to run the build: + +```bash +$ docker run \ + --rm \ + --name build-v86 \ + -v $PWD/dist:/build \ + -v $PWD/buildroot-v86/:/buildroot-v86 \ + buildroot +``` + +NOTE: we define two [volumes](https://docs.docker.com/engine/reference/builder/#volume) to +allow the container to access the v86 config, and also to write the ISO once complete. In the +above I've used `$PWD`, but you can use any absolute path. + +When the build completes, an ISO file will be places in `./dist/v86-linux.iso` +in your source tree (i.e., outside the container). + +If you need to re-configure things, instead of just running the build, do the following: + +```bash +$ docker run \ + --rm \ + --name build-v86 \ + -v $PWD/dist:/build \ + -v $PWD/buildroot-v86/:/buildroot-v86 \ + -ti \ + --entrypoint "bash" \ + buildroot +``` + +Now in the resulting bash terminal, you can run `make menuconfig` and [other make commands](https://buildroot.org/downloads/manual/manual.html#make-tips). + +## `buildroot-v86/` Layout + +We define a `v86` buildroot "board" via the following files and directories: + +``` ++-- board/ + +-- v86 + +-- linux.config # our custom Linux kernel config (make linux-menuconfig) + +-- post_build.sh # script to copy ISO file out of docker container + +-- rootfs_overlay/ # overrides for files in the root filesystem + +-- etc/ + +-- inittab # we setup a ttyS0 console terminal to auto-login + +-- fstab # we auto-mount the Plan 9 Filer filesystem to /mnt + +-- configs/ + +-- v86_defconfig # our custom buildroot config (make menuconfig) + +-- Config.in # empty, but required https://buildroot.org/downloads/manual/manual.html#outside-br-custom + +-- external.mk # empty, but required https://buildroot.org/downloads/manual/manual.html#outside-br-custom + +-- external.desc # our v86 board config for make + +-- build-v86.sh # entrypoint for Docker to run our build +``` + +If you need or want to update these config files, do the following: + +```bash +$ make BR2_EXTERNAL=/buildroot-v86 v86_defconfig +$ make menuconfig +... +$ make savedefconfig +$ make linux-menuconfig +... +$ make linux-savedefconfig +``` + +## Configuration Notes + +These are the options I set when configuring buildroot for v86. I'm only +specifying the things I set. + +```bash +$ cd buildroot-2018.02 +$ make menucofing +``` + +Then follow these config steps in the buildroot config menu (NOTE: these docs +may have drifted from the actual config in the source, so consult that first): + +### Target options + +* Target Architecture: i386 +* Target Architecture Variant: pentium mobile (Pentium with MMX, SSE) + +### Build options + +* Enable compiler cache (not strictly necessary, but helps with rebuilds) + +### Toolchain + +* C library: uLibc-ng (I'd like to experiment with musl too) + +### System configuration + +* remount root filesystem read-write during boot (I think this is unnecessary) +* Root filesystem overlay directories: /build/overlay-fs (for etc/inittab) + +### Kernel + +* Linux Kernel: true +* Defconfig name: i386 +* Kernel binary format: bzImage (vmlinux seemed to break on boot) + +### Target packages + +Need to figure this out. I tried adding imagemagik, git, uemacs, but they +are all adding too much size to the image. + +### Filesystem images + +* cpio the root filesystem (for use as an initial RAM filesystem) +* initial RAM filesystem linked into the linux kernel (not sure I need this, trying without...) +* iso image + * Use initrd +* tar the root filesystem Compression method (no compression) + +### Bootloaders + +* syslinux + * install isolinux + +## Linux configuration + +Now configure the Linux Kernel: + +``` +$ make linux-menuconfig +``` + +And set the following options to accomplish this: + +``` +CONFIG_NET_9P=y +CONFIG_NET_9P_VIRTIO=y +CONFIG_9P_FS=y +CONFIG_9P_FS_POSIX_ACL=y +CONFIG_PCI=y +CONFIG_VIRTIO_PCI=y +CONFIG_PCI=y +CONFIG_VIRTIO_PCI=y +``` + +# Processor type and features + +* Processor family (Pentium-Pro) also tried Pentium M before. + +# Bus options (PCI, etc.) + +* PCI Debugging: true (I want to see what's happening with PCI errors, normally not needed) + +# Networking support + +* Plan 9 Resource Sharing Support (9P2000) (built into kernel * vs. M) + * 9P Virtio Transport (* - make this is on, it won't exist if virtio is off) + * Debug information (* - optional) + +# Device Drivers + +* Virtio drivers + * PCI driver for virtio devices (built into kernel * vs. M) + * Support for legacy virtio draft 0.9.X and older devices (New) + * Platform bus driver for memory mapped virtio devices (* vs. M) - not sure I need this... + * Memory mapped virtio devices parameter parsing - or this... + +# Filesystems + +* Caches + * General filesystem local caching manager (*) + * Filesystem caching on files (*) + +* Network File Systems + * Plan 9 Resource Sharing Support (9P2000) (*) + * Enable 9P client caching support + * 9P Posic Access Control Lists + +Now run `make` + +When it finishes, the built image is in `./output/images`. diff --git a/buildroot-v86/Config.in b/buildroot-v86/Config.in new file mode 100644 index 0000000..3903fe6 --- /dev/null +++ b/buildroot-v86/Config.in @@ -0,0 +1 @@ +source "$BR2_EXTERNAL_v86_PATH/package/nled/Config.in" diff --git a/buildroot-v86/board/v86/linux.config b/buildroot-v86/board/v86/linux.config new file mode 100644 index 0000000..50ddce8 --- /dev/null +++ b/buildroot-v86/board/v86/linux.config @@ -0,0 +1,263 @@ +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_AUDIT=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_BSD_PROCESS_ACCT=y +CONFIG_TASKSTATS=y +CONFIG_TASK_DELAY_ACCT=y +CONFIG_TASK_XACCT=y +CONFIG_TASK_IO_ACCOUNTING=y +CONFIG_LOG_BUF_SHIFT=18 +CONFIG_CGROUPS=y +CONFIG_CGROUP_SCHED=y +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_CPUACCT=y +CONFIG_NAMESPACES=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="${BR_BINARIES_DIR}/rootfs.cpio" +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +# CONFIG_PCSPKR_PLATFORM is not set +CONFIG_EMBEDDED=y +# CONFIG_COMPAT_BRK is not set +CONFIG_PROFILING=y +CONFIG_KPROBES=y +CONFIG_JUMP_LABEL=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_PARTITION_ADVANCED=y +CONFIG_OSF_PARTITION=y +CONFIG_AMIGA_PARTITION=y +CONFIG_MAC_PARTITION=y +CONFIG_BSD_DISKLABEL=y +CONFIG_MINIX_SUBPARTITION=y +CONFIG_SOLARIS_X86_PARTITION=y +CONFIG_UNIXWARE_DISKLABEL=y +CONFIG_SGI_PARTITION=y +CONFIG_SUN_PARTITION=y +CONFIG_KARMA_PARTITION=y +# CONFIG_X86_EXTENDED_PLATFORM is not set +CONFIG_M686=y +CONFIG_X86_GENERIC=y +CONFIG_HPET_TIMER=y +CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS=y +CONFIG_X86_REBOOTFIXUPS=y +CONFIG_MICROCODE_AMD=y +CONFIG_X86_MSR=y +CONFIG_X86_CPUID=y +CONFIG_HIGHPTE=y +CONFIG_X86_CHECK_BIOS_CORRUPTION=y +# CONFIG_MTRR_SANITIZER is not set +CONFIG_EFI=y +CONFIG_HZ_100=y +CONFIG_KEXEC=y +CONFIG_CRASH_DUMP=y +CONFIG_HIBERNATION=y +CONFIG_PM_DEBUG=y +CONFIG_PM_TRACE_RTC=y +CONFIG_ACPI_DOCK=y +CONFIG_ACPI_CONTAINER=y +CONFIG_CPU_FREQ=y +CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y +CONFIG_CPU_FREQ_GOV_PERFORMANCE=y +CONFIG_CPU_FREQ_GOV_ONDEMAND=y +CONFIG_X86_INTEL_PSTATE=y +CONFIG_X86_ACPI_CPUFREQ=y +CONFIG_PCIEPORTBUS=y +CONFIG_PCI_MSI=y +CONFIG_PCI_DEBUG=y +CONFIG_HOTPLUG_PCI=y +CONFIG_PCCARD=y +CONFIG_YENTA=y +CONFIG_BINFMT_MISC=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_XFRM_USER=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_MULTIPLE_TABLES=y +CONFIG_IP_ROUTE_MULTIPATH=y +CONFIG_IP_ROUTE_VERBOSE=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_RARP=y +CONFIG_IP_MROUTE=y +CONFIG_IP_PIMSM_V1=y +CONFIG_IP_PIMSM_V2=y +CONFIG_SYN_COOKIES=y +# CONFIG_INET_XFRM_MODE_TRANSPORT is not set +# CONFIG_INET_XFRM_MODE_TUNNEL is not set +# CONFIG_INET_XFRM_MODE_BEET is not set +# CONFIG_INET_DIAG is not set +CONFIG_TCP_CONG_ADVANCED=y +# CONFIG_TCP_CONG_BIC is not set +# CONFIG_TCP_CONG_WESTWOOD is not set +# CONFIG_TCP_CONG_HTCP is not set +CONFIG_TCP_MD5SIG=y +# CONFIG_IPV6 is not set +CONFIG_NETWORK_SECMARK=y +CONFIG_NET_SCHED=y +CONFIG_NET_EMATCH=y +CONFIG_NET_CLS_ACT=y +CONFIG_DNS_RESOLVER=y +# CONFIG_WIRELESS is not set +CONFIG_NET_9P=y +CONFIG_NET_9P_VIRTIO=y +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_DEBUG_DEVRES=y +CONFIG_CONNECTOR=y +# CONFIG_PNP_DEBUG_MESSAGES is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_SCSI_PROC_FS is not set +CONFIG_SCSI_SPI_ATTRS=y +# CONFIG_SCSI_LOWLEVEL is not set +CONFIG_ATA=y +# CONFIG_ATA_VERBOSE_ERROR is not set +CONFIG_SATA_AHCI=y +CONFIG_ATA_PIIX=y +CONFIG_PATA_AMD=y +CONFIG_PATA_OLDPIIX=y +CONFIG_PATA_SCH=y +CONFIG_PATA_MPIIX=y +CONFIG_ATA_GENERIC=y +CONFIG_NETDEVICES=y +CONFIG_NETCONSOLE=y +CONFIG_VIRTIO_NET=y +# CONFIG_ETHERNET is not set +CONFIG_PHYLIB=y +# CONFIG_WLAN is not set +CONFIG_INPUT_POLLDEV=y +CONFIG_INPUT_SPARSEKMAP=y +CONFIG_INPUT_EVDEV=y +CONFIG_INPUT_JOYSTICK=y +CONFIG_INPUT_TABLET=y +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_INPUT_MISC=y +# CONFIG_LEGACY_PTYS is not set +CONFIG_SERIAL_NONSTANDARD=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_NR_UARTS=32 +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_MANY_PORTS=y +CONFIG_SERIAL_8250_SHARE_IRQ=y +CONFIG_SERIAL_8250_DETECT_IRQ=y +CONFIG_SERIAL_8250_RSA=y +CONFIG_HW_RANDOM=y +CONFIG_NVRAM=y +CONFIG_HPET=y +# CONFIG_HPET_MMAP is not set +CONFIG_I2C_I801=y +CONFIG_PTP_1588_CLOCK=y +CONFIG_WATCHDOG=y +CONFIG_AGP=y +CONFIG_AGP_AMD64=y +CONFIG_AGP_INTEL=y +CONFIG_DRM=y +CONFIG_DRM_I915=y +CONFIG_FB_MODE_HELPERS=y +CONFIG_FB_TILEBLITTING=y +CONFIG_FB_EFI=y +# CONFIG_LCD_CLASS_DEVICE is not set +CONFIG_VGACON_SOFT_SCROLLBACK=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_LOGO=y +# CONFIG_LOGO_LINUX_MONO is not set +# CONFIG_LOGO_LINUX_VGA16 is not set +CONFIG_HIDRAW=y +CONFIG_HID_A4TECH=y +CONFIG_HID_APPLE=y +CONFIG_HID_BELKIN=y +CONFIG_HID_CHERRY=y +CONFIG_HID_CHICONY=y +CONFIG_HID_CYPRESS=y +CONFIG_HID_EZKEY=y +CONFIG_HID_GYRATION=y +CONFIG_HID_ITE=y +CONFIG_HID_KENSINGTON=y +CONFIG_HID_LOGITECH=y +CONFIG_LOGITECH_FF=y +CONFIG_HID_MICROSOFT=y +CONFIG_HID_MONTEREY=y +CONFIG_HID_PANTHERLORD=y +CONFIG_PANTHERLORD_FF=y +CONFIG_HID_PETALYNX=y +CONFIG_HID_SAMSUNG=y +CONFIG_HID_SUNPLUS=y +CONFIG_HID_TOPSEED=y +# CONFIG_USB_SUPPORT is not set +CONFIG_NEW_LEDS=y +CONFIG_LEDS_CLASS=y +CONFIG_LEDS_TRIGGERS=y +CONFIG_EDAC=y +CONFIG_RTC_CLASS=y +# CONFIG_RTC_HCTOSYS is not set +CONFIG_DMADEVICES=y +CONFIG_VIRTIO_PCI=y +CONFIG_VIRTIO_MMIO=y +CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y +# CONFIG_X86_PLATFORM_DEVICES is not set +CONFIG_DAX=y +CONFIG_EFI_VARS=y +CONFIG_AUTOFS4_FS=y +CONFIG_FSCACHE=y +CONFIG_CACHEFILES=y +CONFIG_ISO9660_FS=y +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +# CONFIG_PROC_VMCORE is not set +CONFIG_TMPFS_POSIX_ACL=y +# CONFIG_MISC_FILESYSTEMS is not set +CONFIG_9P_FS=y +CONFIG_9P_FSCACHE=y +CONFIG_9P_FS_POSIX_ACL=y +CONFIG_NLS_DEFAULT="utf8" +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ASCII=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS_UTF8=y +CONFIG_PRINTK_TIME=y +# CONFIG_ENABLE_WARN_DEPRECATED is not set +# CONFIG_UNUSED_SYMBOLS is not set +CONFIG_MAGIC_SYSRQ=y +CONFIG_DEBUG_STACK_USAGE=y +CONFIG_DEBUG_STACKOVERFLOW=y +# CONFIG_SCHED_DEBUG is not set +CONFIG_SCHEDSTATS=y +CONFIG_RCU_TRACE=y +CONFIG_BLK_DEV_IO_TRACE=y +CONFIG_PROVIDE_OHCI1394_DMA_INIT=y +CONFIG_EARLY_PRINTK_DBGP=y +CONFIG_DEBUG_BOOT_PARAMS=y +CONFIG_OPTIMIZE_INLINING=y +CONFIG_KEYS=y +CONFIG_SECURITY=y +CONFIG_SECURITY_NETWORK=y +CONFIG_CRYPTO_RSA=y +CONFIG_CRYPTO_AUTHENC=y +CONFIG_CRYPTO_CCM=y +CONFIG_CRYPTO_GCM=y +CONFIG_CRYPTO_ECHAINIV=y +CONFIG_CRYPTO_CBC=y +CONFIG_CRYPTO_CMAC=y +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_SHA1=y +CONFIG_CRYPTO_AES_586=y +CONFIG_CRYPTO_ARC4=y +CONFIG_CRYPTO_DES=y +CONFIG_ASYMMETRIC_KEY_TYPE=y +CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y +CONFIG_X509_CERTIFICATE_PARSER=y +CONFIG_PKCS7_MESSAGE_PARSER=y +CONFIG_SYSTEM_TRUSTED_KEYRING=y +# CONFIG_VIRTUALIZATION is not set +CONFIG_CRC_CCITT=y +CONFIG_CRC16=y diff --git a/buildroot-v86/board/v86/post-image.sh b/buildroot-v86/board/v86/post-image.sh new file mode 100755 index 0000000..336dc9a --- /dev/null +++ b/buildroot-v86/board/v86/post-image.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# Run after buildroot has built the image, and path to the built +# output/image dir is passed as first arg. We copy the built ISO +# out of the container. +cp ${BINARIES_DIR}/rootfs.iso9660 /build/v86-linux.iso +echo "Created v86-linux.iso." + +# Prepare license info. Start with Seabios, then buildroot's +wget https://raw.githubusercontent.com/coreboot/seabios/master/COPYING.LESSER \ + -O ${BASE_DIR}/SeaBIOS_COPYING.LESSER +tar czvf /build/licenses.tar.gz \ + ${BASE_DIR}/SeaBIOS_COPYING.LESSER \ + ${BASE_DIR}/legal-info/buildroot.config \ + ${BASE_DIR}/legal-info/host-licenses \ + ${BASE_DIR}/legal-info/licenses +echo "Created licenses.tar.gz" diff --git a/buildroot-v86/board/v86/rootfs_overlay/etc/fstab b/buildroot-v86/board/v86/rootfs_overlay/etc/fstab new file mode 100644 index 0000000..64c40b1 --- /dev/null +++ b/buildroot-v86/board/v86/rootfs_overlay/etc/fstab @@ -0,0 +1,10 @@ +# +/dev/root / ext2 rw,noauto 0 1 +proc /proc proc defaults 0 0 +devpts /dev/pts devpts defaults,gid=5,mode=620,ptmxmode=0666 0 0 +tmpfs /dev/shm tmpfs mode=0777 0 0 +tmpfs /tmp tmpfs mode=1777 0 0 +tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0 +sysfs /sys sysfs defaults 0 0 +# Plan 9 Filer/IndexedDB browser filesystem on /mount +host9p /mnt 9p trans=virtio,version=9p2000.L,rw 0 0 diff --git a/buildroot-v86/board/v86/rootfs_overlay/etc/inittab b/buildroot-v86/board/v86/rootfs_overlay/etc/inittab new file mode 100644 index 0000000..2aef431 --- /dev/null +++ b/buildroot-v86/board/v86/rootfs_overlay/etc/inittab @@ -0,0 +1,40 @@ +# XXX: updated to add ttyS0 terminal and autologin. +# +# /etc/inittab +# +# Copyright (C) 2001 Erik Andersen +# +# Note: BusyBox init doesn't support runlevels. The runlevels field is +# completely ignored by BusyBox init. If you want runlevels, use +# sysvinit. +# +# Format for each entry: ::: +# +# id == tty to run on, or empty for /dev/console +# runlevels == ignored +# action == one of sysinit, respawn, askfirst, wait, and once +# process == program to run + +# Startup the system +::sysinit:/bin/mount -t proc proc /proc +::sysinit:/bin/mount -o remount,rw / +::sysinit:/bin/mkdir -p /dev/pts +::sysinit:/bin/mkdir -p /dev/shm +::sysinit:/bin/mount -a +::sysinit:/bin/hostname -F /etc/hostname +# now run any rc scripts +::sysinit:/etc/init.d/rcS + +# Put a getty on the serial port +console::respawn:/sbin/getty -L console 0 vt100 # GENERIC_SERIAL + +# Auto-login as root on ttyS0 +::respawn:/sbin/getty ttyS0 38400 xterm -n -l /bin/sh + +# Stuff to do for the 3-finger salute +#::ctrlaltdel:/sbin/reboot + +# Stuff to do before rebooting +::shutdown:/etc/init.d/rcK +::shutdown:/sbin/swapoff -a +::shutdown:/bin/umount -a -r diff --git a/buildroot-v86/build-v86.sh b/buildroot-v86/build-v86.sh new file mode 100755 index 0000000..b263ae9 --- /dev/null +++ b/buildroot-v86/build-v86.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +# Build our v86 defconfig along with license files. +echo $PWD +make BR2_EXTERNAL=/buildroot-v86 v86_defconfig \ + && make legal-info \ + && make diff --git a/buildroot-v86/configs/v86_defconfig b/buildroot-v86/configs/v86_defconfig new file mode 100644 index 0000000..5c9ff62 --- /dev/null +++ b/buildroot-v86/configs/v86_defconfig @@ -0,0 +1,15 @@ +BR2_x86_pentiumpro=y +BR2_CCACHE=y +BR2_KERNEL_HEADERS_4_15=y +BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_v86_PATH)/board/v86/rootfs_overlay/" +BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_v86_PATH)/board/v86/post-image.sh" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_v86_PATH)/board/v86/linux.config" +BR2_TARGET_ROOTFS_INITRAMFS=y +BR2_TARGET_ROOTFS_ISO9660=y +BR2_TARGET_SYSLINUX=y + +# If you want to add the nled editor, uncomment NLED + NCURSES +#BR2_PACKAGE_NCURSES=y +#BR2_PACKAGE_NLED=y diff --git a/buildroot-v86/external.desc b/buildroot-v86/external.desc new file mode 100644 index 0000000..e502700 --- /dev/null +++ b/buildroot-v86/external.desc @@ -0,0 +1,2 @@ +name: v86 +desc: Customized image for running in browser with v86 diff --git a/buildroot-v86/external.mk b/buildroot-v86/external.mk new file mode 100644 index 0000000..f9add42 --- /dev/null +++ b/buildroot-v86/external.mk @@ -0,0 +1 @@ +include $(sort $(wildcard $(BR2_EXTERNAL_v86_PATH)/package/*/*.mk)) diff --git a/buildroot-v86/package/nled/Config.in b/buildroot-v86/package/nled/Config.in new file mode 100644 index 0000000..093ea6e --- /dev/null +++ b/buildroot-v86/package/nled/Config.in @@ -0,0 +1,5 @@ +config BR2_PACKAGE_NLED + bool "nled" + select BR2_PACKAGE_NCURSES + help + The Neat Little Editor (NLED) https://cdot.senecacollege.ca/software/nled/ diff --git a/buildroot-v86/package/nled/nled.hash b/buildroot-v86/package/nled/nled.hash new file mode 100644 index 0000000..bdd047d --- /dev/null +++ b/buildroot-v86/package/nled/nled.hash @@ -0,0 +1 @@ +sha256 cf0f95edc8d399e883e38baf51f6a0cea9516761be36e75e8f14943667f7af29 nled_2_52_src.tgz diff --git a/buildroot-v86/package/nled/nled.mk b/buildroot-v86/package/nled/nled.mk new file mode 100644 index 0000000..e05bcd1 --- /dev/null +++ b/buildroot-v86/package/nled/nled.mk @@ -0,0 +1,36 @@ +################################################################################ +# +# nled +# +################################################################################ + +NLED_VERSION = 2.52 +NLED_SITE = https://cdot.senecacollege.ca/software/nled +NLED_SOURCE = nled_2_52_src.tgz +NLED_LICENSE = GPL-2.0+ +NLED_INSTALL_STAGING = YES +NLED_DEPENDENCIES = ncurses + +# We need to override the C compiler used in the Makefile to +# use buildroot's cross-compiler instead of cc. Switch cc to $(CC) +# so we can override the variable via env vars. +define NLED_MAKEFILE_FIXUP + $(SED) 's/cc $$(CCOPTIONS)/$$(CC) -static $$(CPPFLAGS) $$(CFLAGS) -c/g' $(@D)/Makefile + $(SED) 's/cc -o/$$(CC) $$(LDFLAGS) -o/g' $(@D)/Makefile +endef + +NLED_PRE_BUILD_HOOKS += NLED_MAKEFILE_FIXUP + +define NLED_BUILD_CMDS + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) LDOPTIONS="-lncurses" LIBS="$(TARGET_CFLAGS) -lncurses" +endef + +define NLED_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/nled $(TARGET_DIR)/usr/bin/nled +endef + +define NLED_INSTALL_STAGING_CMDS + $(INSTALL) -D -m 0755 $(@D)/nled $(STAGING_DIR)/usr/bin/nled +endef + +$(eval $(generic-package))