elf_strip()
{
    case "$(readelf -h $1)" in
        *Type:*'DYN (Shared object file)'*)
            abinfo "strip --strip-unneeded --remove-section=.comment --remove-section=.note ${1#$SRCDIR}"
            strip --strip-unneeded --remove-section=.comment --remove-section=.note $1 ;;
        *Type:*'EXEC (Executable file)'*)
            abinfo "strip --strip-all --remove-section=.comment --remove-section=.note ${1#$SRCDIR}"
            strip --strip-all --remove-section=.comment --remove-section=.note $1 ;;
        *Type:*'REL (Relocatable file)'*)
    case "$1" in
        *.ko)
            abinfo "strip --strip-unneeded --remove-section=.comment --remove-section=.note ${1#$SRCDIR}"
            strip --strip-unneeded --remove-section=.comment --remove-section=.note $1 ;;
        *)
            abinfo "strip --strip-debug --enable-deterministic-archives --remove-section=.comment --remove-section=.note ${1#$SRCDIR}"
            strip --strip-debug --enable-deterministic-archives --remove-section=.comment --remove-section=.note $1 ;;
    esac ;;
        *)
            true ;;
    esac
}

for _ko in `find "$SRCDIR" -name '*.ko'`; do
    elf_strip "$_ko"
done
