added axe kernel modules, dropbear, rewrite inittab system, use /dev/mtdblock4 for config

This commit is contained in:
Jaroslav Kysela 2015-03-28 20:33:17 +01:00
parent 4acb001e0a
commit 86243d95c5
11 changed files with 161 additions and 9 deletions

View File

@ -4,11 +4,27 @@ TOOLPATH=$(STLINUX)/host/bin
TOOLCHAIN=$(STLINUX)/devkit/sh4
TOOLCHAIN_KERNEL=$(shell pwd)/toolchain/4.5.3-99/opt/STM/STLinux-2.4/devkit/sh4
EXTRA_AXE_MODULES_DIR=firmware/initramfs/root/modules_idl4k_7108_ST40HOST_LINUX_32BITS
EXTRA_AXE_MODULES=axe_dmx.ko axe_dmxts.ko axe_fe.ko axe_fp.ko axe_i2c.ko \
stapi_core_stripped.ko stapi_ioctl_stripped.ko stsys_ioctl.ko \
load_modules_list_32BITS.txt load_modules_list_axe_32BITS.txt \
load_modules.sh load_env.sh
ORIG_FILES=main_axe.out mknodes.out
DROPBEAR=dropbear-2015.67
DROPBEAR_SBIN_FILES=dropbear
DROPBEAR_BIN_FILES=dbclient dropbearconvert dropbearkey scp
define GIT_CLONE
@mkdir -p apps/
git clone $(1) apps/$(2)
endef
define WGET
@mkdir -p apps/
wget --no-verbose -O $(2) $(1)
endef
#
# all
@ -23,13 +39,16 @@ all: kernel-axe-modules kernel
fs.cpio: minisatip
fakeroot tools/do_min_fs.py \
-b "bash" \
-b "bash strace ldd" \
$(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") \
$(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"
.PHONY: fs-list
fs-list:
cpio -itv < kernel/rootfs-idl4k.cpio
#
# kernel
#
@ -76,12 +95,38 @@ firmware/initramfs/root/modules_idl4k_7108_ST40HOST_LINUX_32BITS/axe_dmx.ko:
apps/minisatip/minisatip.c:
$(call GIT_CLONE,https://github.com/catalinii/minisatip.git,minisatip)
.PHONY: minisatip
minisatip: apps/minisatip/minisatip.c
apps/minisatip/minisatip: apps/minisatip/minisatip.c
make -C apps/minisatip \
CC=$(TOOLCHAIN)/bin/sh4-linux-gcc \
CFLAGS="-O2 -DSYS_DVBT2=16"
.PHONY: minisatip
minisatip: apps/minisatip/minisatip
#
# dropbear
#
apps/$(DROPBEAR)/configure:
$(call WGET,https://matt.ucc.asn.au/dropbear/$(DROPBEAR).tar.bz2,apps/$(DROPBEAR).tar.bz2)
tar -C apps -xjf apps/$(DROPBEAR).tar.bz2
apps/$(DROPBEAR)/dropbear: apps/$(DROPBEAR)/configure
cd apps/$(DROPBEAR) && \
CC=$(TOOLCHAIN)/bin/sh4-linux-gcc \
./configure \
--host=sh4-linux \
--prefix=/ \
--disable-lastlog \
--disable-utmp \
--disable-utmpx \
--disable-wtmp \
--disable-wtmpx
make -C apps/$(DROPBEAR) PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
.PHONY: dropbear
dropbear: apps/$(DROPBEAR)/dropbear
#
# clean all
#

View File

@ -23,7 +23,7 @@ Booting uImage.gz on Inverto IDL-400s/Grundig GSS.BOX/Inverto IDL-400S from USB:
- set debugfw environment variable
set debugfw "debugfw=usb start;usb start;fatload usb 0 0x84000000 uimage.gz;set bootargs console=ttyAS0,115200 bigphysarea=20000 initrd=/sbin/init;bootm 0x84000000"
set debugfw "debugfw=usb start;usb start;fatload usb 0 0x84000000 uimage.gz;set bootargs console=ttyAS0,115200 bigphysarea=20000;bootm 0x84000000"
- you may type 'save' to store this settings permanently
- to execute the debugfw type 'run debugfw'

19
fs-add/etc/config.default Normal file
View File

@ -0,0 +1,19 @@
#
# IPV4 config
#
IPV4="dhcp"
# or
#IPV4="192.168.1.240"
#IPV4_NETMASK="255.255.255.0"
#IPV4_BROADCAST="192.168.1.255"
#IPV4_GATEWAY="192.168.1.1"
#
# telnetd
#
TELNETD="yes"
#
# dropbear
#
DROPBEAR="yes"

9
fs-add/etc/init.d/axe Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
echo "Starting axe services:"
ln -s /lib/modules /root/modules
mknod -m 0777 /tmp/usbdevmon125788 p
source /lib/modules/load_modules.sh
cd /root
export AXE_API_TYPE=linuxdvb
exec ./main_axe.out

24
fs-add/etc/init.d/dropbear Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
test -r /etc/sysconfig/config && . /etc/sysconfig/config
if test "$DROPBEAR" != "yes"; then
exit 0
fi
if ! test -r /etc/dropbear/dropbear_dss_host_key; then
mkdir -p /etc/dropbear
if test -r /etc/sysconfig/dropbear_dss_host_key; then
cp /etc/sysconfig/dropbear_dss_host_key /etc/dropbear/dropbear_dss_host_key
else
dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
cp /etc/dropbear/dropbear_dss_host_key /etc/sysconfig/dropbear_dss_host_key
fi
fi
export HOME=/root
if test -r /etc/sysconfig/authorized_keys ; then
mkdir -p $HOME/.ssh
cp /etc/sysconfig/authorized_keys $HOME/.ssh/authorized_keys
chmod 0600 $HOME/.ssh/authorized_keys
fi
exec dropbear -F

14
fs-add/etc/init.d/network Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
test -r /etc/sysconfig/config && . /etc/sysconfig/config
if test "$IPV4" = "dhcp"; then
exec /sbin/udhcpc -f -S -p /tmp/udhcpc.pid -s /etc/init.d/dhcpc-event
else
ifconfig eth0 $IPV4 netmask $IPV4_NETMASK broadcast $IPV4_BROADCAST
route add default gw $IPV4_GATEWAY
fi
if test -r /etc/sysconfig/resolv.conf; then
ln -s sysconfig/resolv.conf /etc/resolv.conf
fi

View File

@ -25,6 +25,15 @@ mount -t tmpfs -o size=1M tmpfs /tmp
# start syslogd
syslogd -C256
# config/data storage
mkdir -p /mnt/data
mount -t jffs2 /dev/mtdblock4 /mnt/data/
mkdir -p /mnt/data/satip-axe/sysconfig
ln -s /mnt/data/satip-axe/sysconfig /etc/sysconfig
if ! test -r /etc/sysconfig/config ; then
cp /etc/config.default /etc/sysconfig/config
fi
# basic network
hostname satip-axe
ifconfig lo 127.0.0.1 netmask 255.255.255.0

9
fs-add/etc/init.d/telnetd Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
test -r /etc/sysconfig/config && . /etc/sysconfig/config
if test "$DROPBEAR" != "yes"; then
exit 0
fi
exec /usr/sbin/telnetd -F -l /bin/login

View File

@ -2,10 +2,14 @@
::sysinit:/etc/init.d/rcSBB
# Console
ttyAS0::askfirst:/bin/bash --init-file /etc/bashrc
# DHCP Client
::respawn:/sbin/udhcpc -f -S -p /tmp/udhcpc.pid -s /etc/init.d/dhcpc-event
# Network
::once:/etc/init.d/network
# telnetd
::respawn:/usr/sbin/telnetd -F -l /bin/login
::once:/etc/init.d/telnetd
# dropbear
::once:/etc/init.d/dropbear
# AXE kernel modules and environment
::once:/etc/init.d/axe
# Others
::ctrlaltdel:/sbin/reboot
::shutdown:/sbin/swapoff -a

13
fs-add/root/main_init.sh Executable file
View File

@ -0,0 +1,13 @@
#
# this is script executed from /root/main_axe.out binary
# after the AXE initialization routine
# it is respawned immediately on exit
#
while [ 1 ]; do
if [ -x /etc/init.d/satip ]; then
. /etc/init.d/satip
else
sleep 33554432
fi
done

View File

@ -245,7 +245,7 @@ def gen_fs(lib_list, init_type):
"""
print '\t coping libraries and binary files \n'
run_cmd('rm -rf fs fs.cpio')
for i in ['sbin', 'bin', 'dev', 'sys', 'etc', 'lib', 'tmp', 'proc', 'usr', 'var', 'root']:
for i in ['sbin', 'bin', 'dev', 'sys', 'etc', 'lib/modules', 'tmp', 'proc', 'usr/lib', 'var', 'root']:
run_cmd('mkdir -p fs/' + i)
for i in ['sbin', 'bin']:
run_cmd('mkdir -p fs/usr/' + i)
@ -288,6 +288,7 @@ def gen_fs(lib_list, init_type):
run_cmd(' chmod a+x fs/lib/lib* ')
run_cmd(' chmod a+x fs/etc/* ')
run_cmd(' chmod 0600 fs/root ')
print '\t====== coping additional libs ========'
# libnss_* are required from login; but it's not possible get by ldd cmd
@ -302,6 +303,11 @@ def gen_fs(lib_list, init_type):
run_cmd('cp -a ' + target_prefix + '/lib/libgcc_*' + ' fs/lib/')
print '\t======================================='
# other libs
run_cmd('cp -d ' + target_prefix + '/usr/lib/libz.so*' + ' fs/usr/lib/')
run_cmd('cp -d ' + target_prefix + '/usr/lib/libstdc++.so*' + ' fs/usr/lib/')
run_cmd('cp -d ' + target_prefix + '/usr/lib/libglib-2.0.so*' + ' fs/usr/lib/')
if init_type == 'busybox':
setup_busybox()
if init_type == 'sysv':