1#!/usr/bin/bash 2 3outdir= 4while getopts "o:" arg; do 5 case ${arg} in 6 o ) 7 outdir=$OPTARG 8 ;; 9 \? ) 10 echo "Usage: ./tests/data/acpi/disassemle-aml.sh [-o <output-directory>]" 11 exit 1 12 ;; 13 14 esac 15done 16 17for machine in tests/data/acpi/*/* 18do 19 if [[ ! -d "$machine" ]]; 20 then 21 continue 22 fi 23 24 if [[ "${outdir}" ]]; 25 then 26 mkdir -p "${outdir}"/${machine} || exit $? 27 fi 28 for aml in $machine/* 29 do 30 if [[ "$aml" == $machine/*.dsl ]]; 31 then 32 continue 33 fi 34 if [[ "$aml" == $machine/SSDT*.* ]]; 35 then 36 dsdt=${aml/SSDT*./DSDT.} 37 extra="-e ${dsdt}" 38 elif [[ "$aml" == $machine/SSDT* ]]; 39 then 40 dsdt=${aml/SSDT*/DSDT}; 41 extra="-e ${dsdt}" 42 else 43 extra="" 44 fi 45 if [[ "${outdir}" ]]; 46 then 47 # iasl strips an extension from prefix if there. 48 # since we have some files with . in the name, the 49 # last component gets interpreted as an extension: 50 # add another extension to work around that. 51 prefix="-p ${outdir}/${aml}.dsl" 52 else 53 prefix="" 54 fi 55 iasl ${extra} ${prefix} -d ${aml} 56 done 57done 58