Use sed, awk and hexdump from tools to make this work on Solaris. Ok by apb.

This commit is contained in:
hans 2009-01-18 13:55:31 +00:00
parent 7ff8bbb1b3
commit d4647b05dd
2 changed files with 13 additions and 5 deletions

View File

@ -1,8 +1,12 @@
# $NetBSD: Makefile.wakecode.inc,v 1.3 2007/12/11 13:56:50 lukem Exp $ # $NetBSD: Makefile.wakecode.inc,v 1.4 2009/01/18 13:55:31 hans Exp $
# FreeBSD: src/sys/i386/acpica/Makefile,v 1.3 2002/05/01 21:54:07 peter Exp # FreeBSD: src/sys/i386/acpica/Makefile,v 1.3 2002/05/01 21:54:07 peter Exp
ACPI_WAKECODE_S= ${S}/arch/${MACHINE}/acpi/acpi_wakecode.S ACPI_WAKECODE_S= ${S}/arch/${MACHINE}/acpi/acpi_wakecode.S
ACPI_GENWAKECODE= ${S}/arch/x86/acpi/genwakecode.sh ACPI_GENWAKECODE= ${S}/arch/x86/acpi/genwakecode.sh
ACPI_GENCMD= AWK=${TOOL_AWK:Q} \
HEXDUMP=${TOOL_HEXDUMP:Q} \
SED=${TOOL_SED:Q} \
${HOST_SH}
acpi_wakecode.h: ${ACPI_WAKECODE_S} ${ACPI_GENWAKECODE} acpi_wakecode.h: ${ACPI_WAKECODE_S} ${ACPI_GENWAKECODE}
${_MKTARGET_CREATE} ${_MKTARGET_CREATE}
@ -10,7 +14,7 @@ acpi_wakecode.h: ${ACPI_WAKECODE_S} ${ACPI_GENWAKECODE}
${LD} -M -Map acpi_wakecode.bin.map -z defs -nostdlib \ ${LD} -M -Map acpi_wakecode.bin.map -z defs -nostdlib \
--oformat binary -e wakeup_16 -Ttext 0 \ --oformat binary -e wakeup_16 -Ttext 0 \
-o acpi_wakecode.bin acpi_wakecode.o -o acpi_wakecode.bin acpi_wakecode.o
${HOST_SH} ${ACPI_GENWAKECODE} > acpi_wakecode.h ${ACPI_GENCMD} ${ACPI_GENWAKECODE} > acpi_wakecode.h
rm -f acpi_wakecode.bin acpi_wakecode.o acpi_wakecode.bin.map rm -f acpi_wakecode.bin acpi_wakecode.o acpi_wakecode.bin.map
acpi_wakeup.o acpi_wakeup.d: acpi_wakecode.h acpi_wakeup.o acpi_wakeup.d: acpi_wakecode.h

View File

@ -1,12 +1,16 @@
#!/bin/sh #!/bin/sh
# $NetBSD: genwakecode.sh,v 1.2 2007/12/09 20:32:18 jmcneill Exp $ # $NetBSD: genwakecode.sh,v 1.3 2009/01/18 13:55:31 hans Exp $
AWK=${AWK:=awk}
HEXDUMP=${HEXDUMP:=hexdump}
SED=${SED:=sed}
P='/WAKEUP_/ { printf("#define\t%s%s\t%s\n", $2, length($2) < 16 ? "\t" : "", $1); }' P='/WAKEUP_/ { printf("#define\t%s%s\t%s\n", $2, length($2) < 16 ? "\t" : "", $1); }'
awk "$P" < acpi_wakecode.bin.map ${AWK} "$P" < acpi_wakecode.bin.map
echo echo
echo 'static const unsigned char wakecode[] = {'; echo 'static const unsigned char wakecode[] = {';
hexdump -v -e '"\t" 8/1 "0x%02x, " "\n"' < acpi_wakecode.bin | sed 's/0x /0x00/g' ${HEXDUMP} -v -e '"\t" 8/1 "0x%02x, " "\n"' < acpi_wakecode.bin | ${SED} 's/0x /0x00/g'
echo '};' echo '};'
exit 0 exit 0