...
 
Commits (17)
b/
config.sh
.*
/kobj/
/kernel/
*.img
......@@ -14,9 +14,10 @@ Prerequisites
To use dtbTool you should have libfdt installed.
libfdt-dev (debian)
libfdt1 (debian)
libfdt-devel (redhat)
sys-apps/dtc (gentoo)
community/dtc (arch)
Background
----------
......
......@@ -27,6 +27,7 @@
#
cmdline="console=ttyMSM0,115200,n8"
base=0x00000000
base=0x80000000
dtbs=qcom/
arch=arm64
image=Image
8916
\ No newline at end of file
# Copyright (c) 2016, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
cmdline="console=ttyMSM0,115200,n8"
base=0x00000000
dtbs=qcom/
arch=arm64
# Copyright (c) 2016, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
cmdline="clk_ignore_unused"
base=0x00000000
dtb=qcom/msm8998-mtp.dtb
arch=arm64
......@@ -60,6 +60,7 @@ soc_ids = {
'ipq8064' : 202,
'ipq8066' : 203,
'msm8916' : 206,
'msm8994' : 207,
'apq8074_aa' : 208,
'apq8074_ab' : 209,
'apq8074_pro' : 210,
......@@ -76,8 +77,13 @@ soc_ids = {
'msm8996' : 246,
'apq8016' : 247,
'msm8216' : 248,
'msm8992' : 251,
'apq8092' : 252,
'apq8094' : 253,
'ipq4019' : 273,
'apq8096' : 291,
'msm8998' : 292,
'msm8996sg' : 305,
}
platform_type = {
......@@ -253,6 +259,16 @@ class QcomIds(object):
minor = int(matches['minor'] or 0)
self.pmic_id[i] = model | major << 16 | minor << 8
@staticmethod
def valid(compat):
match = QcomIds.pattern.match(compat)
if match:
matches = match.groupdict()
return (matches['soc'] in soc_ids and
matches['platform'] in platform_type)
return False
@total_ordering
class DTRecord:
def __init__(self, plat_id, variant_id, subtype_id, soc_rev, pmic0, pmic1, pmic2, pmic3, offset, size, f, version):
......@@ -378,7 +394,7 @@ def generate_records(f, pagesize):
version = 3
pmics = find_pmics(blob)
ids = [QcomIds(compat, pmics) for compat in compats
if QcomIds.pattern.match(compat)]
if QcomIds.valid(compat)]
records += [DTRecord(x.msm_id[0], x.board_id[0], x.board_id[1],
x.msm_id[1], x.pmic_id[0], x.pmic_id[1],
x.pmic_id[2], x.pmic_id[3], 0, size, f,
......
......@@ -55,11 +55,11 @@ fi
die()
{
echo Build failure
echo ${1:-Failure}
exit 1
}
if test -n "$ARCH" && test "$ARCH" != "arm"
if test -n "$ARCH" -a "$ARCH" != "arm"
then
die "Building for wrong arch"
fi
......@@ -77,7 +77,7 @@ fi
config=arch/arm/configs/${defconfig}
# cp $config ../kobj/.config
make ARCH=arm $O_STR ${defconfig} || die
make ARCH=arm $O_STR ${defconfig} || die "Build failure"
make ARCH=arm $O_STR "$@"
status=$?
......
......@@ -52,11 +52,11 @@ fi
die()
{
echo Build failure
echo ${1:-Failure}
exit 1
}
if test -n "$ARCH" && test "$ARCH" != "arm64"
if test -n "$ARCH" -a "$ARCH" != "arm64"
then
die "Building for wrong arch"
fi
......@@ -74,7 +74,7 @@ fi
config=arch/arm64/configs/${defconfig}
# cp $config ../kobj/.config
make ARCH=arm64 $O_STR ${defconfig} || die
make ARCH=arm64 $O_STR ${defconfig} || die "Build failure"
make ARCH=arm64 $O_STR "$@"
status=$?
......
......@@ -38,7 +38,7 @@ def write_padding(f, pagesize):
count = pagesize - (f.tell() % pagesize)
# Write padding as long as we aren't already aligned to a page
if count != pagesize:
output.write("".join(['\x00' for x in xrange(count)]))
output.write(b'\x00' * count)
if __name__ == "__main__":
usage = ("""%prog [options]""")
......@@ -57,6 +57,8 @@ if __name__ == "__main__":
parser.add_option("--pagesize", type="int", dest="pagesize",
default=2048,
help="NAND pagesize [default: %default]")
parser.add_option("--board", dest="board", default="",
help="Board identifier")
# New options
parser.add_option("--ramdisk_base", type="int", dest="ramdisk_base",
default=-1, help="Start address of ramdisk image")
......@@ -75,6 +77,8 @@ if __name__ == "__main__":
parser.error("Must specify --base")
if options.cmdline is None:
parser.error("Must specify --cmdline")
if len(options.board) > 16:
parser.error("--boards argument must be <= 16 characters")
try:
kernel = open(options.kernel, 'rb')
......@@ -101,13 +105,12 @@ if __name__ == "__main__":
kernel_size = os.fstat(kernel.fileno()).st_size
dtb_size = 0
if options.devicetree:
of_dt_header = 0xd00dfeed
magic = devicetree.read(4)
devicetree.seek(0)
if int(magic.encode('hex'),16) == of_dt_header:
if magic == b'\xd0\x0d\xfe\xed': # 0xd00dfeed
append_dtb = True
kernel_size += os.fstat(devicetree.fileno()).st_size
elif magic == 'QCDT':
elif magic == b'QCDT':
append_dtb = False
dtb_size = os.fstat(devicetree.fileno()).st_size
else:
......@@ -115,7 +118,7 @@ if __name__ == "__main__":
hdr_format = "<8sIIIIIIII2I16s512s8I"
output.write(pack(hdr_format,
"ANDROID!",
b"ANDROID!",
kernel_size,
options.base + 0x8000,
os.fstat(ramdisk.fileno()).st_size,
......@@ -124,8 +127,8 @@ if __name__ == "__main__":
tags,
options.pagesize,
dtb_size, 0,
"",
options.cmdline,
options.board.encode(),
options.cmdline.encode(),
123456, 123456, 123456, 123456, 123456, 123456,
0, 0))
write_padding(output, pagesize)
......@@ -137,3 +140,4 @@ if __name__ == "__main__":
write_padding(output, pagesize)
if options.devicetree and not append_dtb:
output.write(devicetree.read())
write_padding(output, pagesize)
......@@ -74,7 +74,7 @@ then
usage
fi
image=zImage pagesize=2048 cmdline= base= initrd= needs_fixup= dtb= modules=
pagesize=2048 cmdline= base= initrd= needs_fixup= dtb= modules=
extra_dir= dtbs= dtarg= arch= uImage= dirty= verbose=
target="$1"
......@@ -92,6 +92,16 @@ case "$target" in
;;
esac
if test -z $image
then
if test "$arch" = "arm"
then
image=zImage
else
image=Image.gz
fi
fi
shift
while test $# != 0
......@@ -211,7 +221,7 @@ then
dtdir1=arch/arm/boot/dts/
dtdir2=arch/arm/boot/
else
image=arch/arm64/boot/Image
image=arch/arm64/boot/$image
dtdir1=arch/arm64/boot/dts/
dtdir2=arch/arm64/boot/dts/
fi
......