Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move compile-mbr.sh script into fail-mbr's automake #255

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ AC_MSG_RESULT([$fuse_version])
fi

AC_CHECK_LIB([pthread], [pthread_create], [], AC_MSG_ERROR([*** pthread library (libpthread) not found]))
AC_PATH_PROG(OBJCOPY, objcopy, ,)

##ext2/3##
AC_ARG_ENABLE([extfs],
Expand Down Expand Up @@ -491,6 +490,14 @@ PKG_CHECK_VAR([bashcompletiondir], [bash-completion], [completionsdir], [],
[bashcompletiondir="${sysconfdir}/bash_completion.d"])
AC_SUBST(bashcompletiondir)

##fail-mbr
AC_CHECK_TOOL([OBJCOPY], [objcopy])
AC_CHECK_TOOL([OBJDUMP], [objdump])
AM_CONDITIONAL(X86, [case $host_cpu in
x86_64|i[0-9]86) true ;;
*) false ;;
esac])

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
Expand Down
33 changes: 31 additions & 2 deletions fail-mbr/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,34 @@ clean-local:

distclean-local: clean-local

fail-mbr.bin:
sh $(srcdir)/compile-mbr.sh
if X86
fail-mbr.image: fail-mbr.S
$(CC) -c "$<" -o "$@"

fail-mbr.bin: fail-mbr.image
$(OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .note.gnu.property -R .reginfo -R .rel.dyn "$<" "$@"

## Check that this file is the same as the original fail-mbr:
@echo "Checking the file:"
$(OBJDUMP) -D -b binary -mi386 -Maddr16,data16 "$@" > f1.obj
$(OBJDUMP) -D -b binary -mi386 -Maddr16,data16 "$(srcdir)/[email protected]" > f2.obj

## The regular expression is used to reject lines which contain either:
## - the name of the file, "fail-mbr"
## - a line separator output by diff, "---"
## - the OP code "xor %ax,%ax" which may begin by 0x31 or 0x33
## - a numerical offset output by diff, ^[a-f0-9]*$
@if diff f1.obj f2.obj | grep -qEv 'fail-mbr|---|xor %ax,%ax|^[a-f0-9]*$$'; then \
echo "files $@ and [email protected] differ significantly:"; \
diff f1.obj f2.obj; \
exit 1; \
else \
echo "'[email protected]' and '[email protected]' have no significant differences."; \
rm f1.obj f2.obj; \
exit 0; \
fi
else
fail-mbr.bin: fail-mbr.bin.orig
@echo "The architecture is not x86, so the file '$@' is not compiled"
cp -vp "$<" "$@"
endif
56 changes: 0 additions & 56 deletions fail-mbr/compile-mbr.sh

This file was deleted.