From 4849c2cfd99d125d084c937055a31c0a2171436c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 3 Apr 2015 13:20:23 +0200 Subject: [PATCH] more syscall-dump improvements --- Makefile | 32 +++++++++++++++++++++++++++++--- tools/s2i-dump.sh | 12 ++++++++++++ tools/syscall-dump.c | 4 ++-- 3 files changed, 43 insertions(+), 5 deletions(-) create mode 100755 tools/s2i-dump.sh diff --git a/Makefile b/Makefile index 6122ad86..9e2030e7 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ STLINUX=/opt/STM/STLinux-2.4 TOOLPATH=$(STLINUX)/host/bin TOOLCHAIN=$(STLINUX)/devkit/sh4 TOOLCHAIN_KERNEL=$(shell pwd)/toolchain/4.5.3-99/opt/STM/STLinux-2.4/devkit/sh4 +HOST_ARCH=$(shell uname -m) 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 \ @@ -140,9 +141,33 @@ firmware/initramfs/root/modules_idl4k_7108_ST40HOST_LINUX_32BITS/axe_dmx.ko: # syscall dump # -tools/syscall-dump: tools/syscall-dump.c - gcc -o syscall-dump.o -c -fPIC -Wall tools/syscall-dump.c - gcc -o syscall-dump.so -shared -rdynamic syscall-dump.o -ldl +tools/syscall-dump.so: tools/syscall-dump.c + $(TOOLCHAIN)/bin/sh4-linux-gcc -o tools/syscall-dump.o -c -fPIC -Wall tools/syscall-dump.c + $(TOOLCHAIN)/bin/sh4-linux-gcc -o tools/syscall-dump.so -shared -rdynamic tools/syscall-dump.o -ldl + +tools/syscall-dump.so.$(HOST_ARCH): tools/syscall-dump.c + gcc -o tools/syscall-dump.o.$(HOST_ARCH) -c -fPIC -Wall tools/syscall-dump.c + gcc -o tools/syscall-dump.so.$(HOST_ARCH) -shared -rdynamic tools/syscall-dump.o.$(HOST_ARCH) -ldl + +.PHONY: s2i_dump +s2i_dump: tools/syscall-dump.so + if test -z "$(SATIP_HOST)"; then echo "Define SATIP_HOST variable"; exit 1; fi + scp tools/syscall-dump.so \ + tools/s2i-dump.sh \ + firmware/initramfs/root/s2i.bin \ + firmware/initramfs/usr/lib/libuuid.so.1 \ + firmware/initramfs/usr/lib/libcurl.so.4 \ + firmware/initramfs/usr/lib/liboauth.so.0 \ + firmware/initramfs/usr/lib/libsoup-2.4.so.1 \ + firmware/initramfs/usr/lib/libgio-2.0.so.0 \ + firmware/initramfs/usr/lib/libgobject-2.0.so.0 \ + firmware/initramfs/usr/lib/libgmodule-2.0.so.0 \ + firmware/initramfs/usr/lib/libgthread-2.0.so.0 \ + firmware/initramfs/usr/lib/libssl.so.1.0.0 \ + firmware/initramfs/usr/lib/libcrypto.so.1.0.0 \ + firmware/initramfs/usr/lib/libxml2.so.2 \ + root@$(SATIP_HOST):/usr/lib + scp firmware/initramfs/usr/local/bin/mdnsd root@$(SATIP_HOST):/usr/bin # # minisatip @@ -196,3 +221,4 @@ dropbear: apps/$(DROPBEAR)/dropbear clean: kernel-mrproper rm -rf firmware/initramfs rm -rf toolchain/4.5.3-99 + rm -rf tools/syscall-dump.o* tools/syscall-dump.s* diff --git a/tools/s2i-dump.sh b/tools/s2i-dump.sh new file mode 100755 index 00000000..d5fc6487 --- /dev/null +++ b/tools/s2i-dump.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +if ! test -d /mnt/s2i-log; then + mkdir -p /mnt/s2i-log + mount -t tmpfs -o size=300M,mode=0755 tmpfs /mnt/s2i-log +fi +mkdir -p /usr/local/bin +ln -sf /usr/bin/mdnsd /usr/local/bin/mdnsd +rm -f /mnt/s2i-log/s2i.log +LD_PRELOAD=/usr/lib/syscall-dump.so \ +SYSCALL_DUMP_LOG=/mnt/s2i-log/s2i.log \ +/usr/lib/s2i.bin diff --git a/tools/syscall-dump.c b/tools/syscall-dump.c index 13d35cff..9ad71c10 100644 --- a/tools/syscall-dump.c +++ b/tools/syscall-dump.c @@ -199,7 +199,7 @@ off_t lseek(int fd, off_t offset, int whence) REDIR(real_lseek, "lseek"); r = real_lseek(fd, offset, whence); - dlog("lseek(%d, %lx, %d) = %d (%d)\n", fd, (long)offset, whence, r, E(r)); + dlog("lseek(%d, %ld, %d) = %d (%d)\n", fd, (long)offset, whence, r, E(r)); return r; } @@ -212,7 +212,7 @@ off64_t lseek64(int fd, off64_t offset, int whence) REDIR(real_lseek64, "lseek64"); r = real_lseek64(fd, offset, whence); - dlog("lseek(%d, %llx, %d) = %d (%d)\n", fd, (long long)offset, whence, r, E(r)); + dlog("lseek(%d, %lld, %d) = %d (%d)\n", fd, (long long)offset, whence, r, E(r)); return r; }