1#!/bin/bash 2# Copyright (C) 2017 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16if ! hash iasl; then 17 echo "Please install 'acpica-tools' first." 18 exit 1 19fi 20 21SRCDIR="data" 22ASL_LIST=" 23 ssdt1.asl 24 ssdt2.asl 25 ssdt3.asl 26" 27AML_LIST=( 28 "ssdt1.aml" 29 "ssdt2.aml" 30 "ssdt3.aml" 31) 32CONFIG="${SRCDIR}/mkdtimg_acpi.cfg" 33 34OUTDIR="out" 35OUTDTB_CFG="${OUTDIR}/dump_cfg.aml" 36OUTDTB="${OUTDIR}/dump.aml" 37 38mkdir -p "$OUTDIR" 39for asl in ${ASL_LIST}; do 40 echo "Building $asl..." 41 src_asl="${SRCDIR}/${asl}" 42 out_aml_pfx="${OUTDIR}/${asl%.asl}" 43 iasl -p "${out_aml_pfx}" "$src_asl" 44done 45 46IMG="${OUTDIR}/cfg_create_acpi.img" 47mkdtimg cfg_create "$IMG" "${CONFIG}" --dtb-dir="$OUTDIR" 48mkdtimg dump "$IMG" -b "$OUTDTB_CFG" | grep -v 'FDT' | tee "${OUTDIR}/cfg_create_acpi.dump" 49for index in "${!AML_LIST[@]}"; do 50 diff ${OUTDIR}/${AML_LIST[$index]} ${OUTDTB_CFG}.$index 51done 52 53IMG="${OUTDIR}/create_acpi.img" 54mkdtimg create "$IMG" --dt_type=acpi --page_size=2048 --id=0x100 --rev=0x100 --version=1 \ 55 "${OUTDIR}/ssdt1.aml" "${OUTDIR}/ssdt2.aml" "${OUTDIR}/ssdt3.aml" 56mkdtimg dump "$IMG" -b "$OUTDTB" | grep -v 'FDT' | tee "${OUTDIR}/create_acpi.dump" 57for index in "${!AML_LIST[@]}"; do 58 diff ${OUTDIR}/${AML_LIST[$index]} ${OUTDTB}.$index 59done 60 61diff "${OUTDIR}/cfg_create_acpi.dump" "${OUTDIR}/create_acpi.dump" 62