Makefile: versioning, add minisatip icons, uboot script generator

This commit is contained in:
Jaroslav Kysela 2015-03-31 16:39:17 +02:00
parent bbeda3d499
commit 3aa2d34426
11 changed files with 108 additions and 16 deletions

View File

@ -1,3 +1,5 @@
BUILD=1
VERSION=$(shell date +%Y%m%d%H%M)-$(BUILD)
CPUS=4
STLINUX=/opt/STM/STLinux-2.4
TOOLPATH=$(STLINUX)/host/bin
@ -33,22 +35,50 @@ endef
.PHONY: all
all: kernel-axe-modules kernel
.PHONY: release
release: kernel-axe-modules out/idl4k.scr
-ls -la out
#
# create CPIO
#
fs.cpio: minisatip
fakeroot tools/do_min_fs.py \
-b "bash strace ldd" \
-r "$(VERSION)" \
-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") \
$(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"
-e "apps/minisatip/minisatip:sbin/minisatip" \
-e "apps/minisatip/icons/lr.jpg:usr/share/minisatip/icons/lr.jpg" \
-e "apps/minisatip/icons/lr.png:usr/share/minisatip/icons/lr.png" \
-e "apps/minisatip/icons/sm.jpg:usr/share/minisatip/icons/sm.jpg" \
-e "apps/minisatip/icons/sm.png:usr/share/minisatip/icons/sm.png"
.PHONY: fs-list
fs-list:
cpio -itv < kernel/rootfs-idl4k.cpio
#
# uboot
#
out/idl4k.scr: patches/uboot.script out/satip-axe-$(VERSION).fw
rm -f out/*.scr
sed -e 's/@VERSION@/$(VERSION)/g' \
< patches/uboot.script > out/uboot.script
$(TOOLPATH)/mkimage -T script -C none \
-n 'SAT>IP AXE fw v$(VERSION)' \
-d out/uboot.script out/idl4k.scr
-rm out/uboot.script
out/satip-axe-$(VERSION).fw: kernel/arch/sh/boot/uImage.gz
mkdir -p out
rm -f out/*.fw
cp -av kernel/arch/sh/boot/uImage.gz out/satip-axe-$(VERSION).fw
#
# kernel
#
@ -56,13 +86,15 @@ fs-list:
kernel/.config: toolchain/4.5.3-99/opt/STM/STLinux-2.4/devkit/sh4/bin/sh4-linux-gcc-4.5.3
make -C kernel -j $(CPUS) ARCH=sh CROSS_COMPILE=$(TOOLCHAIN_KERNEL)/bin/sh4-linux- idl4k_defconfig
.PHONY: kernel
kernel: toolchain/4.5.3-99/opt/STM/STLinux-2.4/devkit/sh4/bin/sh4-linux-gcc-4.5.3 kernel/.config fs.cpio
kernel/arch/sh/boot/uImage.gz: toolchain/4.5.3-99/opt/STM/STLinux-2.4/devkit/sh4/bin/sh4-linux-gcc-4.5.3 kernel/.config fs.cpio
mv fs.cpio kernel/rootfs-idl4k.cpio
make -C kernel -j $(CPUS) ARCH=sh CROSS_COMPILE=$(TOOLCHAIN_KERNEL)/bin/sh4-linux- modules
make -C kernel -j ${CPUS} PATH="$(PATH):$(TOOLPATH)" \
ARCH=sh CROSS_COMPILE=$(TOOLCHAIN_KERNEL)/bin/sh4-linux- uImage.gz
.PHONY: kernel
kernel: kernel/arch/sh/boot/uImage.gz
.PHONY: kernel-mrproper
kernel-mrproper:
make -C kernel ARCH=sh CROSS_COMPILE=$(TOOLCHAIN_KERNEL)/bin/sh4-linux- mrproper

View File

@ -1,5 +1,12 @@
# satip-axe
A firmware with minisatip for Inverto IDL-400s/Grundig GSS.BOX/Telestar Digibit R1
**********************************************************************************
Releases:
- see to dist directory
Requirements:
- git, python
@ -11,12 +18,13 @@ Compilation:
- just type 'make'
- kernel with rootfs is in kernel/arch/sh/boot/uImage.gz
Booting uImage.gz on Inverto IDL-400s/Grundig GSS.BOX/Inverto IDL-400S from USB:
Booting uImage.gz on Inverto IDL-400S/Grundig GSS.BOX/Telestar Digibit R1 from USB:
- connect TTL USB serial adapter to J3 connector (4 pins at the power supply)
- pin 1 = 3.6V (do not use), pin 2 = GND, pin 3 = RXD (STM CPU), pin 4 = TXD (STM CPU)
- parameters: 115200,8N1
- press 'Enter' when you turn on the box (you have only one second) to get 'idl4k> ' prompt
(it seems that 'Enter' is required also to enable the serial console)
- modify bootargs (optional - for original firmware)
set bootargs=console=ttyAS0,115200
@ -31,5 +39,5 @@ Booting uImage.gz on Inverto IDL-400s/Grundig GSS.BOX/Inverto IDL-400S from USB:
Configuration
- dhcp client, telnetd and dropbear (ssh daemon) are active by default
- dhcp client, telnetd, dropbear (ssh daemon) and minisatip are active by default
- configuration is stored in /etc/sysconfig/config

View File

@ -17,3 +17,9 @@ TELNETD="yes"
# dropbear
#
DROPBEAR="yes"
#
# minisatip
#
MINISATIP="yes"
MINISATIP_OPTS=""

View File

@ -6,6 +6,8 @@ if test "$DROPBEAR" != "yes"; then
exit 0
fi
sleep 5
if ! test -r /etc/dropbear/dropbear_dss_host_key; then
mkdir -p /etc/dropbear
if test -r /etc/sysconfig/dropbear_dss_host_key; then

View File

@ -33,9 +33,17 @@ ln -s /mnt/data/satip-axe/sysconfig /etc/sysconfig
if ! test -r /etc/sysconfig/config ; then
cp /etc/config.default /etc/sysconfig/config
fi
if test -r /etc/sysconfig/passwd ; then
cp /etc/sysconfig/passwd /etc/passwd
fi
# 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
# local boot
if test -x /etc/sysconfig/localboot ; then
/etc/sysconfig/localboot
fi

13
fs-add/etc/init.d/satip Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
test -r /etc/sysconfig/config && . /etc/sysconfig/config
if test "$MINISATIP" != "yes"; then
exit 0
fi
cd /tmp
while test 1 -eq 1; do
minisatip -f -g $MINISATIP_OPTS
logger "minisatip exited $?, restarting"
done

View File

@ -2,8 +2,10 @@
test -r /etc/sysconfig/config && . /etc/sysconfig/config
if test "$DROPBEAR" != "yes"; then
if test "$TELNETD" != "yes"; then
exit 0
fi
sleep 5
exec /usr/sbin/telnetd -F -l /bin/login

View File

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

5
fs-add/init Executable file
View File

@ -0,0 +1,5 @@
#!/bin/busybox sh
export TZ=":/etc/localtime"
exec /bin/busybox init

3
patches/uboot.script Normal file
View File

@ -0,0 +1,3 @@
fatload usb 0 0x84000000 satip-axe-@VERSION@.fw
set bootargs console=ttyAS0,115200 bigphysarea=20000
bootm 0x84000000

View File

@ -171,7 +171,6 @@ def setup_busybox():
run_cmd('cp ' + target_prefix + '/bin/busybox fs/bin')
run_cmd(' ln -s /bin/busybox fs/sbin/init')
run_cmd(' ln -s /bin/busybox fs/init')
run_cmd(' ln -s /bin/busybox fs/bin/sh')
#-----------------------------------------------
@ -297,13 +296,11 @@ def gen_fs(lib_list, init_type):
run_cmd('cp -d ' + target_prefix + '/lib/libnss_nis*' + ' fs/lib/')
run_cmd('cp -d ' + target_prefix + '/lib/libnss_nisplus*' + ' fs/lib/')
# libgcc_s.so.1 is reqired from libpthread but it's not possible get it by ldd cmd
for i in lib_list:
if i.find('libpthread') >= 0:
run_cmd('cp -a ' + target_prefix + '/lib/libgcc_*' + ' fs/lib/')
print '\t======================================='
# other libs
run_cmd('cp -d ' + target_prefix + '/lib/libutil*' + ' fs/lib/')
run_cmd('cp -d ' + target_prefix + '/lib/librt*' + ' fs/lib/')
run_cmd('cp -d ' + target_prefix + '/lib/libpthread*' + ' fs/lib/')
run_cmd('cp -a ' + target_prefix + '/lib/libgcc_*' + ' fs/lib/')
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/')
@ -335,6 +332,7 @@ def usage():
print '\n -t, --target_prefix <path> the target path location '
print ' (default: /opt/STM/STLinux-2.4/devkit/sh4/target/)'
print '\n -e, --extra <file>:<dst> to be added to the filesystem'
print '\n -r, --version <ver>'
print '\n -i --init_type : '
print '\t\t\t busybox '
print '\t\t\t sysv '
@ -351,13 +349,15 @@ def get_menu_opt(argv):
try:
# opts = ''
# args = ''
opts , args = getopt.gnu_getopt(argv, 'hb:e:t:i:', ['--init_type', '--binary=', '--extra', '--target_prefix=', '--help'])
opts , args = getopt.gnu_getopt(argv, 'hb:e:t:i:r:',
['--init_type', '--binary=', '--extra', '--target_prefix=', '--version', '--help'])
except getopt.GetoptError:
usage()
target_prefix = ''
console = ''
binary_list=[]
extra_list=[]
version = ''
for o, v in opts:
if o == '-b' or o == '--binary':
v = v.split(' ') # take out all blank spaces and replace the v string with binary_list
@ -373,6 +373,8 @@ def get_menu_opt(argv):
target_prefix = v
elif o == '-i' or o == '--init_type':
console = v
elif o == '-r' or o == '--version':
version = v
elif o == '-h' or o == '--help':
usage()
params = []
@ -380,6 +382,7 @@ def get_menu_opt(argv):
params.append(console)
params.append(target_prefix)
params.append(extra_list)
params.append(version)
return params
#-----------------------------------------
@ -497,6 +500,7 @@ user_param = ['', '', '']
user_param = get_menu_opt(sys.argv[1:])
bin_list = user_param[0] # command list to find
extra_list = user_param[3]
version = user_param[4]
if user_param[1] != '':
boot_type = user_param[1] # default busybox
@ -561,6 +565,12 @@ print ' ' + 30*'=' + '\n'
gen_fs(library_list, boot_type)
run_cmd('cp -av fs-add/* fs')
f = open("fs/etc/motd")
b = f.read(1024*1024)
f.close()
f = open("fs/etc/motd", "w+")
f.write(b.replace('@VERSION@', version))
f.close()
files = run_cmd('find fs -name "*~"')
for f in files:
run_cmd('rm ' + f.strip())
@ -569,5 +579,8 @@ for r in ['usr/bin/bashbug']:
run_cmd('rm fs/' + r)
for e in extra_list:
src, dst = e.split(':')
dir = os.path.dirname(dst)
if not os.path.exists('fs/' + dir):
run_cmd('mkdir -p fs/' + dir)
run_cmd('cp ' + src + ' fs/' + dst)
do_cpio('fs')