From: Jose V Beneyto Date: Fri, 18 Oct 2013 10:17:12 +0000 (+0000) Subject: Initial set of updated for 3.0 (merged from initrd repo) X-Git-Url: http://gitweb/?a=commitdiff_plain;h=cd4b042f363c4e4bf78a8e28ada16756ef5e3fc3;p=initramfs.git Initial set of updated for 3.0 (merged from initrd repo) --- diff --git a/Makefile b/Makefile index d5dd20b..bc9d2ae 100644 --- a/Makefile +++ b/Makefile @@ -2,31 +2,31 @@ # initramfs/Makefile # -PWD = $(shell pwd) +TOPDIR = $(shell pwd) -include $(PWD)/../toolchain/vars.mk +include $(TOPDIR)/../toolchain/vars.mk -TARGET = arm-crux-linux-gnueabi -DEVICE = versatile +TARGET = arm-crux-linux-gnueabihf -WORK = $(PWD)/work -CLFS = $(PWD)/../toolchain/clfs -CROSSTOOLS = $(PWD)/../toolchain/crosstools +WORK = $(TOPDIR)/work +CLFS = $(TOPDIR)/../toolchain/clfs +CROSSTOOLS = $(TOPDIR)/../toolchain/crosstools +BUSYBOX_VERSION = 1.21.1 +BUSYBOX_SOURCE = http://busybox.net/downloads/busybox-$(BUSYBOX_VERSION).tar.bz2 -KERNEL_PATH = $(PWD)/../kernel/$(DEVICE) -KERNEL_VERSION = $(shell grep '^KERNEL_VERSION = ' $(KERNEL_PATH)/Makefile | sed 's|KERNEL_VERSION = ||') +DIALOG_VERSION = 1.2-20130523 +DIALOG_SOURCE = ftp://invisible-island.net/dialog/dialog-$(DIALOG_VERSION).tgz -BUSYBOX_VERSION = 1.20.2 -BUSYBOX_SOURCE = http://busybox.net/downloads/busybox-$(BUSYBOX_VERSION).tar.bz2 +NCURSES_HEADER = $(CLFS)/usr/include/ncurses.h -.PHONY: all check-root busybox gen_init_cpio initramfs clean distclean +.PHONY: all check-root busybox dialog gen_init_cpio initramfs clean distclean -all: busybox gen_init_cpio initramfs +all: initramfs -clean: busybox-clean gen_init_cpio-clean initramfs-clean +clean: busybox-clean dialog-clean gen_init_cpio-clean initramfs-clean -distclean: busybox-distclean gen_init_cpio-distclean initramfs-distclean +distclean: busybox-distclean dialog-distclean gen_init_cpio-distclean initramfs-distclean check-root: @if [ "$$UID" != "0" ]; then \ @@ -36,21 +36,24 @@ check-root: fi $(WORK)/busybox-$(BUSYBOX_VERSION).tar.bz2: - wget -P $(WORK) -c http://busybox.net/downloads/busybox-$(BUSYBOX_VERSION).tar.bz2 + wget -P $(WORK) -c $(BUSYBOX_SOURCE) -$(WORK)/busybox-$(BUSYBOX_VERSION): $(WORK)/busybox-$(BUSYBOX_VERSION).tar.bz2 $(PWD)/busybox-$(BUSYBOX_VERSION).config +$(WORK)/busybox-$(BUSYBOX_VERSION): $(WORK)/busybox-$(BUSYBOX_VERSION).tar.bz2 $(TOPDIR)/busybox-$(BUSYBOX_VERSION).config $(WORK)/fix-resource_header.patch tar -C $(WORK) -xvjf $(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 + cd $(WORK)/busybox-$(BUSYBOX_VERSION) && \ + patch -p1 -i $(WORK)/fix-resource_header.patch + cp -v $(TOPDIR)/busybox-$(BUSYBOX_VERSION).config $(WORK)/busybox-$(BUSYBOX_VERSION)/.config + touch $(WORK)/busybox-$(BUSYBOX_VERSION) -$(WORK)/busybox-$(BUSYBOX_VERSION)/busybox: $(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)- && \ - $(TARGET)-strip $(WORK)/busybox-$(BUSYBOX_VERSION)/busybox && \ - touch $(WORK)/busybox-$(BUSYBOX_VERSION)/busybox + 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)/busybox +busybox: $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/bin/busybox busybox-clean: rm -vrf $(WORK)/busybox-$(BUSYBOX_VERSION) @@ -58,6 +61,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 @@ -69,15 +99,42 @@ gen_init_cpio-clean: gen_init_cpio-distclean: gen_init_cpio-clean -$(WORK)/initramfs: check-root busybox $(WORK)/gen_init_cpio $(PWD)/init $(PWD)/initramfs.lst - sed -e "s/#KERNEL_VERSION#/$(KERNEL_VERSION)/g; s/#BUSYBOX_VERSION#/$(BUSYBOX_VERSION)/g" \ - $(PWD)/initramfs.lst > $(WORK)/initramfs.lst - $(WORK)/gen_init_cpio $(WORK)/initramfs.lst > $(WORK)/initramfs +$(WORK)/mnt: + mkdir -p $(WORK)/mnt + +$(WORK)/initramfs: check-root busybox dialog $(WORK)/mnt gen_init_cpio $(TOPDIR)/filesystem + install -d -m 0755 $(WORK)/mnt/{mnt,media,etc,dev,sys,proc,lib,usr,var/{log,lock,run},tmp} + mknod $(WORK)/mnt/dev/console c 5 1 && chmod 666 $(WORK)/mnt/dev/console + mknod $(WORK)/mnt/dev/null c 1 3 && chmod 666 $(WORK)/mnt/dev/null + mknod $(WORK)/mnt/dev/tty c 5 0 && chmod 666 $(WORK)/mnt/dev/tty + mkdir $(WORK)/mnt/dev/rd && mknod $(WORK)/mnt/dev/rd/0 b 1 0 + mknod $(WORK)/mnt/dev/ram0 b 1 0 && chmod 600 $(WORK)/mnt/dev/ram0 + for i in 0 1 2 3 4 5 6 7; do \ + mknod $(WORK)/mnt/dev/tty$$i c 4 $$i && chmod 666 $(WORK)/mnt/dev/tty$$i; \ + done + 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 + install -d $(WORK)/mnt/usr/share/terminfo + 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 0664 $(TOPDIR)/filesystem/group $(WORK)/mnt/etc + install -v -m 0600 $(TOPDIR)/filesystem/passwd $(WORK)/mnt/etc + install -v -m 0400 $(TOPDIR)/filesystem/shadow $(WORK)/mnt/etc + install -v -m 0755 $(TOPDIR)/filesystem/rc $(WORK)/mnt/etc && \ + install -v -m 0755 $(TOPDIR)/filesystem/{setup,setup-chroot,crux} $(WORK)/mnt/usr/bin && \ + /sbin/ldconfig -r $(WORK)/mnt && \ + cd $(WORK)/mnt && \ + find . | cpio -o -H newc > $(WORK)/initramfs.cpio && \ + cd $(WORK) && \ + gzip -v initramfs.cpio && \ + cp $(WORK)/initramfs{.cpio.gz,} && \ + touch $(WORK)/initramfs initramfs: $(WORK)/initramfs initramfs-clean: - rm -f $(WORK)/initramfs $(WORK)/initramfs.lst + rm -f $(WORK)/initramfs initramfs-distclean: initramfs-clean diff --git a/busybox-1.20.2.config b/busybox-1.21.1.config similarity index 96% rename from busybox-1.20.2.config rename to busybox-1.21.1.config index 9071160..9e5fdf1 100644 --- a/busybox-1.20.2.config +++ b/busybox-1.21.1.config @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.20.2 -# Wed Jul 4 09:01:16 2012 +# Busybox version: 1.21.1 +# Wed Aug 14 10:26:37 2013 # CONFIG_HAVE_DOT_CONFIG=y @@ -23,7 +23,7 @@ CONFIG_FEATURE_BUFFERS_USE_MALLOC=y CONFIG_SHOW_USAGE=y CONFIG_FEATURE_VERBOSE_USAGE=y # CONFIG_FEATURE_COMPRESS_USAGE is not set -CONFIG_FEATURE_INSTALLER=y +# CONFIG_FEATURE_INSTALLER is not set # CONFIG_INSTALL_NO_USR is not set # CONFIG_LOCALE_SUPPORT is not set # CONFIG_UNICODE_SUPPORT is not set @@ -42,6 +42,7 @@ CONFIG_FEATURE_DEVPTS=y # CONFIG_FEATURE_UTMP is not set # CONFIG_FEATURE_WTMP is not set CONFIG_FEATURE_PIDFILE=y +CONFIG_PID_FILE_PATH="/var/run" # CONFIG_FEATURE_SUID is not set # CONFIG_FEATURE_SUID_CONFIG is not set # CONFIG_FEATURE_SUID_CONFIG_QUIET is not set @@ -62,8 +63,8 @@ CONFIG_STATIC=y # CONFIG_FEATURE_SHARED_BUSYBOX is not set CONFIG_LFS=y CONFIG_CROSS_COMPILER_PREFIX="arm-crux-linux-gnueabi-" -CONFIG_SYSROOT="../../../toolchain/clfs" -CONFIG_EXTRA_CFLAGS="" +CONFIG_SYSROOT="" +CONFIG_EXTRA_CFLAGS="-mno-unaligned-access" CONFIG_EXTRA_LDFLAGS="" CONFIG_EXTRA_LDLIBS="" @@ -95,7 +96,8 @@ CONFIG_PREFIX="./_install" # CONFIG_FEATURE_SYSTEMD is not set # CONFIG_FEATURE_RTMINMAX is not set CONFIG_PASSWORD_MINLEN=6 -CONFIG_MD5_SMALL=2 +CONFIG_MD5_SMALL=1 +CONFIG_SHA3_SMALL=1 CONFIG_FEATURE_FAST_TOP=y # CONFIG_FEATURE_ETC_NETWORKS is not set CONFIG_FEATURE_USE_TERMIOS=y @@ -144,7 +146,7 @@ CONFIG_FEATURE_CPIO_P=y CONFIG_GUNZIP=y CONFIG_GZIP=y CONFIG_FEATURE_GZIP_LONG_OPTIONS=y -CONFIG_GZIP_FAST=2 +CONFIG_GZIP_FAST=0 CONFIG_LZOP=y # CONFIG_LZOP_COMPR_HIGH is not set CONFIG_RPM2CPIO=y @@ -263,6 +265,7 @@ CONFIG_SEQ=y CONFIG_SHA1SUM=y CONFIG_SHA256SUM=y CONFIG_SHA512SUM=y +CONFIG_SHA3SUM=y CONFIG_SLEEP=y CONFIG_FEATURE_FANCY_SLEEP=y CONFIG_FEATURE_FLOAT_SLEEP=y @@ -310,7 +313,7 @@ CONFIG_FEATURE_AUTOWIDTH=y CONFIG_FEATURE_HUMAN_READABLE=y # -# Common options for md5sum, sha1sum, sha256sum, sha512sum +# Common options for md5sum, sha1sum, sha256sum, sha512sum, sha3sum # CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y @@ -375,7 +378,6 @@ CONFIG_FEATURE_VI_SETOPTS=y 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 @@ -616,9 +618,11 @@ CONFIG_FEATURE_VOLUMEID_EXT=y CONFIG_FEATURE_VOLUMEID_BTRFS=y CONFIG_FEATURE_VOLUMEID_REISERFS=y CONFIG_FEATURE_VOLUMEID_FAT=y +CONFIG_FEATURE_VOLUMEID_EXFAT=y CONFIG_FEATURE_VOLUMEID_HFS=y CONFIG_FEATURE_VOLUMEID_JFS=y CONFIG_FEATURE_VOLUMEID_XFS=y +CONFIG_FEATURE_VOLUMEID_NILFS=y CONFIG_FEATURE_VOLUMEID_NTFS=y CONFIG_FEATURE_VOLUMEID_ISO9660=y CONFIG_FEATURE_VOLUMEID_UDF=y @@ -626,6 +630,7 @@ CONFIG_FEATURE_VOLUMEID_LUKS=y CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y CONFIG_FEATURE_VOLUMEID_CRAMFS=y CONFIG_FEATURE_VOLUMEID_ROMFS=y +CONFIG_FEATURE_VOLUMEID_SQUASHFS=y CONFIG_FEATURE_VOLUMEID_SYSV=y CONFIG_FEATURE_VOLUMEID_OCFS2=y CONFIG_FEATURE_VOLUMEID_LINUXRAID=y @@ -786,13 +791,13 @@ CONFIG_FEATURE_IFUPDOWN_IPV4=y CONFIG_FEATURE_IFUPDOWN_IPV6=y CONFIG_FEATURE_IFUPDOWN_MAPPING=y # CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP is not set -CONFIG_INETD=y -CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO=y -CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD=y -CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME=y -CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME=y -CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN=y -CONFIG_FEATURE_INETD_RPC=y +# CONFIG_INETD is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set +# CONFIG_FEATURE_INETD_RPC is not set CONFIG_IP=y CONFIG_FEATURE_IP_ADDRESS=y CONFIG_FEATURE_IP_LINK=y @@ -898,6 +903,13 @@ CONFIG_POWERTOP=y CONFIG_PSTREE=y CONFIG_PWDX=y CONFIG_SMEMCAP=y +CONFIG_TOP=y +CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y +CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y +CONFIG_FEATURE_TOP_SMP_CPU=y +CONFIG_FEATURE_TOP_DECIMALS=y +CONFIG_FEATURE_TOP_SMP_PROCESS=y +CONFIG_FEATURE_TOPMEM=y CONFIG_UPTIME=y # CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set CONFIG_FREE=y @@ -918,13 +930,6 @@ CONFIG_FEATURE_PS_LONG=y # CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set CONFIG_RENICE=y CONFIG_BB_SYSCTL=y -CONFIG_TOP=y -CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y -CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y -CONFIG_FEATURE_TOP_SMP_CPU=y -CONFIG_FEATURE_TOP_DECIMALS=y -CONFIG_FEATURE_TOP_SMP_PROCESS=y -CONFIG_FEATURE_TOPMEM=y CONFIG_FEATURE_SHOW_THREADS=y CONFIG_WATCH=y @@ -1019,6 +1024,11 @@ CONFIG_FEATURE_IPC_SYSLOG=y CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16 CONFIG_LOGREAD=y CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y +CONFIG_FEATURE_KMSG_SYSLOG=y CONFIG_KLOGD=y + +# +# klogd should not be used together with syslog to kernel printk buffer +# CONFIG_FEATURE_KLOGD_KLOGCTL=y CONFIG_LOGGER=y diff --git a/filesystem/crux b/filesystem/crux new file mode 100755 index 0000000..2c2d764 --- /dev/null +++ b/filesystem/crux @@ -0,0 +1,5 @@ +#! /bin/sh + +echo "CRUX-ARM 3.0" + +# End of file diff --git a/filesystem/fstab b/filesystem/fstab new file mode 100644 index 0000000..6ae5af6 --- /dev/null +++ b/filesystem/fstab @@ -0,0 +1,9 @@ +# +# /etc/fstab: static file system information +# + +none /sys sysfs defaults 0 0 +none /proc proc defaults 0 0 +tmp /tmp tmpfs defaults 0 0 + +# End of file diff --git a/filesystem/group b/filesystem/group new file mode 100644 index 0000000..18acc30 --- /dev/null +++ b/filesystem/group @@ -0,0 +1 @@ +root:x:0:root diff --git a/filesystem/inittab b/filesystem/inittab new file mode 100644 index 0000000..9a7cb0f --- /dev/null +++ b/filesystem/inittab @@ -0,0 +1,17 @@ +# +# /etc/inittab +# + +::sysinit:/etc/rc +::restart:/sbin/init +::ctrlaltdel:/sbin/init +::shutdown:/sbin/swapoff -a +::shutdown:/bin/umount -a -r + +::askfirst:-/bin/sh + +tty2::askfirst:-/bin/sh +tty3::askfirst:-/bin/sh +tty4::askfirst:-/bin/sh + +# End of file diff --git a/filesystem/ld.so.conf b/filesystem/ld.so.conf new file mode 100644 index 0000000..2227e1e --- /dev/null +++ b/filesystem/ld.so.conf @@ -0,0 +1,5 @@ +# +# /etc/ld.so.conf +# + +# End of file diff --git a/filesystem/mdev.conf b/filesystem/mdev.conf new file mode 100644 index 0000000..589a5f5 --- /dev/null +++ b/filesystem/mdev.conf @@ -0,0 +1,5 @@ +# +# /etc/mdev.conf +# + +# End of file diff --git a/filesystem/nsswitch.conf b/filesystem/nsswitch.conf new file mode 100644 index 0000000..ef1f6b3 --- /dev/null +++ b/filesystem/nsswitch.conf @@ -0,0 +1,24 @@ +# +# /etc/nsswitch.conf: name service switch configuration file +# + +passwd: files +group: files +shadow: files + +hosts: files dns +networks: files + +services: files +protocols: files +rpc: files +publickey: files +ethers: files +netmasks: files +netgroup: files +bootparams: files + +automount: files +aliases: files + +# End of file diff --git a/filesystem/passwd b/filesystem/passwd new file mode 100644 index 0000000..5183638 --- /dev/null +++ b/filesystem/passwd @@ -0,0 +1 @@ +root:x:0:0:root:/:/bin/sh diff --git a/filesystem/profile b/filesystem/profile new file mode 100644 index 0000000..40423b9 --- /dev/null +++ b/filesystem/profile @@ -0,0 +1,7 @@ +# +# /etc/profile +# + +export PS1="\[\033[1m\]\\$ \[\033[0m\]" + +# End of file diff --git a/filesystem/protocols b/filesystem/protocols new file mode 100644 index 0000000..becf37f --- /dev/null +++ b/filesystem/protocols @@ -0,0 +1,147 @@ +# $NetBSD: protocols,v 1.12.4.1 2006/12/02 12:58:19 bouyer Exp $ +# +# Internet (IP) protocols +# +# originally from: @(#)protocols 8.1 (Berkeley) 6/9/93 +# see http://www.iana.org/assignments/protocol-numbers +# +ip 0 IP # internet protocol, pseudo protocol number +icmp 1 ICMP # internet control message protocol +igmp 2 IGMP # internet group management protocol +ggp 3 GGP # gateway-gateway protocol +ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'') +st 5 ST # ST datagram mode +tcp 6 TCP # transmission control protocol +cbt 7 CBT +egp 8 EGP # exterior gateway protocol +igp 9 IGP # any private interior gateway protocol +bbn-rcc-mon 10 BBN-RCC-MON # BBN RCC Monitoring +nvp-ii 11 NVP-II # Network Voice Protocol +pup 12 PUP # PARC universal packet protocol +argus 13 ARGUS +emcon 14 EMCON +xnet 15 XNET # Cross net debugger +chaos 16 CHAOS # Chaos +udp 17 UDP # user datagram protocol +mux 18 MUX # Multiplexing +dcn-meas 19 DCN-MEAS # DCN Measurement Subsystems +hmp 20 HMP # host monitoring protocol +prm 21 PRM # Packet Radio Measurement +xns-idp 22 XNS-IDP # Xerox NS IDP +trunk-1 23 TRUNK-1 +trunk-2 24 TRUNK-2 +leaf-1 25 LEAF-1 +leaf-2 26 LEAF-2 +rdp 27 RDP # reliable data protocol +irtp 28 IRTP # Internet Reliable Transaction +iso-tp4 29 ISO-TP4 # ISO Transport Protocol Class 4 +netblt 30 NETBLT # Bulk Data Transfer Protocol +mfe-nsp 31 MFE-NSP # MFE Network Services Protocol +merit-inp 32 MERIT-INP # MERIT Internodal Protocol +sep 33 SEP # Sequential Exchange Protocol +3pc 34 3PC # Third Party Connect Protocol +idpr 35 IDPR # Inter-Domain Policy Routing Protocol +xtp 36 XTP # Xpress Transfer Protocol +ddp 37 DDP # Datagram Delivery Protocol +idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport +tp++ 39 TP++ # TP++ Transport Protocol +il 40 IL # IL Transport Protocol +ipv6 41 IPv6 # Internet Protocol, version 6 +sdrp 42 SDRP # Source Demand Routing Protocol +ipv6-route 43 IPv6-Route # Routing Header for IPv6 +ipv6-frag 44 IPv6-Frag # Fragment Header for IPv6 +idrp 45 IDRP # Inter-Domain Routing Protocol +rsvp 46 RSVP # Resource ReSerVation Protocol +gre 47 GRE # General Routing Encapsulation +mhrp 48 MHRP # Mobile Host Routing Protocol +bna 49 BNA +esp 50 ESP # Encapsulating Security Payload +ah 51 AH # Authentication Header +i-nlsp 52 I-NLSP # Integrated Net Layer Security +swipe 53 SWIPE # IP with Encryption +narp 54 NARP # NBMA Address Resolution Protocol +mobile 55 MOBILE # IP Mobility (IP tunneling) +tlsp 56 TLSP # Transport Layer Security Protocol +skip 57 SKIP +ipv6-icmp 58 IPv6-ICMP icmp6 # ICMP version 6 +ipv6-nonxt 59 IPv6-NoNxt # No Next Header for IPv6 +ipv6-opts 60 IPv6-Opts # Destination Options for IPv6 +# 61 # any host internal protocol +cftp 62 CFTP # CFTP +# 63 # any local network +sat-expak 64 SAT-expak # SATNET and Backroom EXPAK +kryptolan 65 KRYPTOLAN # Kryptolan +rvd 66 RVD # MIT Remote Virtual Disk Protocol +ippc 67 IPPC # Internet Pluribus Packet Core +# 68 # any distributed file system +sat-mon 69 SAT-MON # SATNET Monitoring +visa 70 VISA # VISA Protocol +ipcv 71 IPCV # Internet Packet Core Utility +cpnx 72 CPNX # Computer Protocol Network Executive +cphb 73 CPHB # Computer Protocol Heart Beat +wsn 74 WSN # Wang Span Network +pvp 75 PVP # Packet Video Protocol +br-sat-mon 76 BR-SAT-MON # Backroom SATNET Monitoring +sun-nd 77 SUN-ND # SUN ND PROTOCOL-Temporary +wb-mon 78 WB-MON # WIDEBAND Monitoring +wb-expak 79 WB-EXPAK # WIDEBAND EXPAK +iso-ip 80 ISO-IP # ISO Internet Protocol +vmtp 81 VMTP # Versatile Message Transport +secure-vmtp 82 SECURE-VMTP # SECURE-VMTP +vines 83 VINES +ttp 84 TTP +nsfnet-igp 85 NSFNET-IGP +dgp 86 DGP # Dissimilar Gateway Protocol +tcf 87 TCF +eigrp 88 EIGRP # Enhanced Inter-Gateway Routing Protocol +ospf 89 OSPFIGP # Open Shortest Path First IGP +sprite-rpc 90 Sprite-RPC # Sprite RPC Protocol +larp 91 LARP # Locus Address Resolution Protocol +mtp 92 MTP # Multicast Transport Protocol +ax.25 93 AX.25 # AX.25 Frames +ipip 94 IPIP # Yet Another IP encapsulation +micp 95 MICP # Mobile Internetworking Control Pro. +scc-sp 96 SCC-SP # Semaphore Communications Sec. Pro. +etherip 97 ETHERIP # Ethernet-within-IP Encapsulation +encap 98 ENCAP # RFC1241 encapsulation +# 99 # any private encryption scheme +gmtp 100 GMTP +ifmp 101 IFMP # Ipsilon Flow Management Protocol +pnni 102 PNNI # PNNI over IP +pim 103 PIM # Protocol Independent Multicast +aris 104 ARIS +scps 105 SCPS +qnx 106 QNX +a/n 107 A/N # Active Networks +ipcomp 108 IPCOMP # IP Payload Compression Protocol +snp 109 SNP # Sitara Networks Protocol +compaq-peer 110 Compaq-Peer # Compaq Peer Protocol +ipx-in-ip 111 IPX-in-IP # IPX in IP +carp 112 CARP vrrp # Virtual Router Redundancy Protocol +pgm 113 PGM # PGM Reliable Transport Protocol +# 114 # any 0-hop protocol +l2tp 115 L2TP # Layer Two Tunneling Protocol +ddx 116 DDX # D-II Data Exchange (DDX) +iatp 117 IATP # Interactive Agent Transfer Protocol +stp 118 STP # Schedule Transfer Protocol +srp 119 SRP # SpectraLink Radio Protocol +uti 120 UTI +smp 121 SMP # Simple Message Protocol +sm 122 SM +ptp 123 PTP # Performance Transparency Protocol +isis 124 ISIS # IS-IS over IPv4 +fire 125 FIRE +crtp 126 CRTP # Combat Radio Transport Protocol +crudp 127 CRUDP # Combat Radio User Datagram +sscopmce 128 SSCOPMCE +iplt 129 IPLT +sps 130 SPS # Secure Packet Shield +pipe 131 PIPE # Private IP Encapsulation within IP +sctp 132 SCTP # Stream Control Transmission Protocol +fc 133 FC # Fibre Channel +rsvp-e2e-ignore 134 RSVP-E2E-IGNORE +mobility-header 135 MOBILITY-HEADER # Mobility Header +udplite 136 UDPLite +mpls-in-ip 137 MPLS-in-IP # MPLS in IP +# 138-254 # Unassigned +# 255 # Reserved diff --git a/filesystem/rc b/filesystem/rc new file mode 100755 index 0000000..42b03d9 --- /dev/null +++ b/filesystem/rc @@ -0,0 +1,157 @@ +#!/bin/sh + +# +# initramfs /init (busybox ash) +# + +# 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 +} + +# 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 'mmcblk0p' /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 + + # 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 + + # 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.*' 2>/dev/null`" + 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.*' 2>/dev/null`" + 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 +# + +echo "" +echo -e "${BOLD}CRUX-ARM 3.0 - ${BLUE}http://crux-arm.nu/${NORM}" +echo "" + +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 + +echo -e -n " ${BOLD}${BLUE}*${NORM} Setting hostname... " +hostname crux +checkReturn + +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 + +echo -e -n " ${BOLD}${BLUE}*${NORM} Saving boot messages... " +dmesg > /var/log/boot +checkReturn + +echo -e " ${BOLD}${BLUE}*${NORM} Trying to find and mount the media installer..." +find_and_mount_media + +if grep -q debug /proc/cmdline; then + echo -e -n " ${BOLD}${BLUE}*${NORM} Loading debug script..." + /media/debug.sh + checkReturn +fi + +echo +echo "The system is coming up. Please wait." +echo + +# End of file diff --git a/filesystem/resolv.conf b/filesystem/resolv.conf new file mode 100644 index 0000000..9c531f0 --- /dev/null +++ b/filesystem/resolv.conf @@ -0,0 +1,5 @@ +# +# /etc/resolv.conf +# + +# End of file diff --git a/filesystem/setup b/filesystem/setup new file mode 100755 index 0000000..717a98b --- /dev/null +++ b/filesystem/setup @@ -0,0 +1,353 @@ +#!/bin/ash +# +# CRUX-ARM Setup +# +# Copyright (c) 2001-2005 by Per Liden +# +# Adapted for CRUX-ARM by Jose V Beneyto +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, +# USA. +# + +VERSION="3.0" + +do_dialog() { + dialog --backtitle "CRUX $VERSION Setup" --no-shadow "$@" +} + +do_abort() { + do_dialog --aspect 50 --defaultno --yesno "Abort installation?" 0 0 && exit 1 +} + +do_select() { + while true; do + do_dialog "$@" + if [ $? != 0 ]; then + do_abort + else + break + fi + done +} + +welcome() { + do_select --aspect 5 --yesno "Welcome!\n\nThis script will guide you through the installation of CRUX packages.\n\nBefore starting the installation make sure you have read and understood the \"CRUX Installation Guide\". If you have done that then please continue, else abort the installation and come back later.\n\nAre you really sure you want to continue?" 0 0 +} + +select_action() { + do_select --menu "Install or upgrade?" 9 45 2 \ + "1" "Install CRUX $VERSION" \ + "2" "Upgrade to CRUX $VERSION" 2> $tmpfile + ACTION=`cat $tmpfile` + if [ "$ACTION" = "1" ]; then + ACTION="INSTALL" + else + ACTION="UPGRADE" + do_select --aspect 5 --yesno "NOTE!\n\nBefore upgrading make sure /etc/pkgadd.conf in the old installation is tuned to fit your needs, important files might otherwise be overwritten. Further, when this script has completed the upgrade you need to go though the rejected files in /var/lib/pkg/rejected/ and upgrade them manually if needed. See the pkgadd(8) man page for more information about /etc/pkgadd.conf.\n\nAre you really sure you want to continue?" 0 0 + fi + echo "ACTION: $ACTION" > /tmp/action +} + +select_root() { + while true; do + do_select --aspect 40 --inputbox "Enter directory where your CRUX root partition is mounted:" 0 0 "/mnt" 2> $tmpfile + ROOT=`cat $tmpfile` + if [ -d "$ROOT" ]; then + if [ "$ACTION" = "INSTALL" ] || [ -f "$ROOT/var/lib/pkg/db" ]; then + break + fi + do_dialog --aspect 50 --msgbox "Directory does not look like a CRUX root directory. Try again." 0 0 + else + do_dialog --aspect 50 --msgbox "Directory not found. Try again." 0 0 + fi + done +} + +get_extra_collections() { + for i in $crux_dir/*; do + if [ -d $i ]; then + if [ "$i" != "core" ] && [ "$i" != "kernel" ]; then + EXTRA_COLLECTIONS="$EXTRA_COLLECTIONS $i" + fi + fi + done +} + +select_collections() { + if [ "$ACTION" != "INSTALL" ]; then + return 0 + fi + if [ ! -d core ] || [ ! -d kernel ]; then + do_dialog --aspect 50 --msgbox "Package directories (core and kernel) were not found in $crux_dir. Aborting." 0 0 + exit 1 + fi + TITLE="Select collections to install:\n(detailed package selection will follow)" + do_select --separate-output --checklist "$TITLE" 13 60 6 \ + core "The core packages (required)" ON \ + $(for col in $EXTRA_COLLECTIONS; do echo -ne "$col \"$col packages\" OFF "; done) 2> $collfile +} + +ask_detailed() { + if [ "$ACTION" != "INSTALL" ]; then + return 0 + fi + do_dialog --aspect 50 --defaultno --yesno "Do you want the chance to select packages individually?" 0 0 && DO_DETAILED="yes" +} + +select_packages() { + if [ ! -d core ] || [ ! -d kernel ]; then + do_dialog --aspect 50 --msgbox "Package directories (core and kernel) were not found in $crux_dir. Aborting." 0 0 + exit 1 + fi + if [ "$ACTION" = "INSTALL" ]; then + if [ "$DO_DETAILED" = "yes" ]; then + for collection in core $EXTRA_COLLECTIONS; do + [ ! -d $collection ] && continue + presel=`grep $collection $collfile` + if [ "$presel" == "$collection" ]; then + checked=ON + else + checked=OFF + fi + do_dialog --aspect 50 --infobox "Searching for packages, please wait..." 0 0 + TITLE="Select $collection packages to install:" + PKG_LIST=`find $collection -name '*.pkg.tar.*' | cut -d'/' -f2 | sed "s|.pkg.tar.[^ ]*|\t($collection) $checked\n|g" | sort | xargs echo ' '` + do_select --separate-output --checklist "$TITLE" 19 60 12 $PKG_LIST 2>> $pkgfile + done + else # no detailed selection + for collection in core $EXTRA_COLLECTIONS; do + + [ ! -d $collection ] && continue + presel=`grep $collection $collfile` + if [ "$presel" == "$collection" ]; then + find $collection -name '*.pkg.tar.*' | cut -d'/' -f2 | sed "s|.pkg.tar.[^ ]*|\t($collection) $checked\n|g" | sort >> $pkgfile + fi + done + fi + else + # Upgrade + do_dialog --aspect 50 --infobox "Searching for packages, please wait..." 0 0 + TITLE="Select packages to upgrade:" + INSTALLED_PACKAGES=`pkginfo -r $ROOT -i | gawk '{ print $1; }'` + for package in $INSTALLED_PACKAGES; do + CORE_LIST="$CORE_LIST `find core \( -name \"${package}#*.pkg.tar.gz\" -o -name \"${package}#*.pkg.tar.bz2\" -o -name \"${package}#*.pkg.tar.xz\" \) -printf '%f (core) ON\n' | sed 's/.pkg.tar.[^ ]*/ /g' | sort | xargs echo ' '`" + OPT_LIST="$OPT_LIST `find opt \( -name \"${package}#*.pkg.tar.gz\" -o -name \"${package}#*.pkg.tar.bz2\" -o -name \"${package}#*.pkg.tar.xz\" \) -printf '%f (opt) ON\n' | sed 's/.pkg.tar.[^ ]*/ /g' | sort | xargs echo ' '`" + XORG_LIST="$XORG_LIST `find xorg \( -name \"${package}#*.pkg.tar.gz\" -o -name \"${package}#*.pkg.tar.bz2\" -o -name \"${package}#*.pkg.tar.xz\" \) -printf '%f (xorg) ON\n' | sed 's/.pkg.tar.[^ ]*/ /g' | sort | xargs echo ' '`" + done + do_select --separate-output --checklist "$TITLE" 19 60 12 $CORE_LIST $OPT_LIST $XORG_LIST 2> $pkgfile + fi +} + +check_dependencies() { + if [ "$ACTION" != "INSTALL" ]; then + return 0 + fi + do_dialog --aspect 50 --infobox "Checking dependencies, please wait..." 0 0 + get_missing_deps + if [ -n "$MISSING_DEPS" ]; then + for package in $MISSING_DEPS; do + _package="`find . -name '${package}#*.pkg.tar.*' | sed 's/.pkg.tar.[^ ]*/ /g'`" + _collection="`dirname $_package | cut -d'/' -f2`" + # every item should be in the form: "acl#2.2.51-1 (core)" + MISSING_LIST="$MISSING_LIST $_package ($_collection)" + done + TITLE="The following packages are needed by the ones you selected" + do_select --separate-output --checklist "$TITLE" 19 60 12 $MISSING_LIST 2>> $pkgfile + fi +} + +get_missing_deps() { + needed="" + toinstall=`sed 's/\#.*//g' $pkgfile` + for f in $toinstall; do + pdeps=`grep "^$f\:" $depsfile|sed "s|^$f: ||g"` + for d in $pdeps; do + needed="$needed $d" + done + done + sed 's/\#.*//g' $pkgfile|sort -u > $markedfile + echo $needed|tr ' ' '\n'|sort -u > $neededfile + MISSING_DEPS=`comm -1 -3 $markedfile $neededfile` +} + +confirm() { + if [ "$ACTION" = "INSTALL" ]; then + # Install + do_select --aspect 25 --yesno "Selected packages will now be installed. Are you sure you want to continue?" 0 0 + else + # Upgrade + do_select --aspect 25 --yesno "Selected packages will now be upgraded. Are you sure you want to continue?" 0 0 + fi +} + +progressbar() { + echo "XXX" + expr $COUNT '*' 100 / $TOTAL + echo "\n$*" + echo "XXX" + let $((COUNT+=1)) +} + +install_packages() { + if [ ! -d $ROOT/var/lib/pkg ]; then + mkdir -p $ROOT/var/lib/pkg + touch $ROOT/var/lib/pkg/db + fi + + if [ -d $ROOT/var/lib/pkg/rejected ]; then + rm -rf $ROOT/var/lib/pkg/rejected + fi + + if [ "$ACTION" = "INSTALL" ]; then + PKGARGS="" + else + # We use -f here since we want to avoid pkgadd conflicts. + # Unwanted/Unexpected conflicts could arise if files are + # moved from one package to another, or if the user added + # the files himself. Instead of failing the whole upgrade + # we force the upgrade. This should be fairly safe and it + # will probably help to avoid some "semi-bogus" errors from + # pkgadd. The rules in /etc/pkgadd.conf will still be used. + PKGARGS="-f -u" + fi + + ( + # Log header + echo "Log ($logfile)" > $logfile + echo "----------------------------------------------------------" >> $logfile + + # Install packages + KERNEL=./kernel/linux-*.tar.bz2 + KERNEL_VERSION=`basename $KERNEL .tar.bz2 | sed "s/linux-//"` + TOTAL=`cat $pkgfile | wc -l` + let $((TOTAL+=1)) + let $((COUNT=0)) + let $((ERRORS=0)) + for FILE in `cat $pkgfile | awk '{print $1}'`; do + progressbar "Installing $FILE..." + echo -n "Installing $FILE....." >> $logfile + PKG_FILE=`find . \( -name "$FILE.pkg.tar.gz" -o -name "$FILE.pkg.tar.bz2" -o -name "$FILE.pkg.tar.xz" \)` + if [ -f $PKG_FILE ]; then + pkgadd -r $ROOT $PKGARGS $PKG_FILE > $tmpfile 2>&1 + if [ $? = 0 ]; then + echo "OK" >> $logfile + else + let $((ERRORS+=1)) + echo "ERROR" >> $logfile + echo "" >> $logfile + cat $tmpfile >> $logfile + echo "" >> $logfile + fi + fi + done + + # Install kernel + if [ ! -d $ROOT/usr/src/linux-$KERNEL_VERSION ]; then + progressbar "Installing `basename $KERNEL .tar.bz2`..." + echo -n "Installing `basename $KERNEL .tar.bz2`....." >> $logfile + ( + set -e + tar -C $ROOT/usr/src -xjf $KERNEL + cp -f ./kernel/linux-$KERNEL_VERSION.config $ROOT/usr/src/linux-$KERNEL_VERSION/.config + ) > $tmpfile 2>&1 + if [ $? = 0 ]; then + echo "OK" >> $logfile + else + let $((ERRORS+=1)) + echo "ERROR" >> $logfile + echo "" >> $logfile + cat $tmpfile >> $logfile + echo "" >> $logfile + fi + else + echo "Directory $ROOT/usr/src/linux-$KERNEL_VERSION already exists." >> $logfile + echo "Assuming linux-$KERNEL_VERSION is already installed." >> $logfile + fi + + # Log footer + echo "----------------------------------------------------------" >> $logfile + echo "$ERRORS error(s) found" >> $logfile + + cat $logfile > $tmpfile + + echo "" > $logfile + if [ "$ERRORS" = "0" ]; then + echo "$ACTION COMPLETED SUCCESSFULLY!" >> $logfile + else + echo "$ACTION FAILED!" >> $logfile + fi + echo "" >> $logfile + echo "" >> $logfile + cat $tmpfile >> $logfile + + ) | do_dialog --title " Please wait " --gauge "" 8 60 0 + + # Show log + do_dialog --exit-label "OK" --textbox $logfile 19 68 +} + +main() { + welcome + select_action + select_root + get_extra_collections + select_collections + ask_detailed + select_packages + check_dependencies + confirm + if [ "$ACTION" = "UPGRADE" ] && [ -f /usr/bin/setup-helper ] + then + (/usr/bin/setup-helper $ROOT &> $helperlogfile) | do_dialog \ + --title " Please wait [2.7 -> 2.8 check]" --gauge "" 8 60 0 + fi + install_packages + cat $helperlogfile 2> /dev/null +} + +tmpfile=/tmp/tmp.$$ +collfile=/tmp/collections.$$ +pkgfile=/tmp/packages.$$ +logfile=/tmp/log.$$ +helperlogfile=/tmp/log-helper.$$ +crux_dir=/media/crux +neededfile=/tmp/needed.$$ +markedfile=/tmp/marked.$$ + +# Detailed selection of packages +DO_DETAILED="no" +MISSINGDEPS="" + +EXTRA_COLLECTIONS="" + +trap "rm -f $tmpfile $pkgfile $collfile $neededfile $markedfile" 0 1 2 5 15 + +if [ "$1" != "" ]; then + crux_dir=$1 +fi + +depsfile=$crux_dir/setup.dependencies + +if [ -d $crux_dir ]; then + cd $crux_dir +else + do_dialog --aspect 50 --msgbox "Directory $crux_dir not found. Aborting." 0 0 + exit 1 +fi + +main + +# End of file diff --git a/filesystem/setup-chroot b/filesystem/setup-chroot new file mode 100755 index 0000000..1d453d8 --- /dev/null +++ b/filesystem/setup-chroot @@ -0,0 +1,10 @@ +#!/bin/sh + +mount --bind /dev /mnt/dev +mount --bind /tmp /mnt/tmp +mount -t proc proc /mnt/proc +mount -t sysfs none /mnt/sys +mount -t devpts devpts /mnt/dev/pts + +chroot /mnt /bin/bash + diff --git a/filesystem/setup-helper b/filesystem/setup-helper new file mode 100755 index 0000000..a88adc8 --- /dev/null +++ b/filesystem/setup-helper @@ -0,0 +1,115 @@ +#!/bin/bash +# post setup +# +# Johannes Winkelmann, jw at tks6 dot net + +ROOT=$1 +DB=$ROOT/var/lib/pkg/db + +## those values should be changed: +TMPDB=$DB.tmp +BACKUPDB=$DB.backup +PKGADD="pkgadd" +PKGRM="pkgrm" +MV="mv" + + +is_installed() { + printf "%s" $(pkginfo -r $ROOT -i | gawk -v r="^$1\$" '$1 ~ r {print $1}') +} + + +rename_packages() { + if [ -z "$1" ]; then + return + fi + pkg=$@ + + filter="sed " + runfilter="no" + for tuple in $@; do + split=($(echo $tuple|sed -e 's|:| |')) + if [ -n "${split[1]}" ] && [ `is_installed ${split[0]}` ]; then + echo "Package renamed: ${split[0]} -> ${split[1]}" + filter="$filter -e 's|^${split[0]}$|${split[1]}|'" + runfilter="yes" + fi + done + if [ "$runfilter" = "no" ]; then + return + fi + + :> $TMPDB + if [ -f $DB ]; then + nextIsName=1 + cat $DB|while read l; do + if [ $nextIsName -eq 1 ]; then + nextIsName=0 + echo $l|eval $filter >> $TMPDB + else + if [ "$l" = "" ]; then + nextIsName=1 + fi + echo $l >> $TMPDB + fi + done + fi + + $MV $DB $BACKUPDB + $MV $TMPDB $DB +} + + +remove_packages() { + for package in $@; do + if [ `is_installed $package` ]; then + echo "Package removed: $package" + $PKGRM -r $ROOT $package + fi + done +} + +inject_packages() { + for package in $@; do + pkg="`find core $EXTRA_COLLECTIONS \( -name \"${package}#*.pkg.tar.gz\" -o -name \"${package}#*.pkg.tar.bz2\" -o -name \"${package}#*.pkg.tar.xz\" \)&2> /dev/null`" + if [ -z "$pkg" ]; then + echo " ERROR: package $package not found on CRUX media installer" + else + if [ -z `is_installed $package` ]; then + echo "Package injected: $package" + $PKGADD -r $ROOT -f $pkg + else + echo "Package upgraded: $package" + $PKGADD -r $ROOT -u -f $pkg + fi + fi + done +} + +#################### + +if [ -z "$1" ]; then + echo "Usage: $0 " + exit -1 +fi + +EXTRA_COLLECTIONS="" +for i in /media/crux/*; do. + if [ -d $i ]; then + if [ "$i" != "core" ] && [ "$i" != "kernel" ]; then + EXTRA_COLLECTIONS="$EXTRA_COLLECTIONS $i" + fi + fi +done + +##### # 2.8 -> 3.0 ##### +echo "* CRUX-ARM 2.8 -> 3.0 setup-helper" + +if grep -q opt $EXTRA_COLLECTIONS; then + if [ `is_installed pango` ]; then + inject_packages harfbuzz + fi +fi + +# force replacement of /etc/mtab with symlink +ln -sf /proc/self/mounts $ROOT/etc/mtab diff --git a/filesystem/shadow b/filesystem/shadow new file mode 100644 index 0000000..6034cdc --- /dev/null +++ b/filesystem/shadow @@ -0,0 +1 @@ +root:x:0:::::: diff --git a/init b/init deleted file mode 100755 index 4f04010..0000000 --- a/init +++ /dev/null @@ -1,208 +0,0 @@ -#!/bin/sh - -# -# initramfs /init (busybox ash) -# - -# 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 -} - -# 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 -n " ${BOLD}${BLUE}*${NORM} Creating and mounting tmpfs... " - mkdir /.tmpfs - mount -t tmpfs tmpfs /.tmpfs - checkReturn - - echo -e " ${BOLD}${BLUE}*${NORM} Searching for the CRUX media..." - mkdir -p /.tmpfs/.media - CRUXMEDIA="" - CDROM_DEVICES="`grep 'drive name:' /proc/sys/dev/cdrom/info | awk '{ print $3 }'`" - MMC_DEVICES="`grep -E 'mmcblk' /proc/partitions | awk '{ print $4 }'`" - BLOCK_DEVICES="`grep -E '[sh]d' /proc/partitions | awk '{ print $4 }'`" - for DEV in $CDROM_DEVICES $MMC_DEVICES $BLOCK_DEVICES - do - DEV="/dev/$DEV" - mount -r $DEV /.tmpfs/.media 2> /dev/null - if [ $? -eq 0 ] - then - echo -e -n " ${BOLD}${GREEN}*${NORM} Found media on $DEV" - if [ -e /.tmpfs/.media/crux-media ] - then - echo ", CRUX media." - CRUXMEDIA=$DEV - break - else - echo ", but it's not the CRUX media." - umount /.tmpfs/.media - fi - else - echo -e " ${BOLD}${YELLOW}*${NORM} No media found on $DEV." - fi - done - - # check if the media was mounted properly. if not, spawn a shell - if [ ! -e /.tmpfs/.media/crux-media ] - then - 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 " /.tmpfs/.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 - - # check again and stop if it's still not there - if [ ! -e /.tmpfs/.media/crux-media ] - then - echo -e " ${BOLD}${RED}*${NORM} The CRUX media still appears not to be" - echo " found and installation will not continue." - echo - sleep 99999 - exit 1 - fi - - echo -e " ${BOLD}${BLUE}*${NORM} Populating root filesystem..." - mkdir -p /newroot - echo -e -n " ${BOLD}${BLUE}*${NORM} Mounting new root filesystem... " - mount -t tmpfs tmpfs /newroot - checkReturn - echo -e -n " ${BOLD}${BLUE}*${NORM} Copying files from rootfs.tar.xz... " - tar -xpf /.tmpfs/.media/rootfs.tar.xz -C /newroot - checkReturn - echo -e -n " ${BOLD}${BLUE}*${NORM} Copying devices from rootfs... " - cp -af /dev/* /newroot/dev/ - checkReturn - mkdir -p /newroot/dev/pts /newroot/media - - # the media gets unmounted here and remounted after switch_root - umount /.tmpfs/.media - rmdir /.tmpfs/.media - sed -i -e "s,#CRUXMEDIA#,${CRUXMEDIA}," /newroot/etc/fstab - - echo -e -n " ${BOLD}${BLUE}*${NORM} Unmounting tmpfs... " - umount /.tmpfs - checkReturn - rmdir /.tmpfs -} - -/bin/busybox --install -s /bin - -# main script - -echo "" -echo -e "${BOLD}CRUX-ARM 2.7.1 - ${BLUE}http://crux-arm.nu/${NORM}" -echo "" - -exec >/dev/console &1 - -echo -e -n " ${BOLD}${BLUE}*${NORM} Mounting " -echo -e -n "${BOLD}${GREEN}/proc${NORM}" -mount -t proc proc /proc - -PRINTK="`cat /proc/sys/kernel/printk`" -echo "0" > /proc/sys/kernel/printk - -echo -e ", ${BOLD}${GREEN}/sys${NORM}." -mount -t sysfs sysfs /sys - -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 - -if [ -d /lib/modules ] -then - echo -e -n " ${BOLD}${BLUE}*${NORM} Loading modules... " - # TODO -else - echo -e " ${BOLD}${YELLOW}*${NORM} No modules were found in the initial RAM filesystem." -fi - -grep -q "devicetimeout=*" /proc/cmdline -if [ $? -eq 0 ] -then - for opt in `cat /proc/cmdline` - do - echo "$opt" | grep -q "devicetimeout=" - if [ $? -eq 0 ] - then - DEVTIMEOUT=`echo $opt | cut -d'=' -f2` - fi - done -else - DEVTIMEOUT=10 -fi -echo -e " ${BOLD}${BLUE}*${NORM} Waiting $DEVTIMEOUT seconds for devices to settle..." -sleep $DEVTIMEOUT - -# if root=/dev/XXX was specified on the command line, use that as the new root -# instead of searching for the media and using it. if it fails, fall back to -# the media -grep -q "root=/dev/*" /proc/cmdline -if [ $? -eq 0 ] -then - for opt in `cat /proc/cmdline` - do - echo "$opt" | grep -q "root=" - if [ $? -eq 0 ] - then - ROOTDEV=`echo $opt | cut -d'=' -f2` - fi - done - mkdir -p /newroot - # check the specified root device to see if it has an init - mount $ROOTDEV /newroot - if [ $? -ne 0 ] - then - echo -e " ${BOLD}${RED}*${NORM} Unable to mount the specified root device! Falling back to the live media." - find_and_mount_media - else - if [ -x /newroot/sbin/init ] - then - echo -e " ${BOLD}${BLUE}*${NORM} Mounted root device $ROOTDEV." - else - echo -e " ${BOLD}${RED}*${NORM} The specified root device ($ROOTDEV) does not appear to be usable! Falling back to the live media." - umount /newroot - find_and_mount_media - fi - fi -else - find_and_mount_media -fi - -echo -e " ${BOLD}${BLUE}*${NORM} Switching root.\n" -echo "$PRINTK" > /proc/sys/kernel/printk -echo > /proc/sys/kernel/hotplug -umount /sys -umount /proc -exec /bin/switch_root /newroot /sbin/init - -echo "Something's broken, here's a shell." -exec /bin/sh - -# End of file diff --git a/initramfs.lst b/initramfs.lst deleted file mode 100644 index 10c8aa0..0000000 --- a/initramfs.lst +++ /dev/null @@ -1,15 +0,0 @@ -# base directories/device nodes -dir /proc 755 0 0 -dir /sys 755 0 0 -dir /lib 755 0 0 -dir /dev 755 0 0 -nod /dev/console 640 0 0 c 5 1 -nod /dev/null 664 0 0 c 1 3 - -# init itself -file /init init 755 0 0 - -# busybox and links -dir /bin 755 0 0 -file /bin/busybox work/busybox-#BUSYBOX_VERSION#/busybox 4755 0 0 -slink /bin/sh busybox 777 0 0