upgraded busybox, activated ntpd, activated mdev, added hotplug scripts for USB storage - /media, added sbin paths to dropbear

This commit is contained in:
Jaroslav Kysela 2015-04-08 13:54:26 +02:00
parent 2838c945b5
commit 0d9040988d
10 changed files with 110 additions and 7 deletions

View File

@ -1,4 +1,4 @@
BUILD=3
BUILD=4
VERSION=$(shell date +%Y%m%d%H%M)-$(BUILD)
CPUS=4
STLINUX=/opt/STM/STLinux-2.4
@ -15,6 +15,8 @@ EXTRA_AXE_MODULES=axe_dmx.ko axe_dmxts.ko axe_fe.ko axe_fp.ko axe_i2c.ko \
ORIG_FILES=main_axe.out mknodes.out
BUSYBOX=busybox-1.23.2
DROPBEAR=dropbear-2015.67
DROPBEAR_SBIN_FILES=dropbear
DROPBEAR_BIN_FILES=dbclient dropbearconvert dropbearkey scp
@ -55,6 +57,7 @@ fs.cpio: minisatip
-b "bash strace" \
$(foreach m,$(EXTRA_AXE_MODULES), -e "$(EXTRA_AXE_MODULES_DIR)/$(m):lib/modules/$(m)") \
$(foreach m,$(ORIG_FILES), -e "$(EXTRA_AXE_MODULES_DIR)/../$(m):root") \
-e "apps/$(BUSYBOX)/busybox:bin/busybox" \
$(foreach f,$(DROPBEAR_SBIN_FILES), -e "apps/$(DROPBEAR)/$(f):sbin/$(f)") \
$(foreach f,$(DROPBEAR_BIN_FILES), -e "apps/$(DROPBEAR)/$(f):usr/bin/$(f)") \
-e "apps/minisatip/minisatip:sbin/minisatip" \
@ -194,6 +197,22 @@ minisatip: apps/minisatip/minisatip
minisatip-clean:
rm -rf apps/minisatip
#
# busybox
#
apps/$(BUSYBOX)/Makefile:
$(call WGET,http://busybox.net/downloads/$(BUSYBOX).tar.bz2,apps/$(BUSYBOX).tar.bz2)
tar -C apps -xjf apps/$(BUSYBOX).tar.bz2
apps/$(BUSYBOX)/busybox: apps/$(BUSYBOX)/Makefile
make -C apps/$(BUSYBOX) CROSS_COMPILE=$(TOOLCHAIN)/bin/sh4-linux- defconfig
make -C apps/$(BUSYBOX) CROSS_COMPILE=$(TOOLCHAIN)/bin/sh4-linux-
#make -C apps/$(DROPBEAR) PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
.PHONY: busybox
busybox: apps/$(BUSYBOX)/busybox
#
# dropbear
#
@ -213,6 +232,9 @@ apps/$(DROPBEAR)/dropbear: apps/$(DROPBEAR)/configure
--disable-utmpx \
--disable-wtmp \
--disable-wtmpx
sed -e 's/DEFAULT_PATH \"\/usr\/bin:\/bin\"/DEFAULT_PATH \"\/sbin:\/usr\/sbin:\/bin:\/usr\/bin:\/usr\/local\/bin\"/g' \
< apps/$(DROPBEAR)/options.h > apps/$(DROPBEAR)/options.h.2
mv apps/$(DROPBEAR)/options.h.2 apps/$(DROPBEAR)/options.h
make -C apps/$(DROPBEAR) PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
.PHONY: dropbear

View File

@ -1,3 +1,9 @@
#
# SATIP AXE firmware configuration
#
HOSTNAME="satip-axe"
#
# IPV4 config
#
@ -8,6 +14,11 @@ IPV4="dhcp"
#IPV4_BROADCAST="192.168.1.255"
#IPV4_GATEWAY="192.168.1.1"
#
# ntpd
#
NTPD_OPTS="-p 0.pool.ntp.org"
#
# telnetd
#

7
fs-add/etc/init.d/ntpd Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
test -r /etc/sysconfig/config && . /etc/sysconfig/config
test -z "$NTPD_OPTS" && NTPD_OPTS="-p 0.pool.ntp.org"
exec /usr/sbin/ntpd -I eth0 $NTPD_OPTS

View File

@ -6,7 +6,10 @@ busybox mount -t proc proc /proc
# remount root filesystem in rw mode
busybox mount -o remount,rw /
# Create all symbolic links.
/bin/busybox --install -s
/bin/busybox --install -s
# Date
date 010112002015 >/dev/null
# mount /dev and devpts to allow logging in
mount -t tmpfs -o size=64k,mode=0755 tmpfs /dev
@ -15,12 +18,18 @@ mount -t devpts none /dev/pts -ogid=5,mode=620
# use mdev/sysfs
mount -t sysfs sysfs /sys
touch /dev/mdev.seq
mkdir -p /media
echo /sbin/mdev > /proc/sys/kernel/hotplug
echo /sbin/hotplug > /proc/sys/kernel/hotplug
mdev -s
# make /tmp as tmpfs
mount -t tmpfs -o size=1M tmpfs /tmp
mv /var /var.2
mkdir /tmp/var
ln -s /tmp/var /var
rm -rf /var.2
mkdir -p /tmp/var/run /tmp/var/log /tmp/var/spool
# start syslogd
syslogd -C256
@ -41,8 +50,12 @@ if test -r /etc/sysconfig/passwd ; then
cp /etc/sysconfig/passwd /etc/passwd
fi
# hostname
test -r /etc/sysconfig/config && . /etc/sysconfig/config
test -n "$HOSTNAME" && hostname "$HOSTNAME"
test -z "$HOSTNAME" && hostname satip-axe
# basic network
hostname satip-axe
ifconfig lo 127.0.0.1 netmask 255.255.255.0
ifconfig eth0 up
route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0

View File

@ -1,9 +1,11 @@
# Boot
::sysinit:/etc/init.d/rcSBB
::sysinit:/etc/init.d/rcS
# Console
ttyAS0::askfirst:/bin/bash --init-file /etc/bashrc
ttyAS0::askfirst:/bin/sh
# Network
::once:/etc/init.d/network
# Time Network Protocol
::once:/etc/init.d/ntpd
# telnetd
::once:/etc/init.d/telnetd
# dropbear

2
fs-add/etc/mdev.conf Normal file
View File

@ -0,0 +1,2 @@
-sd[a-h][0-9]{1,2} 0:0 660 @/sbin/sd-hotplug.sh
-sd[a-h][0-9]{1,2} 0:0 660 $/sbin/sd-hotunplug.sh

View File

@ -1,2 +1,3 @@
Welcome to SATIP-AXE server @VERSION@
Welcome to SATIP-AXE server @VERSION@

26
fs-add/sbin/sd-hotplug.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/sh
BLKID=$(/sbin/blkid /dev/$MDEV)
eval ${BLKID#*:}
if [ -n "$LABEL" ]; then
MOUNT_POINT=/media/$LABEL
else
MOUNT_POINT=/media/$MDEV
fi
logger -p local0.notice "Mounting $MDEV : $MOUNT_POINT"
mkdir -p "$MOUNT_POINT"
for fs_type in vfat msdos ; do
if $(mount -t $fs_type -o umask=0 /dev/$MDEV "$MOUNT_POINT" 2>/dev/null) ; then
logger -p local0.notice "... $MDEV mounted using $fs_type filesystem"
exit 0
fi
done
for fs_type in ext4 ext3 ext2 ; do
if $(mount -t $fs_type /dev/$MDEV "$MOUNT_POINT" 2>/dev/null) ; then
logger -p local0.notice "... $MDEV mounted using $fs_type filesystem"
exit 0
fi
done

14
fs-add/sbin/sd-hotunplug.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
logger -p local0.notice "Unmounting $MDEV"
for MOUNT_POINT in /media/* ; do
if test -d "$MOUNT_POINT"; then
d=$(mountpoint -n "$MOUNT_POINT" 2> /dev/null | cut -d ' ' -f 1)
if test "$d" = "$MDEV" -o "$d" = "UNKNOWN"; then
logger -p local0.notice "Unmounting $MDEV : $MOUNT_POINT"
umount -f "$MOUNT_POINT"
rmdir "$MOUNT_POINT"
fi
fi
done

View File

@ -173,6 +173,10 @@ def setup_busybox():
run_cmd(' ln -s /bin/busybox fs/sbin/init')
run_cmd(' ln -s /bin/busybox fs/bin/sh')
run_cmd('mknod fs/dev/console c 5 1')
run_cmd('mknod fs/dev/null c 1 3')
run_cmd('mknod fs/dev/zero c 1 5')
#-----------------------------------------------
def setup_sysvinit():
@ -564,6 +568,7 @@ for j in library_list:
print ' ' + 30*'=' + '\n'
gen_fs(library_list, boot_type)
run_cmd('rm -v fs/etc/inittabBB fs/etc/init.d/rcSBB')
run_cmd('cp -av fs-add/* fs')
f = open("fs/etc/motd")
b = f.read(1024*1024)