From 42a9b2c087049f158c9f887a2e0950ebb2e717df Mon Sep 17 00:00:00 2001 From: Reiner Herrmann Date: Sun, 31 Jan 2016 00:39:43 +0100 Subject: Initial commit of v2 --- COPYING | 14 ++ build.sh | 113 ++++++++++++ config-kernel | 571 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ debootstrap.sh | 25 +++ init.c | 24 +++ kernel.patch | 13 ++ lilo.conf | 14 ++ musl.patch | 25 +++ nethack.patch | 211 +++++++++++++++++++++ 9 files changed, 1010 insertions(+) create mode 100644 COPYING create mode 100755 build.sh create mode 100644 config-kernel create mode 100755 debootstrap.sh create mode 100644 init.c create mode 100644 kernel.patch create mode 100644 lilo.conf create mode 100644 musl.patch create mode 100644 nethack.patch diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..226832e --- /dev/null +++ b/COPYING @@ -0,0 +1,14 @@ +Coypright (c) 2016 Reiner Herrmann + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted, provided that the +above copyright notice and this permission notice appear in all +copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..8568131 --- /dev/null +++ b/build.sh @@ -0,0 +1,113 @@ +#!/bin/bash + +set -e +set -x + +BUILDDIR=/tmp/build +SRCDIR=$(dirname $(realpath "$0")) + +SIZE_CFLAGS="-I/tmp/build/include -I/tmp/build/include/ncurses -Os -ffunction-sections -fdata-sections -fno-asynchronous-unwind-tables" +SIZE_LDFLAGS="-L/tmp/build/lib -Wl,--gc-sections -Wl,--strip-all" + +NPROC=$(grep -sc processor /proc/cpuinfo || echo 4) + +[ -d "$BUILDDIR" ] && exit 1 + +mkdir -p "$BUILDDIR"/rootfs/{dev,lib/terminfo/l,nethack,sbin} +pushd "$BUILDDIR" + + +# install build dependencies +grep -q ^deb-src /etc/apt/sources.list +su -c "export DEBIAN_FRONTEND=noninteractive; + apt-get update; + apt-get install --yes build-essential gcc-4.9 upx-ucl gawk lilo ca-certificates; + apt-get build-dep --yes musl nethack ncurses linux" + + +# download sources +pushd "$SRCDIR" +[ -f "ncurses-6.0.tar.gz" ] || wget "https://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz" +[ $(md5sum "ncurses-6.0.tar.gz" | cut -d ' ' -f 1) = "ee13d052e1ead260d7c28071f46eefb1" ] || exit 1 +[ -f "nethack-360-src.tgz" ] || wget "http://prdownloads.sourceforge.net/nethack/nethack-360-src.tgz?download" -O "nethack-360-src.tgz" +[ $(md5sum "nethack-360-src.tgz" | cut -d ' ' -f 1) = "d42147b26e5fb4746fb72536ce145984" ] || exit 1 +[ -f "linux-2.6.32.70.tar.xz" ] || wget "https://cdn.kernel.org/pub/linux/kernel/v2.6/longterm/v2.6.32/linux-2.6.32.70.tar.xz" +[ $(md5sum "linux-2.6.32.70.tar.xz" | cut -d ' ' -f 1) = "1a3ae82aab5acb3cb42e8514ee460a71" ] || exit 1 +popd + + +# build musl +apt-get source musl + +pushd musl-*/ +patch -p1 < "$SRCDIR/musl.patch" +dpkg-buildpackage -us -uc -jauto +popd + +su -c "dpkg -i musl_*.deb musl-dev_*.deb musl-tools_*.deb" + + +# build ncurses +tar zxf "$SRCDIR"/ncurses-*.tar.gz + +pushd ncurses-*/ +./configure --prefix="$BUILDDIR" --with-terminfo-dirs=/lib/terminfo --without-shared --without-gpm AWK="gawk" CC="musl-gcc" CFLAGS="$SIZE_CFLAGS" LDFLAGS="$SIZE_LDFLAGS" +make -j$NPROC +make install +install -m 644 "$BUILDDIR/share/terminfo/l/linux" "$BUILDDIR/rootfs/lib/terminfo/l/" +popd + + +# extract kernel for headers +tar Jxf "$SRCDIR"/linux-*.tar.xz +cp -a linux-*/include/linux "$BUILDDIR/include/" + + +# build nethack +tar zxf "$SRCDIR"/nethack-*-src.tgz + +pushd nethack-*/ +patch -p1 < "$SRCDIR/nethack.patch" +pushd sys/unix +./setup.sh +popd +make -j$NPROC nethack CC="musl-gcc" LINK="musl-gcc" CFLAGS="-I../include $SIZE_CFLAGS -flto" LFLAGS="$SIZE_LDFLAGS -flto -static" +make -C dat CFLAGS="-I../include" +make dlb CC="musl-gcc" LINK="musl-gcc" CFLAGS="-I../include $SIZE_CFLAGS -flto" LFLAGS="$SIZE_LDFLAGS -flto" +upx --ultra-brute --overlay=strip src/nethack +install -m 755 src/nethack "$BUILDDIR/rootfs/nethack" +install -m 644 dat/nhdat "$BUILDDIR/rootfs/nethack" +touch "$BUILDDIR/rootfs/nethack/perm" +popd + + +# build init +musl-gcc "$SRCDIR/init.c" -o "$BUILDDIR/rootfs/sbin/init" $SIZE_CFLAGS $SIZE_LDFLAGS -flto -static + + +# build kernel +echo "nod /dev/console 0600 0 0 c 5 1" > rootfs-files.txt +pushd linux-*/ +patch -p1 < "$SRCDIR/kernel.patch" +cp "$SRCDIR/config-kernel" .config +make oldconfig +make -j$NPROC bzImage CC="gcc-4.9" +popd + + +# create floppy +dd if=/dev/zero of=floppy.img bs=1024 count=1440 +/sbin/mkfs.minix floppy.img +mkdir -p "$BUILDDIR/mnt" +su -c " + set -ex; + mount floppy.img \"$BUILDDIR/mnt\"; + mkdir \"$BUILDDIR\"/mnt/{boot,dev}; + mount /dev \"$BUILDDIR/mnt/dev\" -o bind; + cp \"$BUILDDIR\"/linux-*/arch/x86/boot/bzImage \"$SRCDIR/lilo.conf\" \"$BUILDDIR/mnt/\"; + lilo -g -r \"$BUILDDIR/mnt\" -C /lilo.conf; + rm \"$BUILDDIR/mnt/lilo.conf\"; + umount \"$BUILDDIR/mnt/dev\" \"$BUILDDIR/mnt\"; +" + +printf "\n\nFinished! Result is at $BUILDDIR/floppy.img\n\n" diff --git a/config-kernel b/config-kernel new file mode 100644 index 0000000..c531c64 --- /dev/null +++ b/config-kernel @@ -0,0 +1,571 @@ +# +# Automatically generated make config: don't edit +# Linux kernel version: 2.6.32.70 +# Sat Jan 30 16:41:05 2016 +# +CONFIG_64BIT=y +# CONFIG_X86_32 is not set +CONFIG_X86_64=y +CONFIG_X86=y +CONFIG_OUTPUT_FORMAT="elf64-x86-64" +CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig" +CONFIG_GENERIC_TIME=y +CONFIG_GENERIC_CMOS_UPDATE=y +CONFIG_CLOCKSOURCE_WATCHDOG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y +CONFIG_LOCKDEP_SUPPORT=y +CONFIG_STACKTRACE_SUPPORT=y +CONFIG_HAVE_LATENCYTOP_SUPPORT=y +CONFIG_MMU=y +CONFIG_ZONE_DMA=y +CONFIG_GENERIC_ISA_DMA=y +CONFIG_GENERIC_IOMAP=y +CONFIG_GENERIC_HWEIGHT=y +CONFIG_ARCH_MAY_HAVE_PC_FDC=y +# CONFIG_RWSEM_GENERIC_SPINLOCK is not set +CONFIG_RWSEM_XCHGADD_ALGORITHM=y +CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y +CONFIG_GENERIC_CALIBRATE_DELAY=y +CONFIG_GENERIC_TIME_VSYSCALL=y +CONFIG_ARCH_HAS_CPU_RELAX=y +CONFIG_ARCH_HAS_DEFAULT_IDLE=y +CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y +CONFIG_HAVE_SETUP_PER_CPU_AREA=y +CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y +CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y +# CONFIG_HAVE_CPUMASK_OF_CPU_MAP is not set +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_SUSPEND_POSSIBLE=y +CONFIG_ZONE_DMA32=y +CONFIG_ARCH_POPULATES_NODE_MAP=y +CONFIG_AUDIT_ARCH=y +CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y +CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y +CONFIG_GENERIC_HARDIRQS=y +CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y +CONFIG_GENERIC_IRQ_PROBE=y +# CONFIG_KTIME_SCALAR is not set +CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" +CONFIG_CONSTRUCTORS=y + +# +# General setup +# +# CONFIG_EXPERIMENTAL is not set +CONFIG_BROKEN_ON_SMP=y +CONFIG_INIT_ENV_ARG_LIMIT=32 +CONFIG_LOCALVERSION="" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_HAVE_KERNEL_GZIP=y +CONFIG_HAVE_KERNEL_BZIP2=y +CONFIG_HAVE_KERNEL_LZMA=y +# CONFIG_KERNEL_GZIP is not set +# CONFIG_KERNEL_BZIP2 is not set +CONFIG_KERNEL_LZMA=y +# CONFIG_SYSVIPC is not set +# CONFIG_BSD_PROCESS_ACCT is not set + +# +# RCU Subsystem +# +CONFIG_TREE_RCU=y +# CONFIG_TREE_PREEMPT_RCU is not set +# CONFIG_RCU_TRACE is not set +CONFIG_RCU_FANOUT=64 +# CONFIG_RCU_FANOUT_EXACT is not set +# CONFIG_TREE_RCU_TRACE is not set +# CONFIG_IKCONFIG is not set +CONFIG_LOG_BUF_SHIFT=17 +CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y +# CONFIG_CGROUPS is not set +# CONFIG_RELAY is not set +# CONFIG_NAMESPACES is not set +CONFIG_BLK_DEV_INITRD=y +CONFIG_INITRAMFS_SOURCE="../rootfs ../rootfs-files.txt" +CONFIG_INITRAMFS_ROOT_UID=0 +CONFIG_INITRAMFS_ROOT_GID=0 +# CONFIG_RD_GZIP is not set +# CONFIG_RD_BZIP2 is not set +CONFIG_RD_LZMA=y +CONFIG_INITRAMFS_COMPRESSION_NONE=y +# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set +# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set +# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_EMBEDDED=y +# CONFIG_SYSCTL_SYSCALL is not set +# CONFIG_KALLSYMS is not set +# CONFIG_HOTPLUG is not set +CONFIG_PRINTK=y +# CONFIG_BUG is not set +# CONFIG_ELF_CORE is not set +# CONFIG_PCSPKR_PLATFORM is not set +# CONFIG_BASE_FULL is not set +# CONFIG_FUTEX is not set +# CONFIG_EPOLL is not set +# CONFIG_SIGNALFD is not set +# CONFIG_TIMERFD is not set +# CONFIG_EVENTFD is not set +# CONFIG_SHMEM is not set +# CONFIG_AIO is not set +CONFIG_HAVE_PERF_EVENTS=y + +# +# Kernel Performance Events And Counters +# +# CONFIG_PERF_EVENTS is not set +# CONFIG_PERF_COUNTERS is not set +# CONFIG_VM_EVENT_COUNTERS is not set +# CONFIG_COMPAT_BRK is not set +# CONFIG_SLAB is not set +# CONFIG_SLUB is not set +CONFIG_SLOB=y +# CONFIG_PROFILING is not set +CONFIG_HAVE_OPROFILE=y +CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y +CONFIG_HAVE_IOREMAP_PROT=y +CONFIG_HAVE_KPROBES=y +CONFIG_HAVE_KRETPROBES=y +CONFIG_HAVE_ARCH_TRACEHOOK=y +CONFIG_HAVE_DMA_ATTRS=y +CONFIG_HAVE_DMA_API_DEBUG=y + +# +# GCOV-based kernel profiling +# +# CONFIG_SLOW_WORK is not set +# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set +CONFIG_BASE_SMALL=1 +# CONFIG_MODULES is not set +# CONFIG_BLOCK is not set +# CONFIG_FREEZER is not set + +# +# Processor type and features +# +# CONFIG_NO_HZ is not set +# CONFIG_HIGH_RES_TIMERS is not set +CONFIG_GENERIC_CLOCKEVENTS_BUILD=y +# CONFIG_SMP is not set +CONFIG_X86_MPPARSE=y +# CONFIG_X86_EXTENDED_PLATFORM is not set +# CONFIG_SCHED_OMIT_FRAME_POINTER is not set +# CONFIG_PARAVIRT_GUEST is not set +# CONFIG_MEMTEST is not set +# CONFIG_M386 is not set +# CONFIG_M486 is not set +# CONFIG_M586 is not set +# CONFIG_M586TSC is not set +# CONFIG_M586MMX is not set +# CONFIG_M686 is not set +# CONFIG_MPENTIUMII is not set +# CONFIG_MPENTIUMIII is not set +# CONFIG_MPENTIUMM is not set +# CONFIG_MPENTIUM4 is not set +# CONFIG_MK6 is not set +# CONFIG_MK7 is not set +# CONFIG_MK8 is not set +# CONFIG_MCRUSOE is not set +# CONFIG_MEFFICEON is not set +# CONFIG_MWINCHIPC6 is not set +# CONFIG_MWINCHIP3D is not set +# CONFIG_MGEODEGX1 is not set +# CONFIG_MGEODE_LX is not set +# CONFIG_MCYRIXIII is not set +# CONFIG_MVIAC3_2 is not set +# CONFIG_MVIAC7 is not set +# CONFIG_MPSC is not set +# CONFIG_MCORE2 is not set +# CONFIG_MATOM is not set +CONFIG_GENERIC_CPU=y +CONFIG_X86_CPU=y +CONFIG_X86_L1_CACHE_BYTES=64 +CONFIG_X86_INTERNODE_CACHE_BYTES=64 +CONFIG_X86_CMPXCHG=y +CONFIG_X86_L1_CACHE_SHIFT=6 +CONFIG_X86_XADD=y +CONFIG_X86_WP_WORKS_OK=y +CONFIG_X86_TSC=y +CONFIG_X86_CMPXCHG64=y +CONFIG_X86_CMOV=y +CONFIG_X86_MINIMUM_CPU_FAMILY=64 +CONFIG_X86_DEBUGCTLMSR=y +# CONFIG_PROCESSOR_SELECT is not set +CONFIG_CPU_SUP_INTEL=y +CONFIG_CPU_SUP_AMD=y +CONFIG_CPU_SUP_CENTAUR=y +# CONFIG_X86_DS is not set +CONFIG_HPET_TIMER=y +# CONFIG_DMI is not set +CONFIG_SWIOTLB=y +CONFIG_IOMMU_HELPER=y +# CONFIG_IOMMU_API is not set +CONFIG_NR_CPUS=1 +# CONFIG_IRQ_TIME_ACCOUNTING is not set +# CONFIG_PREEMPT_NONE is not set +CONFIG_PREEMPT_VOLUNTARY=y +# CONFIG_PREEMPT is not set +CONFIG_X86_LOCAL_APIC=y +CONFIG_X86_IO_APIC=y +# CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS is not set +# CONFIG_X86_MCE is not set +# CONFIG_X86_16BIT is not set +# CONFIG_I8K is not set +# CONFIG_MICROCODE is not set +# CONFIG_X86_MSR is not set +# CONFIG_X86_CPUID is not set +CONFIG_ARCH_PHYS_ADDR_T_64BIT=y +# CONFIG_DIRECT_GBPAGES is not set +CONFIG_ARCH_SPARSEMEM_DEFAULT=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ILLEGAL_POINTER_VALUE=0xdead000000000000 +CONFIG_SELECT_MEMORY_MODEL=y +# CONFIG_FLATMEM_MANUAL is not set +# CONFIG_DISCONTIGMEM_MANUAL is not set +CONFIG_SPARSEMEM_MANUAL=y +CONFIG_SPARSEMEM=y +CONFIG_HAVE_MEMORY_PRESENT=y +CONFIG_SPARSEMEM_EXTREME=y +CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y +# CONFIG_SPARSEMEM_VMEMMAP is not set +CONFIG_PAGEFLAGS_EXTENDED=y +CONFIG_SPLIT_PTLOCK_CPUS=4 +CONFIG_PHYS_ADDR_T_64BIT=y +CONFIG_ZONE_DMA_FLAG=1 +CONFIG_VIRT_TO_BUS=y +CONFIG_HAVE_MLOCK=y +CONFIG_HAVE_MLOCKED_PAGE_BIT=y +# CONFIG_KSM is not set +CONFIG_DEFAULT_MMAP_MIN_ADDR=65536 +# CONFIG_X86_CHECK_BIOS_CORRUPTION is not set +# CONFIG_X86_RESERVE_LOW_64K is not set +# CONFIG_MTRR is not set +# CONFIG_ARCH_RANDOM is not set +# CONFIG_SECCOMP is not set +# CONFIG_CC_STACKPROTECTOR is not set +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +# CONFIG_HZ_300 is not set +# CONFIG_HZ_1000 is not set +CONFIG_HZ=250 +# CONFIG_SCHED_HRTICK is not set +# CONFIG_KEXEC is not set +# CONFIG_CRASH_DUMP is not set +CONFIG_PHYSICAL_START=0x1000000 +# CONFIG_RELOCATABLE is not set +CONFIG_PHYSICAL_ALIGN=0x1000000 +# CONFIG_CMDLINE_BOOL is not set +CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y + +# +# Power management and ACPI options +# +# CONFIG_PM is not set +# CONFIG_SFI is not set + +# +# CPU Frequency scaling +# +# CONFIG_CPU_FREQ is not set +# CONFIG_CPU_IDLE is not set + +# +# Memory power savings +# + +# +# Bus options (PCI etc.) +# +# CONFIG_PCI is not set +# CONFIG_ARCH_SUPPORTS_MSI is not set +CONFIG_ISA_DMA_API=y + +# +# Executable file formats / Emulations +# +CONFIG_BINFMT_ELF=y +# CONFIG_HAVE_AOUT is not set +# CONFIG_BINFMT_MISC is not set +# CONFIG_IA32_EMULATION is not set +# CONFIG_COMPAT_FOR_U64_ALIGNMENT is not set +# CONFIG_NET is not set + +# +# Device Drivers +# + +# +# Generic Driver Options +# +CONFIG_STANDALONE=y +# CONFIG_PREVENT_FIRMWARE_BUILD is not set +# CONFIG_SYS_HYPERVISOR is not set +# CONFIG_MTD is not set +# CONFIG_PARPORT is not set +# CONFIG_MISC_DEVICES is not set +CONFIG_HAVE_IDE=y + +# +# SCSI device support +# +# CONFIG_SCSI_DMA is not set +# CONFIG_SCSI_NETLINK is not set +# CONFIG_MACINTOSH_DRIVERS is not set +# CONFIG_PHONE is not set + +# +# Input device support +# +CONFIG_INPUT=y +# CONFIG_INPUT_FF_MEMLESS is not set +# CONFIG_INPUT_POLLDEV is not set + +# +# Userland interfaces +# +# CONFIG_INPUT_MOUSEDEV is not set +# CONFIG_INPUT_JOYDEV is not set +# CONFIG_INPUT_EVDEV is not set +# CONFIG_INPUT_EVBUG is not set + +# +# Input Device Drivers +# +CONFIG_INPUT_KEYBOARD=y +CONFIG_KEYBOARD_ATKBD=y +# CONFIG_KEYBOARD_LKKBD is not set +# CONFIG_KEYBOARD_NEWTON is not set +# CONFIG_KEYBOARD_OPENCORES is not set +# CONFIG_KEYBOARD_STOWAWAY is not set +# CONFIG_KEYBOARD_SUNKBD is not set +# CONFIG_KEYBOARD_XTKBD is not set +# CONFIG_INPUT_MOUSE is not set +# CONFIG_INPUT_JOYSTICK is not set +# CONFIG_INPUT_TABLET is not set +# CONFIG_INPUT_TOUCHSCREEN is not set +# CONFIG_INPUT_MISC is not set + +# +# Hardware I/O ports +# +CONFIG_SERIO=y +CONFIG_SERIO_I8042=y +# CONFIG_SERIO_SERPORT is not set +# CONFIG_SERIO_CT82C710 is not set +CONFIG_SERIO_LIBPS2=y +# CONFIG_SERIO_RAW is not set +# CONFIG_GAMEPORT is not set + +# +# Character devices +# +CONFIG_VT=y +# CONFIG_CONSOLE_TRANSLATIONS is not set +CONFIG_VT_CONSOLE=y +CONFIG_HW_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +# CONFIG_DEVKMEM is not set +# CONFIG_SERIAL_NONSTANDARD is not set + +# +# Serial drivers +# +# CONFIG_SERIAL_8250 is not set +CONFIG_FIX_EARLYCON_MEM=y + +# +# Non-8250 serial port support +# +# CONFIG_UNIX98_PTYS is not set +# CONFIG_LEGACY_PTYS is not set +# CONFIG_IPMI_HANDLER is not set +# CONFIG_HW_RANDOM is not set +# CONFIG_NVRAM is not set +# CONFIG_RTC is not set +# CONFIG_GEN_RTC is not set +# CONFIG_R3964 is not set +# CONFIG_MWAVE is not set +# CONFIG_PC8736x_GPIO is not set +# CONFIG_HANGCHECK_TIMER is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set + +# +# PPS support +# +CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y +# CONFIG_GPIOLIB is not set +# CONFIG_W1 is not set +# CONFIG_POWER_SUPPLY is not set +# CONFIG_HWMON is not set +# CONFIG_THERMAL is not set +# CONFIG_WATCHDOG is not set +CONFIG_SSB_POSSIBLE=y + +# +# Sonics Silicon Backplane +# +# CONFIG_SSB is not set + +# +# Multifunction device drivers +# +# CONFIG_MFD_CORE is not set +# CONFIG_MFD_SM501 is not set +# CONFIG_HTC_PASIC3 is not set +# CONFIG_MFD_TMIO is not set +# CONFIG_REGULATOR is not set +# CONFIG_MEDIA_SUPPORT is not set + +# +# Graphics support +# +# CONFIG_VGASTATE is not set +# CONFIG_VIDEO_OUTPUT_CONTROL is not set +# CONFIG_FB is not set +# CONFIG_BACKLIGHT_LCD_SUPPORT is not set + +# +# Display device support +# +# CONFIG_DISPLAY_SUPPORT is not set + +# +# Console display driver support +# +CONFIG_VGA_CONSOLE=y +# CONFIG_VGACON_SOFT_SCROLLBACK is not set +CONFIG_DUMMY_CONSOLE=y +# CONFIG_SOUND is not set +# CONFIG_HID_SUPPORT is not set +# CONFIG_USB_SUPPORT is not set +# CONFIG_MMC is not set +# CONFIG_MEMSTICK is not set +# CONFIG_NEW_LEDS is not set +# CONFIG_ACCESSIBILITY is not set +# CONFIG_EDAC is not set +# CONFIG_RTC_CLASS is not set +# CONFIG_DMADEVICES is not set +# CONFIG_AUXDISPLAY is not set +# CONFIG_UIO is not set + +# +# TI VLYNQ +# +# CONFIG_STAGING is not set +# CONFIG_X86_PLATFORM_DEVICES is not set + +# +# Firmware Drivers +# +# CONFIG_EDD is not set +# CONFIG_FIRMWARE_MEMMAP is not set +# CONFIG_DELL_RBU is not set +# CONFIG_DCDBAS is not set +# CONFIG_ISCSI_IBFT_FIND is not set + +# +# File systems +# +# CONFIG_FILE_LOCKING is not set +# CONFIG_FSNOTIFY is not set +# CONFIG_DNOTIFY is not set +# CONFIG_INOTIFY is not set +# CONFIG_INOTIFY_USER is not set +# CONFIG_QUOTA is not set +# CONFIG_AUTOFS_FS is not set +# CONFIG_AUTOFS4_FS is not set +# CONFIG_FUSE_FS is not set + +# +# Caches +# + +# +# Pseudo filesystems +# +# CONFIG_PROC_FS is not set +# CONFIG_SYSFS is not set +# CONFIG_HUGETLBFS is not set +# CONFIG_HUGETLB_PAGE is not set +# CONFIG_MISC_FILESYSTEMS is not set +# CONFIG_NLS is not set + +# +# Kernel hacking +# +CONFIG_TRACE_IRQFLAGS_SUPPORT=y +# CONFIG_PRINTK_TIME is not set +# CONFIG_ENABLE_WARN_DEPRECATED is not set +# CONFIG_ENABLE_MUST_CHECK is not set +CONFIG_FRAME_WARN=2048 +# CONFIG_MAGIC_SYSRQ is not set +CONFIG_STRIP_ASM_SYMS=y +# CONFIG_UNUSED_SYMBOLS is not set +# CONFIG_HEADERS_CHECK is not set +# CONFIG_DEBUG_KERNEL is not set +# CONFIG_DEBUG_MEMORY_INIT is not set +CONFIG_ARCH_WANT_FRAME_POINTERS=y +# CONFIG_FRAME_POINTER is not set +# CONFIG_RCU_CPU_STALL_DETECTOR is not set +# CONFIG_LATENCYTOP is not set +CONFIG_USER_STACKTRACE_SUPPORT=y +CONFIG_HAVE_FUNCTION_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y +CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y +CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y +CONFIG_HAVE_DYNAMIC_FTRACE=y +CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y +CONFIG_HAVE_SYSCALL_TRACEPOINTS=y +CONFIG_TRACING_SUPPORT=y +# CONFIG_FTRACE is not set +# CONFIG_DMA_API_DEBUG is not set +# CONFIG_SAMPLES is not set +CONFIG_HAVE_ARCH_KGDB=y +CONFIG_HAVE_ARCH_KMEMCHECK=y +# CONFIG_STRICT_DEVMEM is not set +# CONFIG_X86_VERBOSE_BOOTUP is not set +# CONFIG_EARLY_PRINTK is not set +# CONFIG_IOMMU_STRESS is not set +CONFIG_HAVE_MMIOTRACE_SUPPORT=y +CONFIG_IO_DELAY_TYPE_0X80=0 +CONFIG_IO_DELAY_TYPE_0XED=1 +CONFIG_IO_DELAY_TYPE_UDELAY=2 +CONFIG_IO_DELAY_TYPE_NONE=3 +CONFIG_IO_DELAY_0X80=y +# CONFIG_IO_DELAY_0XED is not set +# CONFIG_IO_DELAY_UDELAY is not set +# CONFIG_IO_DELAY_NONE is not set +CONFIG_DEFAULT_IO_DELAY_TYPE=0 +CONFIG_OPTIMIZE_INLINING=y + +# +# Security options +# +# CONFIG_KEYS is not set +# CONFIG_SECURITYFS is not set +# CONFIG_SECURITY_FILE_CAPABILITIES is not set +# CONFIG_CRYPTO is not set +CONFIG_HAVE_KVM=y +# CONFIG_VIRTUALIZATION is not set +# CONFIG_BINARY_PRINTF is not set + +# +# Library routines +# +CONFIG_GENERIC_FIND_FIRST_BIT=y +CONFIG_GENERIC_FIND_NEXT_BIT=y +CONFIG_GENERIC_FIND_LAST_BIT=y +# CONFIG_CRC_CCITT is not set +# CONFIG_CRC16 is not set +# CONFIG_CRC_T10DIF is not set +# CONFIG_CRC_ITU_T is not set +# CONFIG_CRC32 is not set +# CONFIG_CRC7 is not set +# CONFIG_LIBCRC32C is not set +CONFIG_DECOMPRESS_LZMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT=y +CONFIG_HAS_DMA=y diff --git a/debootstrap.sh b/debootstrap.sh new file mode 100755 index 0000000..ead947d --- /dev/null +++ b/debootstrap.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +set -e +set -x + +# will use about 2.1 GB +DEBDIR=/tmp/debian-chroot + +RELEASE=stretch +MIRROR=http://httpredir.debian.org/debian/ + +[ -f "build.sh" ] || exit 1 + +if [ $(pgrep -c apt-cacher-ng) -gt 0 ]; then + MIRROR="http://localhost:3142/httpredir.debian.org/debian" +fi + +debootstrap $RELEASE "$DEBDIR" "$MIRROR" +echo "deb-src $MIRROR $RELEASE main" >> "$DEBDIR/etc/apt/sources.list" + +cp -a * "$DEBDIR/usr/src" + +mknod "$DEBDIR/dev/loop0" b 7 0 +chroot "$DEBDIR" /usr/src/build.sh + diff --git a/init.c b/init.c new file mode 100644 index 0000000..b77f3bd --- /dev/null +++ b/init.c @@ -0,0 +1,24 @@ +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + chdir("/nethack"); + while(1) { + pid_t pid = fork(); + if (pid == 0) { + execl("/nethack/nethack", "/nethack/nethack", NULL); + } else { + char buf[1]; + waitpid(pid, NULL, 0); + + /* wait so user can see highscore list */ + write(STDOUT_FILENO, "\n\nPress [Return] to restart.\n", 29); + read(STDIN_FILENO, buf, sizeof(buf)); + tcflush(STDIN_FILENO, TCIFLUSH); + } + } + return 0; +} diff --git a/kernel.patch b/kernel.patch new file mode 100644 index 0000000..369b9c5 --- /dev/null +++ b/kernel.patch @@ -0,0 +1,13 @@ +diff --git a/kernel/timeconst.pl b/kernel/timeconst.pl +index eb51d76..0461239 100644 +--- a/kernel/timeconst.pl ++++ b/kernel/timeconst.pl +@@ -370,7 +370,7 @@ if ($hz eq '--can') { + } + + @val = @{$canned_values{$hz}}; +- if (!defined(@val)) { ++ if (!@val) { + @val = compute_values($hz); + } + output($hz, @val); diff --git a/lilo.conf b/lilo.conf new file mode 100644 index 0000000..420c1f0 --- /dev/null +++ b/lilo.conf @@ -0,0 +1,14 @@ +boot = /dev/loop0 +#root = /dev/loop0 +disk = /dev/loop0 + bios = 0x00 + sectors = 18 + heads = 2 + cylinders = 80 + +compact +map = /lilo.map + +default = linux +image = /bzImage + label = linux diff --git a/musl.patch b/musl.patch new file mode 100644 index 0000000..ef5a227 --- /dev/null +++ b/musl.patch @@ -0,0 +1,25 @@ +diff --git a/debian/patches/series b/debian/patches/series +index 0a1013d..91ddd35 100644 +--- a/debian/patches/series ++++ b/debian/patches/series +@@ -1 +1,2 @@ + 20150515_ARM-thumb_compatibility.diff ++size_optimization.patch +diff --git a/debian/patches/size_optimization.patch b/debian/patches/size_optimization.patch +new file mode 100644 +index 0000000..08d48e1 +--- /dev/null ++++ b/debian/patches/size_optimization.patch +@@ -0,0 +1,12 @@ ++--- a/configure +++++ b/configure ++@@ -379,6 +379,9 @@ ++ tryflag CFLAGS_AUTO -fno-unwind-tables ++ tryflag CFLAGS_AUTO -fno-asynchronous-unwind-tables ++ +++tryflag CFLAGS_AUTO -ffunction-sections +++tryflag CFLAGS_AUTO -fdata-sections +++ ++ # ++ # The GNU toolchain defaults to assuming unmarked files need an ++ # executable stack, potentially exposing vulnerabilities in programs diff --git a/nethack.patch b/nethack.patch new file mode 100644 index 0000000..68359a1 --- /dev/null +++ b/nethack.patch @@ -0,0 +1,211 @@ +diff --git a/include/config.h b/include/config.h +index 141a684..3a79679 100644 +--- a/include/config.h ++++ b/include/config.h +@@ -188,7 +188,7 @@ + #endif + + #ifndef SYSCF +-#define SYSCF /* use a global configuration */ ++//#define SYSCF /* use a global configuration */ + #define SYSCF_FILE "sysconf" /* global configuration is in a file */ + #endif + +@@ -201,10 +201,10 @@ + + /* note: "larger" is in comparison with 'record', the high-scores file + (whose name can be overridden via #define in global.h if desired) */ +-#define LOGFILE "logfile" /* larger file for debugging purposes */ +-#define XLOGFILE "xlogfile" /* even larger logfile */ +-#define NEWS "news" /* the file containing the latest hack news */ +-#define PANICLOG "paniclog" /* log of panic and impossible events */ ++//#define LOGFILE "logfile" /* larger file for debugging purposes */ ++//#define XLOGFILE "xlogfile" /* even larger logfile */ ++//#define NEWS "news" /* the file containing the latest hack news */ ++//#define PANICLOG "paniclog" /* log of panic and impossible events */ + + /* + * PERSMAX, POINTSMIN, ENTRYMAX, PERS_IS_UID: +@@ -250,8 +250,8 @@ + + #if defined(UNIX) && !defined(ZLIB_COMP) && !defined(COMPRESS) + /* path and file name extension for compression program */ +-#define COMPRESS "/usr/bin/compress" /* Lempel-Ziv compression */ +-#define COMPRESS_EXTENSION ".Z" /* compress's extension */ ++//#define COMPRESS "/usr/bin/compress" /* Lempel-Ziv compression */ ++//#define COMPRESS_EXTENSION ".Z" /* compress's extension */ + /* An example of one alternative you might want to use: */ + /* #define COMPRESS "/usr/local/bin/gzip" */ /* FSF gzip compression */ + /* #define COMPRESS_EXTENSION ".gz" */ /* normal gzip extension */ +@@ -298,14 +298,14 @@ + * a tar-like file, thus making a neater installation. See *conf.h + * for detailed configuration. + */ +-/* #define DLB */ /* not supported on all platforms */ ++#define DLB /* not supported on all platforms */ + + /* + * Defining INSURANCE slows down level changes, but allows games that + * died due to program or system crashes to be resumed from the point + * of the last level change, after running a utility program. + */ +-#define INSURANCE /* allow crashed game recovery */ ++//#define INSURANCE /* allow crashed game recovery */ + + #ifndef MAC + #define CHDIR /* delete if no chdir() available */ +@@ -317,7 +317,7 @@ + * otherwise it will be the current directory. + */ + #ifndef HACKDIR +-#define HACKDIR "/usr/games/lib/nethackdir" ++//#define HACKDIR "/usr/games/lib/nethackdir" + #endif + + /* +@@ -340,7 +340,7 @@ + /* If GENERIC_USERNAMES is defined, and the player's username is found + * in the list, prompt for character name instead of using username. + * A public server should probably disable this. */ +-#define GENERIC_USERNAMES "play player game games nethack nethacker" ++//#define GENERIC_USERNAMES "play player game games nethack nethacker" + + /* + * Section 3: Definitions that may vary with system type. +@@ -451,7 +451,7 @@ typedef unsigned char uchar; + + /* FREE_ALL_MEMORY is neither experimental nor inadequately tested, + but it isn't necessary for successful operation of the program */ +-#define FREE_ALL_MEMORY /* free all memory at exit */ ++//#define FREE_ALL_MEMORY /* free all memory at exit */ + + /* End of Section 4 */ + +diff --git a/include/unixconf.h b/include/unixconf.h +index 0447b82..ce535e6 100644 +--- a/include/unixconf.h ++++ b/include/unixconf.h +@@ -33,10 +33,10 @@ + /* define any of the following that are appropriate */ + #define SVR4 /* use in addition to SYSV for System V Release 4 */ + /* including Solaris 2+ */ +-#define NETWORK /* if running on a networked system */ ++//#define NETWORK /* if running on a networked system */ + /* e.g. Suns sharing a playground through NFS */ + /* #define SUNOS4 */ /* SunOS 4.x */ +-/* #define LINUX */ /* Another Unix clone */ ++#define LINUX /* Another Unix clone */ + /* #define CYGWIN32 */ /* Unix on Win32 -- use with case sensitive defines */ + /* #define GENIX */ /* Yet Another Unix Clone */ + /* #define HISX */ /* Bull Unix for XPS Machines */ +@@ -55,8 +55,8 @@ + #define TEXTCOLOR /* Use System V r3.2 terminfo color support + * and/or ANSI color support on termcap systems + * and/or X11 color */ +-#define POSIX_JOB_CONTROL /* use System V / Solaris 2.x / POSIX job control +- * (e.g., VSUSP) */ ++//#define POSIX_JOB_CONTROL /* use System V / Solaris 2.x / POSIX job control ++// * (e.g., VSUSP) */ + #define POSIX_TYPES /* use POSIX types for system calls and termios */ + /* Define for many recent OS releases, including + * those with specific defines (since types are +@@ -128,7 +128,7 @@ + * "extra output" method is used, but not all systems provide access to + * a fine-grained timer. + */ +-/* #define TIMED_DELAY */ /* usleep() */ ++#define TIMED_DELAY /* usleep() */ + #endif + + /* +@@ -139,7 +139,7 @@ + * A stat system call is done on the mailbox every MAILCKFREQ moves. + */ + #if !defined(NOMAIL) +-#define MAIL /* Deliver mail during the game */ ++//#define MAIL /* Deliver mail during the game */ + #endif + + /* The Andrew Message System does mail a little differently from normal +@@ -213,7 +213,7 @@ + * Comment out the USE_FCNTL if for some reason you have a strange + * OS/filesystem combination for which fcntl(2) does not work. */ + #ifdef POSIX_TYPES +-#define USE_FCNTL ++//#define USE_FCNTL + #endif + + /* +@@ -281,7 +281,7 @@ + #define tgetch getchar + + #ifndef NOSHELL +-#define SHELL /* do not delete the '!' command */ ++//#define SHELL /* do not delete the '!' command */ + #endif + + #include "system.h" +diff --git a/src/options.c b/src/options.c +index 87c4004..1f0c385 100644 +--- a/src/options.c ++++ b/src/options.c +@@ -101,7 +101,7 @@ static struct Bool_Opt { + #if defined(MICRO) || defined(WIN32) + { "color", &iflags.wc_color, TRUE, SET_IN_GAME }, /*WC*/ + #else /* systems that support multiple terminals, many monochrome */ +- { "color", &iflags.wc_color, FALSE, SET_IN_GAME }, /*WC*/ ++ { "color", &iflags.wc_color, TRUE, SET_IN_GAME }, /*WC*/ + #endif + { "confirm", &flags.confirm, TRUE, SET_IN_GAME }, + { "dark_room", &flags.dark_room, TRUE, SET_IN_GAME }, +@@ -126,7 +126,7 @@ static struct Bool_Opt { + #endif + { "fullscreen", &iflags.wc2_fullscreen, FALSE, SET_IN_FILE }, + { "help", &flags.help, TRUE, SET_IN_GAME }, +- { "hilite_pet", &iflags.wc_hilite_pet, FALSE, SET_IN_GAME }, /*WC*/ ++ { "hilite_pet", &iflags.wc_hilite_pet, TRUE, SET_IN_GAME }, /*WC*/ + { "hilite_pile", &iflags.hilite_pile, FALSE, SET_IN_GAME }, + #ifndef MAC + { "ignintr", &flags.ignintr, FALSE, SET_IN_GAME }, +@@ -136,7 +136,7 @@ static struct Bool_Opt { + { "implicit_uncursed", &iflags.implicit_uncursed, TRUE, SET_IN_GAME }, + { "large_font", &iflags.obsolete, FALSE, SET_IN_FILE }, /* OBSOLETE */ + { "legacy", &flags.legacy, TRUE, DISP_IN_GAME }, +- { "lit_corridor", &flags.lit_corridor, FALSE, SET_IN_GAME }, ++ { "lit_corridor", &flags.lit_corridor, TRUE, SET_IN_GAME }, + { "lootabc", &flags.lootabc, FALSE, SET_IN_GAME }, + #ifdef MAIL + { "mail", &flags.biff, TRUE, SET_IN_GAME }, +diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src +index 16d0874..8f5626a 100644 +--- a/sys/unix/Makefile.src ++++ b/sys/unix/Makefile.src +@@ -222,8 +235,8 @@ WINBEOBJ = + + # + # +-#WINSRC = $(WINTTYSRC) +-#WINOBJ = $(WINTTYOBJ) ++WINSRC = $(WINTTYSRC) ++WINOBJ = $(WINTTYOBJ) + + # on some systems the termcap library is in -ltermcap or -lcurses + # on 386 Xenix, the -ltermlib tputs() seems not to work; use -lcurses instead +@@ -238,7 +251,7 @@ WINBEOBJ = + # WINTTYLIB = -ltermcap + # WINTTYLIB = -lcurses + # WINTTYLIB = -lcurses16 +-# WINTTYLIB = -lncurses ++WINTTYLIB = -lncurses + #WINTTYLIB = -ltermlib + # + # libraries for X11 +@@ -263,7 +276,7 @@ WINGEMLIB = -le_gem -lgem + # libraries for BeOS + WINBELIB = -lbe + +-#WINLIB = $(WINTTYLIB) ++WINLIB = $(WINTTYLIB) + + # any other strange libraries your system needs (for Sysunix only -- the more + # specialized targets should already be right) -- cgit v1.2.3