From: Jose V Beneyto Date: Mon, 2 Jul 2012 21:25:54 +0000 (+0000) Subject: Synced with initrd sources X-Git-Url: http://gitweb/?a=commitdiff_plain;h=1d7b9c8a07ff0cc3e0a42417c029b09f1367efa5;p=initramfs.git Synced with initrd sources --- diff --git a/Makefile b/Makefile index 546403c..62eba8c 100644 --- a/Makefile +++ b/Makefile @@ -2,28 +2,36 @@ # initramfs/Makefile # +TOPDIR = $(shell pwd) + +include $(TOPDIR)/../toolchain/vars.mk + TARGET = arm-crux-linux-gnueabi DEVICE = versatile -PWD = $(shell pwd) -WORK = $(PWD)/work -CLFS = $(PWD)/../toolchain/clfs -CROSSTOOLS = $(PWD)/../toolchain/crosstools +WORK = $(TOPDIR)/work +CLFS = $(TOPDIR)/../toolchain/clfs +CROSSTOOLS = $(TOPDIR)/../toolchain/crosstools KERNEL_PATH = $(PWD)/../kernel/$(DEVICE) KERNEL_VERSION = $(shell grep '^KERNEL_VERSION = ' $(KERNEL_PATH)/Makefile | sed 's|KERNEL_VERSION = ||') +BUSYBOX_VERSION = 1.19.4 BUSYBOX_SOURCE = http://busybox.net/downloads/busybox-$(BUSYBOX_VERSION).tar.bz2 -BUSYBOX_VERSION = 1.18.4 -.PHONY: all check-root busybox initramfs clean distclean +DIALOG_VERSION = 1.1-20120215 +DIALOG_SOURCE = ftp://dickey.his.com/dialog/dialog-$(DIALOG_VERSION).tgz + +NCURSES_HEADER = $(CLFS)/usr/include/ncurses.h -all: busybox initramfs +.PHONY: all check-root busybox dialog initramfs clean distclean -clean: busybox-clean initramfs-clean +all: busybox dialog initramfs -dist-clean: busybox-distclean gen_init_cpio-distclean initramfs-distclean +clean: busybox-clean dialog-clean initramfs-clean + +dist-clean: busybox-distclean dialog-distclean gen_init_cpio-distclean initramfs-distclean check-root: @if [ "$$UID" != "0" ]; then \ @@ -40,13 +48,15 @@ $(WORK)/busybox-$(BUSYBOX_VERSION): $(WORK)/busybox-$(BUSYBOX_VERSION).tar.bz2 $ cp -v $(PWD)/busybox-$(BUSYBOX_VERSION).config $(WORK)/busybox-$(BUSYBOX_VERSION)/.config touch $(WORK)/busybox-$(BUSYBOX_VERSION).tar.bz2 -$(WORK)/busybox-$(BUSYBOX_VERSION)/_install: $(WORK)/busybox-$(BUSYBOX_VERSION) +$(WORK)/busybox-$(BUSYBOX_VERSION)/_install/bin/busybox: $(WORK)/busybox-$(BUSYBOX_VERSION) export PATH=$(CROSSTOOLS)/bin:$$PATH && \ export LD_LIBRARY_PATH=$(CROSSTOOLS)/lib:$$LD_LIBRARY_PATH && \ - make -C $(WORK)/busybox-$(BUSYBOX_VERSION) ARCH=arm CROSS_COMPILE=$(TARGET)- install - touch $(WORK)/busybox-$(BUSYBOX_VERSION)/_install + make -C $(WORK)/busybox-$(BUSYBOX_VERSION) ARCH=arm CROSS_COMPILE=$(TARGET)- install && \ + install -D -m 0755 $(WORK)/busybox-$(BUSYBOX_VERSION)/examples/udhcp/simple.script $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/usr/share/udhcpc/default.script && \ + $(TARGET)-strip $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/bin/busybox && \ + touch $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/bin/busybox -busybox: $(WORK)/busybox-$(BUSYBOX_VERSION)/_install +busybox: $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/bin/busybox busybox-clean: rm -vrf $(WORK)/busybox-$(BUSYBOX_VERSION) @@ -54,6 +64,33 @@ busybox-clean: busybox-distclean: busybox-clean rm -vf $(WORK)/busybox-$(BUSYBOX_VERSION).tar.bz2 +$(WORK)/dialog-$(DIALOG_VERSION).tgz: + wget -P $(WORK) -c $(DIALOG_SOURCE) + +$(WORK)/dialog-$(DIALOG_VERSION): $(WORK)/dialog-$(DIALOG_VERSION).tgz + tar -C $(WORK) -xvzf $(WORK)/dialog-$(DIALOG_VERSION).tgz + touch $(WORK)/dialog-$(DIALOG_VERSION) + +$(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog: $(WORK)/dialog-$(DIALOG_VERSION) + export PATH=$(CROSSTOOLS)/bin:$$PATH && \ + export LD_LIBRARY_PATH=$(CROSSTOOLS)/lib:$$LD_LIBRARY_PATH && \ + cd $(WORK)/dialog-$(DIALOG_VERSION) && \ + ./configure --build=$(BUILD) --host=$(TARGET) --prefix=/usr --with-ncursesw && \ + find -type f -name 'makefile' \ + -exec sed -e "s|-I/usr|-I$(CLFS)/usr|g" -e "s|-L/usr|-L$(CLFS)/usr|g" -i {} \; && \ + make CC="$(TARGET)-gcc -static" && \ + make DESTDIR=$(WORK)/dialog-$(DIALOG_VERSION)/_install install && \ + $(TARGET)-strip $(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog && \ + touch $(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog + +dialog: $(NCURSES_HEADER) $(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog + +dialog-clean: + rm -vrf $(WORK)/dialog-$(DIALOG_VERSION) + +dialog-distclean: dialog-clean + rm -vf $(WORK)/dialog-$(DIALOG_VERSION).tgz + $(WORK)/gen_init_cpio: $(WORK)/gen_init_cpio.c cd $(WORK) && \ $(CC) $(CFLAGS) -Wall -o gen_init_cpio gen_init_cpio.c @@ -65,16 +102,22 @@ gen_init_cpio-clean: gen_init_cpio-distclean: gen_init_cpio-clean -$(WORK)/initramfs.cpio.gz-$(KERNEL_VERSION): check-root $(WORK)/busybox-$(BUSYBOX_VERSION)/_install $(KERNEL_PATH) $(WORK)/gen_init_cpio $(WORK)/initramfs.lst - mkdir -p $(WORK)/mnt - cp -drv $(PWD)/filesystem/* $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/* $(WORK)/mnt - ln -s /bin/busybox $(WORK)/mnt/init +$(WORK)/initramfs.cpio.gz-$(KERNEL_VERSION): check-root busybox dialog $(TOPDIR)/filesystem $(WORK)/gen_init_cpio $(WORK)/initramfs.lst + mkdir -p $(WORK)/mnt/{etc,lib,usr/share/terminfo} + cp -dRv $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/* $(WORK)/mnt + install -v -m 0755 $(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog $(WORK)/mnt/usr/bin + cp -dRv $(CLFS)/lib/libnss_{files*,dns*} $(CLFS)/lib/libresolv* $(WORK)/mnt/lib + cp -dRv $(CLFS)/usr/share/terminfo/v $(WORK)/mnt/usr/share/terminfo + install -v -m 0644 $(TOPDIR)/filesystem/{fstab,inittab,profile,protocols,*.conf} $(WORK)/mnt/etc + install -v -m 0755 $(TOPDIR)/filesystem/rc $(WORK)/mnt/etc + install -v -m 0755 $(TOPDIR)/filesystem/{setup,crux} $(WORK)/mnt/usr/bin + /sbin/ldconfig -r $(WORK)/mnt cd $(WORK)/mnt && \ $(WORK)/gen_init_cpio $(WORK)/initramfs.lst | cpio -id && \ find * | cpio -H newc -o > $(WORK)/initramfs.cpio && \ gzip -v9 $(WORK)/initramfs.cpio mv $(WORK)/initramfs.cpio.gz{,-$(KERNEL_VERSION)} - rm -rf $(WORK)/mnt + #rm -rf $(WORK)/mnt initramfs: $(WORK)/initramfs.cpio.gz-$(KERNEL_VERSION) diff --git a/README b/README index e69de29..b806f12 100644 --- a/README +++ b/README @@ -0,0 +1 @@ +- to build 'dialog' you need 'ncurses' installed with pkgadd-cross in clfs diff --git a/busybox-1.18.4.config b/busybox-1.19.4.config similarity index 96% rename from busybox-1.18.4.config rename to busybox-1.19.4.config index 4192e8f..a9de529 100644 --- a/busybox-1.18.4.config +++ b/busybox-1.19.4.config @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.18.4 -# Mon May 16 16:22:43 2011 +# Busybox version: 1.19.4 +# Tue Mar 6 12:35:21 2012 # CONFIG_HAVE_DOT_CONFIG=y @@ -39,8 +39,8 @@ CONFIG_LAST_SUPPORTED_WCHAR=0 CONFIG_LONG_OPTS=y CONFIG_FEATURE_DEVPTS=y # CONFIG_FEATURE_CLEAN_UP is not set -# CONFIG_FEATURE_WTMP is not set # CONFIG_FEATURE_UTMP is not set +# CONFIG_FEATURE_WTMP is not set CONFIG_FEATURE_PIDFILE=y # CONFIG_FEATURE_SUID is not set # CONFIG_FEATURE_SUID_CONFIG is not set @@ -89,6 +89,8 @@ CONFIG_PREFIX="./_install" # # Busybox Library Tuning # +# CONFIG_FEATURE_SYSTEMD is not set +# CONFIG_FEATURE_RTMINMAX is not set CONFIG_PASSWORD_MINLEN=6 CONFIG_MD5_SIZE_VS_SPEED=2 CONFIG_FEATURE_FAST_TOP=y @@ -99,6 +101,7 @@ CONFIG_FEATURE_EDITING_MAX_LEN=1024 # CONFIG_FEATURE_EDITING_VI is not set CONFIG_FEATURE_EDITING_HISTORY=255 CONFIG_FEATURE_EDITING_SAVEHISTORY=y +CONFIG_FEATURE_REVERSE_SEARCH=y CONFIG_FEATURE_TAB_COMPLETION=y # CONFIG_FEATURE_USERNAME_COMPLETION is not set CONFIG_FEATURE_EDITING_FANCY_PROMPT=y @@ -106,6 +109,7 @@ CONFIG_FEATURE_EDITING_FANCY_PROMPT=y CONFIG_FEATURE_NON_POSIX_CP=y # CONFIG_FEATURE_VERBOSE_CP_MESSAGE is not set CONFIG_FEATURE_COPYBUF_KB=4 +CONFIG_FEATURE_SKIP_ROOTFS=y # CONFIG_MONOTONIC_SYSCALL is not set CONFIG_IOCTL_HEX2STR_ERROR=y CONFIG_FEATURE_HWIB=y @@ -169,12 +173,17 @@ CONFIG_DATE=y CONFIG_FEATURE_DATE_ISOFMT=y # CONFIG_FEATURE_DATE_NANO is not set CONFIG_FEATURE_DATE_COMPAT=y +CONFIG_ID=y +# CONFIG_GROUPS is not set CONFIG_TEST=y CONFIG_FEATURE_TEST_64=y +CONFIG_TOUCH=y CONFIG_TR=y CONFIG_FEATURE_TR_CLASSES=y CONFIG_FEATURE_TR_EQUIV=y CONFIG_BASE64=y +# CONFIG_WHO is not set +# CONFIG_USERS is not set CONFIG_CAL=y CONFIG_CATV=y CONFIG_CHGRP=y @@ -212,10 +221,8 @@ CONFIG_FSYNC=y CONFIG_HEAD=y CONFIG_FEATURE_FANCY_HEAD=y CONFIG_HOSTID=y -CONFIG_ID=y CONFIG_INSTALL=y CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y -CONFIG_LENGTH=y CONFIG_LN=y CONFIG_LOGNAME=y CONFIG_LS=y @@ -267,7 +274,6 @@ CONFIG_TAIL=y CONFIG_FEATURE_FANCY_TAIL=y CONFIG_TEE=y CONFIG_FEATURE_TEE_USE_BLOCK_IO=y -CONFIG_TOUCH=y CONFIG_TRUE=y CONFIG_TTY=y CONFIG_UNAME=y @@ -279,7 +285,6 @@ CONFIG_UUDECODE=y CONFIG_UUENCODE=y CONFIG_WC=y CONFIG_FEATURE_WC_LARGE=y -# CONFIG_WHO is not set CONFIG_WHOAMI=y CONFIG_YES=y @@ -350,20 +355,13 @@ CONFIG_WHICH=y # Editors # CONFIG_PATCH=y -CONFIG_AWK=y -CONFIG_FEATURE_AWK_LIBM=y -CONFIG_CMP=y -CONFIG_DIFF=y -CONFIG_FEATURE_DIFF_LONG_OPTIONS=y -CONFIG_FEATURE_DIFF_DIR=y -CONFIG_ED=y -CONFIG_SED=y CONFIG_VI=y CONFIG_FEATURE_VI_MAX_LEN=4096 # CONFIG_FEATURE_VI_8BIT is not set CONFIG_FEATURE_VI_COLON=y CONFIG_FEATURE_VI_YANKMARK=y CONFIG_FEATURE_VI_SEARCH=y +# CONFIG_FEATURE_VI_REGEX_SEARCH is not set CONFIG_FEATURE_VI_USE_SIGNALS=y CONFIG_FEATURE_VI_DOT_CMD=y CONFIG_FEATURE_VI_READONLY=y @@ -372,6 +370,14 @@ CONFIG_FEATURE_VI_SET=y CONFIG_FEATURE_VI_WIN_RESIZE=y CONFIG_FEATURE_VI_ASK_TERMINAL=y CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y +CONFIG_AWK=y +CONFIG_FEATURE_AWK_LIBM=y +CONFIG_CMP=y +CONFIG_DIFF=y +CONFIG_FEATURE_DIFF_LONG_OPTIONS=y +CONFIG_FEATURE_DIFF_DIR=y +CONFIG_ED=y +CONFIG_SED=y CONFIG_FEATURE_ALLOW_EXEC=y # @@ -430,6 +436,7 @@ CONFIG_FEATURE_INIT_COREDUMPS=y CONFIG_FEATURE_INITRD=y CONFIG_INIT_TERMINAL_TYPE="linux" CONFIG_MESG=y +# CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP is not set # # Login/Password Management Utilities @@ -515,6 +522,7 @@ CONFIG_REV=y CONFIG_ACPID=y CONFIG_FEATURE_ACPID_COMPAT=y CONFIG_BLKID=y +CONFIG_FEATURE_BLKID_TYPE=y CONFIG_DMESG=y CONFIG_FEATURE_DMESG_PRETTY=y CONFIG_FBSET=y @@ -523,7 +531,7 @@ CONFIG_FEATURE_FBSET_READMODE=y CONFIG_FDFLUSH=y CONFIG_FDFORMAT=y CONFIG_FDISK=y -CONFIG_FDISK_SUPPORT_LARGE_DISKS=y +# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set CONFIG_FEATURE_FDISK_WRITABLE=y # CONFIG_FEATURE_AIX_LABEL is not set # CONFIG_FEATURE_SGI_LABEL is not set @@ -538,7 +546,7 @@ CONFIG_FSCK_MINIX=y CONFIG_MKFS_EXT2=y CONFIG_MKFS_MINIX=y CONFIG_FEATURE_MINIX2=y -# CONFIG_MKFS_REISER is not set +CONFIG_MKFS_REISER=y CONFIG_MKFS_VFAT=y CONFIG_GETOPT=y CONFIG_FEATURE_GETOPT_LONG=y @@ -618,10 +626,25 @@ CONFIG_FEATURE_VOLUMEID_LINUXRAID=y # Miscellaneous Utilities # # CONFIG_CONSPY is not set +CONFIG_LESS=y +CONFIG_FEATURE_LESS_MAXLINES=9999999 +CONFIG_FEATURE_LESS_BRACKETS=y +CONFIG_FEATURE_LESS_FLAGS=y +CONFIG_FEATURE_LESS_MARKS=y +CONFIG_FEATURE_LESS_REGEXP=y +CONFIG_FEATURE_LESS_WINCH=y +CONFIG_FEATURE_LESS_ASK_TERMINAL=y +CONFIG_FEATURE_LESS_DASHCMD=y +CONFIG_FEATURE_LESS_LINENUMS=y CONFIG_NANDWRITE=y CONFIG_NANDDUMP=y +CONFIG_SETSERIAL=y CONFIG_UBIATTACH=y CONFIG_UBIDETACH=y +CONFIG_UBIMKVOL=y +CONFIG_UBIRMVOL=y +CONFIG_UBIRSVOL=y +CONFIG_UBIUPDATEVOL=y CONFIG_ADJTIMEX=y # CONFIG_BBCONFIG is not set # CONFIG_FEATURE_COMPRESS_BBCONFIG is not set @@ -662,15 +685,6 @@ CONFIG_INOTIFYD=y # CONFIG_LAST is not set # CONFIG_FEATURE_LAST_SMALL is not set # CONFIG_FEATURE_LAST_FANCY is not set -CONFIG_LESS=y -CONFIG_FEATURE_LESS_MAXLINES=9999999 -CONFIG_FEATURE_LESS_BRACKETS=y -CONFIG_FEATURE_LESS_FLAGS=y -CONFIG_FEATURE_LESS_MARKS=y -CONFIG_FEATURE_LESS_REGEXP=y -CONFIG_FEATURE_LESS_WINCH=y -CONFIG_FEATURE_LESS_DASHCMD=y -CONFIG_FEATURE_LESS_LINENUMS=y CONFIG_HDPARM=y CONFIG_FEATURE_HDPARM_GET_IDENTITY=y CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF=y @@ -688,7 +702,7 @@ CONFIG_MT=y CONFIG_RAIDAUTORUN=y CONFIG_READAHEAD=y CONFIG_RFKILL=y -CONFIG_RUNLEVEL=y +# CONFIG_RUNLEVEL is not set CONFIG_RX=y CONFIG_SETSID=y CONFIG_STRINGS=y @@ -698,17 +712,23 @@ CONFIG_TIME=y CONFIG_TIMEOUT=y CONFIG_TTYSIZE=y CONFIG_VOLNAME=y -CONFIG_WALL=y +# CONFIG_WALL is not set CONFIG_WATCHDOG=y # # Networking Utilities # +CONFIG_NAMEIF=y +CONFIG_FEATURE_NAMEIF_EXTENDED=y CONFIG_NBDCLIENT=y CONFIG_NC=y CONFIG_NC_SERVER=y CONFIG_NC_EXTRA=y # CONFIG_NC_110_COMPAT is not set +CONFIG_PING=y +CONFIG_PING6=y +CONFIG_FEATURE_FANCY_PING=y +CONFIG_WHOIS=y CONFIG_FEATURE_IPV6=y # CONFIG_FEATURE_UNIX_LOCAL is not set CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y @@ -781,17 +801,12 @@ CONFIG_IPRULE=y CONFIG_IPCALC=y CONFIG_FEATURE_IPCALC_FANCY=y CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y -CONFIG_NAMEIF=y -CONFIG_FEATURE_NAMEIF_EXTENDED=y CONFIG_NETSTAT=y CONFIG_FEATURE_NETSTAT_WIDE=y CONFIG_FEATURE_NETSTAT_PRG=y CONFIG_NSLOOKUP=y CONFIG_NTPD=y CONFIG_FEATURE_NTPD_SERVER=y -CONFIG_PING=y -CONFIG_PING6=y -CONFIG_FEATURE_FANCY_PING=y CONFIG_PSCAN=y CONFIG_ROUTE=y CONFIG_SLATTACH=y @@ -824,12 +839,14 @@ CONFIG_UDHCPD=y CONFIG_DHCPRELAY=y CONFIG_DUMPLEASES=y CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y +# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases" CONFIG_UDHCPC=y CONFIG_FEATURE_UDHCPC_ARPING=y CONFIG_FEATURE_UDHCP_PORT=y CONFIG_UDHCP_DEBUG=9 CONFIG_FEATURE_UDHCP_RFC3397=y +CONFIG_FEATURE_UDHCP_8021Q=y CONFIG_UDHCPC_DEFAULT_SCRIPT="/usr/share/udhcpc/default.script" CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=80 CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="-R -n" @@ -865,15 +882,19 @@ CONFIG_SENDMAIL=y # CONFIG_IOSTAT=y CONFIG_MPSTAT=y +CONFIG_NMETER=y CONFIG_PMAP=y CONFIG_POWERTOP=y +CONFIG_PSTREE=y +CONFIG_PWDX=y CONFIG_SMEMCAP=y +CONFIG_UPTIME=y +# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set CONFIG_FREE=y CONFIG_FUSER=y CONFIG_KILL=y CONFIG_KILLALL=y CONFIG_KILLALL5=y -CONFIG_NMETER=y CONFIG_PGREP=y CONFIG_PIDOF=y CONFIG_FEATURE_PIDOF_SINGLE=y @@ -894,7 +915,6 @@ CONFIG_FEATURE_TOP_DECIMALS=y CONFIG_FEATURE_TOP_SMP_PROCESS=y CONFIG_FEATURE_TOPMEM=y CONFIG_FEATURE_SHOW_THREADS=y -CONFIG_UPTIME=y CONFIG_WATCH=y # @@ -932,6 +952,7 @@ CONFIG_SOFTLIMIT=y # CONFIG_ASH=y CONFIG_ASH_BASH_COMPAT=y +# CONFIG_ASH_IDLE_TIMEOUT is not set CONFIG_ASH_JOB_CONTROL=y CONFIG_ASH_ALIAS=y CONFIG_ASH_GETOPTS=y @@ -972,6 +993,7 @@ CONFIG_SH_MATH_SUPPORT_64=y CONFIG_FEATURE_SH_EXTRA_QUIET=y # CONFIG_FEATURE_SH_STANDALONE is not set # CONFIG_FEATURE_SH_NOFORK is not set +CONFIG_FEATURE_SH_HISTFILESIZE=y # # System Logging Utilities @@ -980,6 +1002,7 @@ CONFIG_SYSLOGD=y CONFIG_FEATURE_ROTATE_LOGFILE=y CONFIG_FEATURE_REMOTE_LOG=y CONFIG_FEATURE_SYSLOGD_DUP=y +CONFIG_FEATURE_SYSLOGD_CFG=y CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256 CONFIG_FEATURE_IPC_SYSLOG=y CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16 diff --git a/filesystem/crux b/filesystem/crux index ac2d1b1..04ec127 100755 --- a/filesystem/crux +++ b/filesystem/crux @@ -1,5 +1,5 @@ #! /bin/sh -echo "CRUX-ARM 2.7" +echo "CRUX 2.7" # End of file diff --git a/filesystem/profile b/filesystem/profile index d41d6fa..40423b9 100644 --- a/filesystem/profile +++ b/filesystem/profile @@ -2,6 +2,6 @@ # /etc/profile # -export PS1="\\033[1mcrux-arm:\w \$ \\033[0m" +export PS1="\[\033[1m\]\\$ \[\033[0m\]" # End of file diff --git a/filesystem/rc b/filesystem/rc index 151f232..8fd3474 100755 --- a/filesystem/rc +++ b/filesystem/rc @@ -1,39 +1,151 @@ #!/bin/sh + # -# /etc/rc: Init startup script +# initramfs /init (busybox ash) # -exec > /dev/console < /dev/console 2>&1 +# color codes and some predefined texts +BOLD="\033[1m" +NORM="\033[0m" +RED="\033[31m" +GREEN="\033[32m" +YELLOW="\033[33m" +BLUE="\033[34m" +OK="${BOLD}${GREEN}OK${NORM}" +FAILED="${BOLD}${RED}FAILED${NORM}" + +# helper functions + +# check an exit value and print a colored status +checkReturn() { + if [ $? -ne 0 ] + then + echo -e $FAILED + else + echo -e $OK + fi +} -echo "The system is coming up. Please wait." +# search for and mount the crux media, populate a tmpfs from it, +# and prepare /newroot for switch_root at the end of the script +find_and_mount_media() { + echo -e " ${BOLD}${BLUE}*${NORM} Searching for the CRUX media..." + mkdir -p /media + CRUXMEDIA="" + MMC_DEVICES="`grep -E 'mmcblk' /proc/partitions | awk '{ print $4 }'`" + BLOCK_DEVICES="`grep -E '[sh]d' /proc/partitions | awk '{ print $4 }'`" + for DEV in $MMC_DEVICES $BLOCK_DEVICES + do + DEV="/dev/$DEV" + mount -r $DEV /media 2> /dev/null + if [ $? -eq 0 ] + then + echo -e -n " ${BOLD}${GREEN}*${NORM} Found media on $DEV" + if [ -e /media/crux-media ] + then + echo ", CRUX media." + CRUXMEDIA=$DEV + ln -s $DEV /dev/media + break + else + echo ", but it's not the CRUX media." + umount /media + fi + else + echo -e " ${BOLD}${YELLOW}*${NORM} No media found on $DEV." + fi + done -# Mounting filesystems -/bin/mount -v -a + # check if the media was mounted properly. if not, spawn a shell + if [ ! -e /media/crux-media ] + then + echo + echo -e " ${BOLD}${RED}*${NORM} The CRUX media was not properly mounted!" + echo " Spawning a shell for you to attempt to fix this problem. If" + echo " you are able to find the correct device, mount it at" + echo " /media and then log out of this shell to continue." + echo " If you are NOT able to fix the problem, installation will" + echo " not be possible." + echo + /bin/sh + fi -# Remounting root filesystem (rw) -/bin/mount -o remount,rw / + # check again and stop if it's still not there + if [ ! -e /media/crux-media ] + then + echo + echo -e " ${BOLD}${RED}*${NORM} The CRUX media still appears not to be" + echo " found and installation will not continue." + echo + else + # configure modules + MODULES="`find /media/crux/kernel -type f -name 'modules-*.tar.*'`" + if [ ! -z "$MODULES" ]; then + tar -C /tmp -xf $MODULES + cd /lib && ln -s /tmp/lib/* . + depmod + fi + # configure pkgutils + PKGUTILS="`find /media/crux/core -type f -name 'pkgutils#*.pkg.tar.*'`" + if [ ! -z "$PKGUTILS" ]; then + tar -C /tmp -xf $PKGUTILS + cd /usr/bin && ln -s /tmp/usr/bin/* . + cd /etc && ln -s /tmp/etc/* . + fi + fi +} + +# +# main script +# -# Populating /dev -/sbin/mdev -s +echo "" +echo -e "${BOLD}CRUX-ARM 2.7.1 - ${BLUE}http://crux-arm.nu/${NORM}" +echo "" -# Registering mdev as hotplug agent +exec >/dev/console &1 + +echo -e -n " ${BOLD}${BLUE}*${NORM} Mounting filesystems... " +mount -a && \ +mount -o remount,rw / +checkReturn + +echo -e -n " ${BOLD}${BLUE}*${NORM} Populating /dev via mdev... " +mdev -s +checkReturn + +echo -e -n " ${BOLD}${BLUE}*${NORM} Registering mdev as hotplug agent... " echo "/bin/mdev" > /proc/sys/kernel/hotplug +checkReturn + +echo -e -n " ${BOLD}${BLUE}*${NORM} Creating and mounting /dev/pts... " +mkdir /dev/pts +mount -t devpts devpts /dev/pts +checkReturn + +echo -e -n " ${BOLD}${BLUE}*${NORM} Starting kernel log daemon... " +klogd +checkReturn -# Creating and mounting /dev/pts -/bin/mkdir /dev/pts -/bin/mount -t devpts devpts /dev/pts +echo -e -n " ${BOLD}${BLUE}*${NORM} Setting hostname... " +hostname crux +checkReturn -# Starting kernel log daemon -/sbin/klogd +echo -e -n " ${BOLD}${BLUE}*${NORM} Loading network loopback device... " +ip addr add 127.0.0.1/8 dev lo broadcast + scope host && \ +ip link set lo up && \ +echo "127.0.0.1 localhost crux" > /etc/hosts +checkReturn -# Setting hostname -/bin/hostname "crux-arm" +echo -e -n " ${BOLD}${BLUE}*${NORM} Saving boot messages... " +dmesg > /var/log/boot +checkReturn -# Loading network loopback device -/bin/ip addr add 127.0.0.1/8 dev lo broadcast + scope host -/bin/ip link set lo up +echo -e " ${BOLD}${BLUE}*${NORM} Trying to find and mount the media installer..." +find_and_mount_media -# Saving boot messages -/bin/dmesg > /var/log/boot +echo +echo "The system is coming up. Please wait." +echo # End of file