Code:
[B]28.0.A.7.24[/B]/kernel$ dtbToolCM -o dt.img -s 2048 -p ./scripts/dtc/ ./arch/arm/boot/dts/
DTB combiner:
Input directory: './arch/arm/boot/dts/'
Output file: 'dt.img'
Found file: apq8094-v1-kitakami_karin_windy.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
Found file: apq8094-v2.1-kitakami_karin_windy.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
Found file: apq8094-v2.0-kitakami_karin_windy.dtb ... skip, failed to scan for 'qcom,msm-id = <' tag
=> [COLOR="Red"]Found 0 unique DTB(s)[/COLOR]
The kernel is built before without errors.
I got 2 warnings from the make kitakami_defconfig:
Code:
warning: (PCI_MSM && AMD_IOMMU) selects PCI_MSI which has [COLOR="red"]unmet direct dependencies (PCI && ARCH_SUPPORTS_MSI)[/COLOR]
warning: (ARCH_MSM) selects DEVFREQ_GOV_MSM_BW_HWMON which has [COLOR="red"]unmet direct dependencies (PM_DEVFREQ && (ARCH_MSM_KRAIT || ARCH_MSM_BIMC_BWMON))[/COLOR]
Should I bother? make runs fine...
Code:
[B]make V=1 dtbs[/B]
make -f scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f /home/rest/android/28.0.A.7.24/kernel/scripts/Makefile.asm-generic \
src=asm obj=arch/arm64/include/generated/asm
make -f /home/rest/android/28.0.A.7.24/kernel/scripts/Makefile.asm-generic \
src=uapi/asm obj=arch/arm64/include/generated/uapi/asm
make -f scripts/Makefile.build obj=scripts
make -f scripts/Makefile.build obj=scripts/dtc
make -f scripts/Makefile.build obj=scripts/genksyms
make -f scripts/Makefile.build obj=scripts/mod
mkdir -p scripts/mod/
/home/rest/android/28.0.A.7.24/kernel/scripts/[I][COLOR="Magenta"]gcc-wrapper.py[/COLOR][/I] /home/rest/android/aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc -Wp,-MD,scripts/mod/.devicetable-offsets.s.d -nostdinc -isystem /home/rest/android/aarch64-linux-android-4.9/bin/../lib/gcc/aarch64-linux-android/4.9.x-google/include -I/home/rest/android/28.0.A.7.24/kernel/arch/arm64/include -Iarch/arm64/include/generated -Iinclude -I/home/rest/android/28.0.A.7.24/kernel/arch/arm64/include/uapi -Iarch/arm64/include/generated/uapi -I/home/rest/android/28.0.A.7.24/kernel/include/uapi -Iinclude/generated/uapi -include /home/rest/android/28.0.A.7.24/kernel/include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -Wno-maybe-uninitialized -mgeneral-regs-only -Wframe-larger-than=2048 -fstack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(devicetable_offsets)" -D"KBUILD_MODNAME=KBUILD_STR(devicetable_offsets)" -fverbose-asm -S -o scripts/mod/devicetable-offsets.s scripts/mod/devicetable-offsets.c
(set -e; echo "#ifndef __DEVICEVTABLE_OFFSETS_H__"; echo "#define __DEVICEVTABLE_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by Kbuild"; echo " *"; echo " */"; echo ""; sed -ne "/^->/{s:->#\(.*\):/* */:; s:^->\([^ ]*\) [\$#]*\([-0-9]*\) \(.*\):#define /* */:; s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define /* */:; s:->::; p;}" scripts/mod/devicetable-offsets.s; echo ""; echo "#endif" ) > scripts/mod/devicetable-offsets.h
gcc -Wp,-MD,scripts/mod/.file2alias.o.d -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -c -o scripts/mod/file2alias.o scripts/mod/file2alias.c
gcc -o scripts/mod/modpost scripts/mod/modpost.o scripts/mod/file2alias.o scripts/mod/sumversion.o
make -f scripts/Makefile.build obj=scripts/selinux
make -f scripts/Makefile.build obj=scripts/selinux/genheaders
make -f scripts/Makefile.build obj=scripts/selinux/mdp
make -f scripts/Makefile.build obj=arch/arm64/boot/dts dtbs
make[1]: [COLOR="Red"]Nothing to be done for 'dtbs'.[/COLOR]
make -f scripts/Makefile.build obj=arch/arm64/boot/dts/qcom dtbs
make[1]: [COLOR="red"]Nothing to be done for 'dtbs'.[/COLOR]
I am on Debian testing. Python 2.7.10
looking into .apq8094-v2.1-kitakami_karin_windy.dtb.dts.tmp in directory 28.0.A.7.24/kernel/arch/arm/boot/dts/ I find e.g.
Code:
qcom,msm-id = <253 0x10000>;
.
It does not make it into apq8094-v1-kitakami_karin_windy.dtb
Any hints how I could proceed to the dt.img?
I needed a newer dbtTool
and an additional -2 on the commandline to use the newer QC table of device tree.
http://forum.xda-developers.com/showthread.php?p=52279145 post #79
I use DooMLoRDs dtbToolCM.
Maybe the SONY documentation is for pre-2015 devices here.
Now I have built my first boot.img
... and my tablet bootloops :crying:
Related
HI, I'm trying to extract initramfs from zImage by following this excellent thread:
http://forum.xda-developers.com/showthread.php?t=901152
I have followed carefully all the steps but i am getting the following error while executing the extraction script :
# sh repack-zImage.sh -u
repack-zImage.sh: 99: Syntax error: "(" unexpected
How can i resolve this please.
here is the sript :
Code:
#!/bin/bash
version="Version 6, by mizch <[email protected]>
Time-stamp: <2011-05-03 20:14:30 hcz>
Please refer to the thread on http://www.xda-developers.com for
questions and remarks about this program."
# Copyright (C) 2011 by Heike C. Zimmerer <[email protected]>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License. For
# details see <http://www.gnu.org/licenses/>.
### Preparation:
# You should have received cpio_set0 along with this program.
# Copy it into /usr/local/bin.
#
# The program will run without this (and emit an info message about
# using the normal cpio). However, the compession result of the
# initramfs will be smaller and consistent if you use it.
### What the program does:
usage(){
echo "\
Usage: $pname [-v] -u|-p|-z [<file name, default: zImage>]
Function: [Un]Pack a zImage (for modification, mainly of the initramfs)
Opts:
-u unpack an Image
-p pack an image from a directory structure created by
a previous unpack
-z create <file name>.tar from <file name> (simple tar, nothing fancy)
--version print version info
--help print this help
Play with the following three options to get best compression results:
-s use standard cpio (default: uses cpio_set0 if available)
-g use gen_init_cpio instead of cpio/cpio_set0 (ignores -s)
-r don't reorder initramfs according to the original layout
Debugging:
-v verbose (show commands and results as they are executed)
-x script debug (set -x)
Options to help nail down which modified part causes booting to fail.
Lower numbers override higher numbered options:
-1 Use original piggy.gz+piggy_trailer
-2 Use original piggy.gz
-3 Use original piggy
-4 Use original initramfs(_gz)+part3
-5 Use original initramfs_cpio"
exit $1
}
### Graphical display of the unpack process:
#
# Each of the indented items on the same level is derived from the
# single item one level higher.
#
# zImage
# (split)
# +---- decompression_code
# +---- piggy.gz+piggy_trailer
# (split)
# +---- piggy.gz
# | (gunzip)
# | +---- piggy
# | ===== either (compressed initramfs) ====
# | |
# | (split via gunzip limits)
# | +---- kernel.img
# | +---- initramfs_gz+part3
# | (split)
# | +---- initramfs.cpio.gz
# | | (gunzip)
# | | +---- initramfs.cpio
# | | (cpio -i)
# | | +---- initramfs/
# | +---- padding3
# | +---- part3
# | ===== or (uncompressed initramfs) =====
# | |
# | (split at "0707")
# | +---- kernel.img
# | +---- initramfs+part3
# | (split after "TRAILER!!!")
# | +---- initramfs.cpio
# | | (cpio -i)
# | | +---- initramfs/
# | +---- padding3
# | +---- part3
# +---- padding_piggy
# +---- piggy_trailer
#
#
pname="${0##*/}"
args=("[email protected]")
cur_dir="$(pwd)"
# file names:
decompression_code="decompression_code"
piggy_gz_piggy_trailer="piggy.gz+piggy_trailer"
piggy="piggy"
piggy_gz="piggy.gz"
padding_piggy="padding_piggy"
piggy_trailer="piggy_trailer"
ramfs_gz_part3="initramfs.cpio+part3"
ramfs_cpio_gz="initramfs.cpio.gz"
padding3="padding3"
part3="part3"
kernel_img="kernel.img"
ramfs_cpio="initramfs.cpio"
ramfs_dir="initramfs"
sizes="sizes"
ramfs_part3="ramfs+part3"
ramfs_list="initramfs_list"
cpio_t="cpio-t"
cpio="cpio_set0"
# We dup2 stderr to 3 so an error path is always available (even
# during commands where stderr is redirected to /dev/null). If option
# -v is set, we dup2 sterr to 9 also so commands (and some of their
# results if redirected to &9) are printed also.
exec 9>/dev/null # kill diagnostic ouput (will be >&2 if -v)
exec 3>&2 # an always open error channel
#
########### Start of functions
#
# Emit an error message and abort
fatal(){
# Syntax: fatal <string ...>
# Output error message, then abort
echo >&3
echo >&3 "$pname: $*"
kill $$
exit 1
}
# Execute a command, displaying the command if -v:
cmd(){
# Syntax: cmd <command> <args...>
# Execute <command>, echo command line if -v
echo >&9 "$*"
"[email protected]"
}
# Execute a required command, displaying the command if -v, abort on
# error:
rqd(){
# Syntax: cmd <command> <args...>
# Execute <command>, echo commandline if -v, abort on error
cmd "[email protected]" || fatal "$* failed."
}
relpath(){
# Syntax: relpath <absolute_path>
# Function: print a path below $cur_dir as relative path on stdout
if [ "${1#$cur_dir}" != "$1" ]; then
echo -n ".${1#$cur_dir}"
else # not below cur_dir
echo -n "$1"
fi
}
findByteSequence(){
# Syntax: findByteSequence <fname> [<string, default: gzip header>]
# Returns: position (offset) on stdout, empty string if nothing found
file="$1"
local opt
if [ "$2" = "lzma" ]; then
srch=$'\x5d....\xff\xff\xff\xff\xff'
opt=
else
srch="${2:-$'\x1f\x8b\x08'}" # Default: search for gzip header
opt="-F"
fi
pos=$(LC_ALL=C grep $opt -a --byte-offset -m 1 --only-matching -e "$srch" -- "$file")
echo ${pos%%:*}
}
getFileSize(){
# Syntax: getFileSize <file>
# Returns size of the file on stdout.
# Aborts if file doesn't exist.
rqd stat -c %s "$1"
}
recordPackingFileSize()(
# Syntax: recordPackingFileSize <file-var> ...
#
# dump out a file size from the packing directory for debugging.
# Note that the whole function is running in a subshell, so we can
# cd here.
rqd cd "$packing"
for file in "[email protected]"; do
eval local fnam=\$$file
local size=$(getFileSize "$fnam")
printf 'size_%s=%d # %#x\n' $file $size $size
done >> "$sizes"
)
recordFileSize(){
# Syntax: recordFileSize <file-var> ...
# Dump a file size from the current directory into $sizes for
# later sourcing as a shell script.
for file in "[email protected]"; do
eval local fnam=\$$file
local size=$(getFileSize "$fnam")
printf 'size_%s=%d # %#x\n' $file $size $size
done >> "$sizes"
}
recordVars(){
# Syntax dumpVar <var-name>
# Dumps var into file $sizes for later sourcing as a shell script
for var in "[email protected]"; do
eval printf '"%s=\"%s\"\n"' $var \$$var \$$var
done >> "$sizes"
}
checkNUL(){
# Syntax: checkNUL file offset
# Returns true (0) if byte there is 0x0.
[ "$(rqd 2>/dev/null dd if="$1" skip=$2 bs=1 count=1)" = $'\0' ]
}
# We can tell from the magic number where the start of a gzipped
# section is. We cannot tell its exact end. We could only know the
# end if we could get at the kernel's zeropage variables - which we
# can't since their position varies between versions and
# architectures. The following function separates the gzipped part
# from trailing bytes (which can be possibly garbage, but who knows?)
# via successive aproximation.
gunzipWithTrailer(){
# Syntax gunzipWithTrailer <file> <gzip name, sans .gz> <padding> <trailer>
#
# <file>: the input file
# <gzip name, sans .gz>, <padding>, <trailer>:
# The output files. For the gzipped part, both the
# compressed and the uncompressed output is generated, so we have
# 4 output files.
local file="$1"
local gz_result="$2.gz"
local result="$2"
local padding="$3"
local trailer="$4"
local tmpfile="/tmp/gunzipWithTrailer.$$.gz"
local original_size=$(getFileSize "$file")
local d=$(( (original_size+1) / 2))
local direction fini at_min=0
local results_at_min=()
local size=$d
local at_min=0
echo "Separating gzipped part from trailer in '$(relpath "$file")'"
echo -n "Trying size: $size"
while :; do
rqd dd if="$file" of="$tmpfile" bs=$size count=1 2>/dev/null
cmd gunzip >/dev/null 2>&1 -c "$tmpfile"
res=$?
if [ "$d" -eq 1 ]; then
: $((at_min++))
results_at_min[$size]=1
[ "$at_min" -gt 3 ] && break
fi
d=$(((d+1)/2))
case $res in
# 1: too small
1) size=$((size+d)); direction="↑";;
# 2: trailing garbage
2) size=$((size-d)); direction="↓";;
# OK
0) break;;
*) fatal "gunzip returned $res while checking '$(relpath "$file")'";;
esac
echo -n " $size"
done
if [ "$at_min" -gt 3 ]; then
echo -e "\ngunzip result is oscillating between 'too small' and 'too large' at size: ${!results_at_min[*]}"
echo -n "Trying lower nearby values: "
fini=
for ((d=1; d < 30; d++)); do
: $((size--))
echo -n " $size"
rqd dd if="$file" of="$tmpfile" bs=$size count=1 2>/dev/null
if cmd gunzip >/dev/null 2>&1 -c "$tmpfile"; then
echo -n " - OK"
fini=1
break
fi
done
[ -z "$fini" ] && fatal 'oscillating gunzip result, giving up.'
fi
# We've found the end of the gzipped part. This is not the real
# end since gzip allows for some trailing padding to be appended
# before it barfs. First, go back until we find a non-null
# character:
echo -ne "\npadding check (may take some time): "
real_end=$((size-1))
while checkNUL "$file" $real_end; do
: $((real_end--))
done
# Second, try if gunzip still succeeds. If not, add trailing
# null(s) until it succeeds:
while :; do
rqd dd if="$file" of="$tmpfile" bs=$real_end count=1 2>/dev/null
gunzip >/dev/null 2>&1 -c "$tmpfile"
case $? in
# 1: too small
1) : $((real_end++));;
*) break;;
esac
done
real_next_start=$size
# Now, skip NULs forward until we reach a non-null byte. This is
# considered as being the start of the next part.
while checkNUL "$file" $real_next_start; do
: $((real_next_start++))
done
echo $((real_next_start - real_end))
echo
rm "$tmpfile"
# Using the numbers we got so far, create the output files which
# reflect the parts we've found so far:
rqd dd 2>&9 if="$file" of="$gz_result" bs=$real_end count=1
rqd dd 2>&9 if="$file" of="$padding" skip=$real_end bs=1 count=$((real_next_start - real_end))
rqd dd 2>&9 if="$file" of="$trailer" bs=$real_next_start skip=1
rqd gunzip -c "$gz_result" > "$result"
}
# See the comment for gunzipWithTrailer (above) for what this function
# does:
unlzmaWithTrailer(){
# Syntax unlzmaWithTrailer <file> <gzip name, sans .gz> <padding> <trailer>
#
# <file>: the input file
# <gzip name, sans .gz>, <padding>, <trailer>:
# The output files. For the lzma'd part, both the
# compressed and the uncompressed output is generated, so we have
# 4 output files.
local file="$1"
local gz_result="$2.gz"
local result="$2"
local padding="$3"
local trailer="$4"
local tmpfile="/tmp/unlzmaWithTrailer.$$.gz"
local original_size=$(getFileSize "$file")
local d=$(( (original_size+1) / 2))
local direction fini at_min=0
local results_at_min=()
local size=$d
local at_min=
echo "Separating lzma'd part from trailer in '$(relpath "$file")'"
echo -n "Trying size: $size"
while :; do
rqd dd if="$file" of="$tmpfile" bs=$size count=1 2>/dev/null
cmd unlzma >/dev/null 2>&1 -S '' -c "$tmpfile"
res=$?
if [ "$d" -eq 1 ] && [ "$res" -eq 1 ]; then
at_min=yes # we're 1 below the result
fi
d=$(((d+1)/2))
case $res in
# 1: too small
1) size=$((size+d)); direction="↑";;
# 0: too large (or OK if d==1)
0) if [ "$at_min" ]; then
break
fi
size=$((size-d)); direction="↓";;
*) fatal "unlzma returned $res while checking '$(relpath "$file")'";;
esac
echo -n " $size"
done
# Now, skip NULs forward until we reach a non-null byte. This is
# considered as being the start of the next part.
echo
echo -n "Detecting padding: "
real_end="$size"
real_next_start="$size"
while checkNUL "$file" $real_next_start; do
: $((real_next_start++))
done
echo $((real_next_start - real_end))
echo
rm "$tmpfile"
# Using the numbers we got so far, create the output files which
# reflect the parts we've found so far:
rqd dd 2>&9 if="$file" of="$gz_result" bs=$real_end count=1
rqd dd 2>&9 if="$file" of="$padding" skip=$real_end bs=1 count=$((real_next_start - real_end))
rqd dd 2>&9 if="$file" of="$trailer" bs=$real_next_start skip=1
rqd unlzma -c -S '' "$gz_result" > "$result"
}
padTo(){
# Syntax: padTo <file> <size>
# Pads <file> to <size> with trailung 0x0s
# Does nothing if file matches size.
# Aborts if <file> too large for the operation.
local size=$(getFileSize "$1")
local tmp="/tmp/$pname.$$.zeroes"
if [ "$size" -eq "$2" ]; then
echo "$(relpath "$1"): size matches ($size)"
elif [ "$size" -gt "$2" ]; then
fatal "Size of '$(relpath "$1")' too large ($size > $2) (+$((size - $2)))"
else
echo "Padding '$(relpath "$1")' to $2 bytes (+$(($2 - size)))"
rqd dd 2>&9 if=/dev/zero of="$tmp" count=1 bs=$(($2 - size))
rqd cat "$tmp" >> "$1"
rqd rm -f "$tmp"
fi
}
padToMod(){
# Syntax: padTo <modulo> <file>
# Pads <file> until (size mod <modulo>) == 0.
local modulo=$1
local file="$2"
local size=$(getFileSize "$file")
local rest=$((size % modulo))
if [ "$rest" -ne 0 ]; then
padTo "$file" $((size + modulo - rest))
fi
}
buildZImageTar(){
# Syntax: buildZImageTar <path>
# Generates tarred file from <path> into the same directory.
# The file in the archive doesn't contain the path.
# Also copies the result to /home/Shared if it detects
# that it is running at home.
local dir="${1%/*}"/
[ "$dir" = "$1/" ] && dir="$(pwd)/"
(
cd "$dir"
rqd tar cf zImage.tar zImage
)
echo "Generated file: '$(relpath "${dir}$zImage.tar")'"
if [ "$HOSTNAME:$USER" = "Xelzbrot:hcz" ]; then
cp "${dir}zImage.tar" /home/Shared
echo "also copied to '/home/Shared'."
fi
}
reorderInitramfsList(){
# This is some black magic to get about the same compression
# result as the original initramfs.cpio. We reorder the files in
# our initramfs (which is to be created) so that they appear in
# the same order as in the original initramfs.
#
# Syntax: reorderInitramfsList <initramfs_list_file> <reordering_template_file>
#
# Reorders <initramfs_list_file> so that enries are in the order
# given by <reordering_template_file> (which comes from cpio -t).
# Files in <initramfs_list_file> but not in
# <reordering_template_file> are moved in sorted order to the end.
# Comments and empty lines are discarded. The result is written
# to <initramfs_list_file>.
#echo >&2 "Reordering initramfs list"
initramfs_list_file="$1"
reordering_template_file="$2"
declare -A ramfs_entries # make it an associative array
while read line; do
set -- $line
[ $# -eq 0 ] && continue # skip empty lines
[[ "$1" = \#* ]] && continue # skip comments
ramfs_entries["$2"]="$line" # else remember line, indexed by path
done < "$initramfs_list_file"
echo "# reordered ramfs entries" > "$initramfs_list_file"
# now spit the lines out in the order given by the reordering_template_file:
while read path; do
echo "${ramfs_entries["$path"]}"
unset ramfs_entries["$path"] # remove written lines from the array
done < "$reordering_template_file" >> "$initramfs_list_file"
# if there are any files left, append them in sorted order so directories
# come first:
for line in "${ramfs_entries[@]}"; do
echo "$line"
done \
| sort >> "$initramfs_list_file"
}
pack(){
if ! find >/dev/null 2>&1 "$unpacked" "$unpacked/$ramfs" "$unpacked/$sizes" -maxdepth 0; then
fatal "\
This does not look like a directory where a
previous unpack has been done."
fi
# create packing direcory
rqd mkdir -p "$packing"
sizes="$packing/sizes"
echo "# Packing sizes" > "$sizes"
# cd to unpacking directory (original and modified parts)
rqd cd "$unpacked"
# read in file size at the time of unpicking
rqd source sizes
if [ "$opt_1" ]; then
rqd cp "$piggy_gz_piggy_trailer" "$packing"
else
if [ "$opt_2" ]; then
rqd cp "$piggy_gz" "$packing"
else
if [ "$opt_3" ]; then
rqd cp "$piggy" "$packing"
compress_list=("$packing/$piggy") # compress it as a single file
else
if [ "$opt_4" ]; then
rqd cp "$ramfs_gz_part3" "$packing"
else
if [ "$opt_5" ]; then
rqd cp "$ramfs_cpio" "$packing"
else
echo "Generating initramfs"
if ! which >/dev/null "$cpio"; then
if [ -n "$compressed" ]; then
echo "Info: '$cpio' not found, using normal cpio."
echo " This only means that your compressed initramfs will be slightly larger"
echo " and its size will differ from invocation to invocation."
fi
cpio="cpio"
fi
for ftime in "" "-a" "-m"; do
find "$ramfs_dir" -exec touch $ftime -d @0 {} \;
done
rqd gen_initramfs_list.sh -u squash -g squash "$ramfs_dir" > "$packing/$ramfs_list"
cp "$packing/$ramfs_list" "$packing/$ramfs_list.orig"
if [ -z "$opt_r" ]; then
# reorder so files are arranged as in original initramfs:
reorderInitramfsList "$packing/$ramfs_list" "$cpio_t"
else
# sort so directories come before their content:
sort < "$cpio_t" > "$packing/$cpio_t.sorted"
reorderInitramfsList "$packing/$ramfs_list" "packing/$cpio_t.sorted"
fi
if [ -z "$opt_g" ]; then
# No -g: Use our own cpio routine
(
rqd cd "$ramfs_dir"
# extract the file names from our
# (possibly reordered) initramfs list
# and pass them to cpio:
while read line; do
set -- $line
[ $# -eq 0 ] && continue # skip empty lines
[[ "$1" = \#* ]] && continue # skip comments
echo "${2#/}"
done < "$packing/$ramfs_list" \
| rqd "$cpio" -H newc -R root:root -o > "$packing/$ramfs_cpio"
)
else
# -g set: use gen_init_cpio (from kernel tree)
rqd gen_init_cpio "$packing/$ramfs_list" > "$packing/$ramfs_cpio"
fi
recordPackingFileSize ramfs_cpio
fi # opt_5
if [ "$compressed" = "gz" ]; then
echo "Creating gzip compressed initramfs"
rqd gzip -8 < "$packing/$ramfs_cpio" > "$packing/$ramfs_cpio_gz"
padTo "$packing/$ramfs_cpio_gz" "$((size_ramfs_cpio_gz + size_padding3))"
rqd cat "$packing/$ramfs_cpio_gz" "$part3" > "$packing/$ramfs_gz_part3"
recordPackingFileSize ramfs_cpio_gz ramfs_gz_part3
elif [ "$compressed" = "lzma" ]; then
echo "Creating lzma compressed initramfs"
rqd lzma -9 < "$packing/$ramfs_cpio" > "$packing/$ramfs_cpio_gz"
padTo "$packing/$ramfs_cpio_gz" "$((size_ramfs_cpio_gz + size_padding3))"
rqd cat "$packing/$ramfs_cpio_gz" "$part3" > "$packing/$ramfs_gz_part3"
recordPackingFileSize ramfs_cpio_gz ramfs_gz_part3
else
echo "initramfs is not compressed"
fi
fi # opt_4
echo "Assembling piggy"
if [ -n "$compressed" ]; then
rqd cat "$kernel_img" "$packing/$ramfs_gz_part3" > "$packing/$piggy"
compress_list=("$packing/$piggy") # compress it as a single file
else
#touch "$packing/$padding3"
#padTo "$packing/$padding3" "$size_padding3"
padTo "$packing/$ramfs_cpio" $((size_ramfs_cpio + size_padding3))
# compress parts seperately (yields better compression results):
cat "$kernel_img" "$packing/$ramfs_cpio" "$part3" > "$packing/$piggy"
recordPackingFileSize "piggy"
compress_list=("$packing/$piggy")
fi
fi # opt_3
echo "Creating piggy.gz"
target_size=$((size_piggy_gz + size_padding_piggy))
# At first, use gzip -9 for compressing since it delivers
# better results with zImages most of the time:
rqd gzip -n -9 -c "${compress_list[@]}" > "$packing/$piggy_gz"
size1=$(getFileSize "$packing/$piggy_gz")
if [ "$size1" -gt "$target_size" ]; then
# too large. Try if we can get better results with
# gzip -8. If not, barf and abort:
rqd gzip -8 -n -c "${compress_list[@]}" > "$packing/$piggy_gz"
size2=$(getFileSize "$packing/$piggy_gz")
if [ "$size2" -gt "$target_size" ]; then
fatal "\
piggy.gz too large (gzip -9: +$((size1-target_size)), gzip -8: +$((size2-target_size)))
You might want to try a different combination of the -g, -r and -s options."
fi
fi
padTo "$packing/$piggy_gz" "$((size_piggy_gz + size_padding_piggy))"
recordPackingFileSize "piggy_gz"
fi # opt_2
echo "Assembling $zImage"
rqd cat "$packing/$piggy_gz" "$piggy_trailer" > "$packing/$piggy_gz_piggy_trailer"
fi # opt_1
rqd cat "$decompression_code" "$packing/$piggy_gz_piggy_trailer" \
> "$packing/$zImage"
echo "Successfully created '$(relpath "$packing/$zImage")'"
recordPackingFileSize zImage
buildZImageTar "$packing/$zImage"
}
unpack()(
[ -d "$unpacked" ] && echo "\
Warning: there is aready an unpacking directory. If you have files added on
your own there, the repacking result may not reflect the result of the
current unpacking process."
rqd mkdir -p "$unpacked"
rqd cd "$unpacked"
sizes="$unpacked/sizes"
echo "# Unpacking sizes" > "$sizes"
piggy_start=$(findByteSequence "$cur_dir/$zImage")
if [ -z "$piggy_start" ]; then
fatal "Can't find a gzip header in file '$zImage'"
fi
rqd dd 2>&9 if="$cur_dir/$zImage" bs="$piggy_start" count=1 of="$decompression_code"
rqd dd 2>&9 if="$cur_dir/$zImage" bs="$piggy_start" skip=1 of="$piggy_gz_piggy_trailer"
recordFileSize decompression_code piggy_gz_piggy_trailer
gunzipWithTrailer "$piggy_gz_piggy_trailer" \
"$piggy" "$padding_piggy" "$piggy_trailer"
recordFileSize "piggy" "piggy_gz" "padding_piggy" "piggy_trailer"
ramfs_gz_start=$( findByteSequence "$piggy" lzma)
if [ -n "$ramfs_gz_start" ]; then
echo "Found lzma compressed ramdisk."
compressed=lzma
else
ramfs_gz_start=$( findByteSequence "$piggy")
if [ -n "$ramfs_gz_start" ]; then
echo "Found gzip compressed ramdisk."
compressed=gz
fi
fi
if [ "$compressed" ]; then
rqd dd 2>&9 if="$piggy" of="$kernel_img" bs="$ramfs_gz_start" count=1
rqd dd 2>&9 if="$piggy" of="$ramfs_gz_part3" bs="$ramfs_gz_start" skip=1
if [ "$compressed" = "gz" ]; then
rqd gunzipWithTrailer "$ramfs_gz_part3" "$ramfs_cpio" "$padding3" "$part3"
else
rqd unlzmaWithTrailer "$ramfs_gz_part3" "$ramfs_cpio" "$padding3" "$part3"
fi
recordFileSize "kernel_img" "ramfs_cpio_gz" "padding3" "ramfs_gz_part3" "ramfs_cpio" "part3"
recordVars compressed
else
echo "Found uncompressed ramdisk."
compressed=""
initrd_start=$(findByteSequence "$piggy" "0707")
[ -z "$initrd_start" ] && fatal "Cannot find cpio header"
rqd dd 2>&9 if="$piggy" of="$kernel_img" bs="$initrd_start" count=1
rqd dd 2>&9 if="$piggy" of="$ramfs_part3" bs="$initrd_start" skip=1
initrd_end=$(findByteSequence "$ramfs_part3" "TRAILER!!!")
[ -z "$initrd_end" ] && fatal "Cannot find cpio trailer"
initrd_end=$((initrd_end + 10)) # skip trailer length
initrd_end=$(( (initrd_end | 0x1ff) + 1)) # round up to block size (512)
rqd dd 2>&9 if="$ramfs_part3" of="$ramfs_cpio" bs="$initrd_end" count=1
real_next_start=$initrd_end
echo -n "Detecting padding (may take some time): "
while checkNUL "$ramfs_part3" $real_next_start; do
: $((real_next_start++))
done
padding3_len=$((real_next_start - initrd_end))
echo $padding3_len
rqd dd 2>&9 if="$ramfs_part3" of="$padding3" skip="$initrd_end" count="$padding3_len" bs=1
rqd dd 2>&9 if="$ramfs_part3" of="$part3" bs="$real_next_start" skip=1
recordFileSize "kernel_img" "padding3" "ramfs_part3" "ramfs_cpio" "part3"
recordVars compressed
fi
echo "Unpacking initramfs"
rqd cpio -t < "$ramfs_cpio" > "$cpio_t"
rqd mkdir -p "$ramfs_dir"
(
rqd cd "$ramfs_dir"
rqd cpio -i -m --no-absolute-filenames -d -u < "../$ramfs_cpio"
)
echo
echo "Success."
echo "The unpacked files and the initramfs directory are in '$(relpath "$unpacked")'."
)
#### start of main program
while getopts xv12345sgrpuhtz-: argv; do
case $argv in
p|u|z|1|2|3|4|5|t|r|g) eval opt_$argv=1;;
v) exec 9>&2; opt_v=1;;
s) cpio="cpio";;
x) set -x;;
-) if [ "$OPTARG" = "version" ]; then
echo "$pname $version"
exit 0
else
usage
fi;;
h|-) usage;;
*) fatal "Illegal option";;
esac
done
shift $((OPTIND-1))
zImage="${1:-zImage}"
unpacked="$cur_dir/${zImage}_unpacked"
packing="$cur_dir/${zImage}_packing"
shift
if [ -n "$*" ]; then
fatal "Excess arguments: '$*'"
fi
if [ -n "$opt_z" ]; then
buildZImageTar "$zImage"
fi
if [ -n "$opt_u" ]; then
[ -f "$zImage" ] || fatal "file '$zImage': not found"
unpack
fi
if [ -n "$opt_p" ]; then
pack
fi
#if [ -n "$opt_t" ]; then # for testing
# reorderInitramfsList "$packing/$ramfs_list" "$unpacked/$cpio_t"
#fi
if [ -z "$opt_p$opt_u$opt_z$opt_t" ]; then
echo >&2 "$pname: Need at least one of -u, -p, or -z."
echo >&2 "$pname: Type '$pname --help' for usage info."
exit 1
fi
exit
Solved. (by using bash instead of sh)..
Hi All,
I am trying to compile a driver as a loadable module but whenever I adb shell into my phone and do an insmod test.ko I get the error message insmod: failed to load /data/local/tmp/test.ko: Exec format error. Grep'ing dmesg I find the following log: test: no symbol version for module_layout`.
I've done quite a bit of googling and reading the linux kbuild documentation txt files to no avail, so if someone knows the answer it'd be fab
What I've done so far is this:
I have an Qualcomm Aurora checkout and in the kernel directory I type the following
Code:
cp arch/arm64/configs/gemini_user_defconfig .config [B]# Has CONFIG_MODVERSIONS enabled[/B]
yes "" | make oldconfig ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- V=1
make prepare ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- V=1
make scripts ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- V=1
make modules ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- V=1
I have my PATH set to point to /MyAOSBDir/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin so I pick up the correct toolchain.
At this point appears to be well. In my kernel directory I have Module.symvers, so I appear to be set.
Now to the directory I have set up outside of this build tree with a dummy test... The Makefile looks like this:
Code:
KERNEL_DIR:=/solomon-build/MiNote2AOSB/kernel/
obj-m += test.o
PWD := $(shell pwd)
.PHONY: all
all:
$(MAKE) M=$(PWD) ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- -C $(KERNEL_DIR) modules V=1
clean:
$(MAKE) M=$(PWD) -C $(KERNEL_DIR) clean
The driver is just a dummy:
Code:
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
#include <linux/init.h> /* Needed for the macros */
static int __init hello_start(void)
{
printk(KERN_INFO "Hello world\n");
return 0;
}
static void __exit hello_end(void)
{
printk(KERN_INFO "Goodbye world\n");
}
module_init(hello_start);
module_exit(hello_end);
I do make "make all" at the comment line and get this output:
Code:
make M=/solomon-build/build_mxt_kmod ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- -C /solomon-build/MiNote2AOSB/kernel/ modules V=1
make[1]: Entering directory `/solomon-build/MiNote2AOSB/kernel'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
mkdir -p /solomon-build/build_mxt_kmod/.tmp_versions ; rm -f /solomon-build/build_mxt_kmod/.tmp_versions/*
make -f ./scripts/Makefile.build obj=/solomon-build/build_mxt_kmod
./scripts/gcc-wrapper.py aarch64-linux-android-gcc -Wp,-MD,/solomon-build/build_mxt_kmod/.test.o.d -nostdinc -isystem /solomon-build/MiNote2AOSB/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/../lib/gcc/aarch64-linux-android/4.9.x-google/include -I./arch/arm64/include -Iarch/arm64/include/generated -Iinclude -I./arch/arm64/include/uapi -Iarch/arm64/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -mgeneral-regs-only -fno-pic -fno-delete-null-pointer-checks -Os -Wno-maybe-uninitialized --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(test)" -D"KBUILD_MODNAME=KBUILD_STR(test)" -c -o /solomon-build/build_mxt_kmod/.tmp_test.o /solomon-build/build_mxt_kmod/test.c
(cat /dev/null; echo kernel//solomon-build/build_mxt_kmod/test.ko;) > /solomon-build/build_mxt_kmod/modules.order
make -f ./scripts/Makefile.modpost
find /solomon-build/build_mxt_kmod/.tmp_versions -name '*.mod' | xargs -r grep -h '\.ko$' | sort -u | sed 's/\.ko$/.o/' | scripts/mod/modpost -m -i ./Module.symvers -I /solomon-build/build_mxt_kmod/Module.symvers -o /solomon-build/build_mxt_kmod/Module.symvers -S -E -w -s -T -
./scripts/gcc-wrapper.py aarch64-linux-android-gcc -Wp,-MD,/solomon-build/build_mxt_kmod/.test.mod.o.d -nostdinc -isystem /solomon-build/MiNote2AOSB/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/../lib/gcc/aarch64-linux-android/4.9.x-google/include -I./arch/arm64/include -Iarch/arm64/include/generated -Iinclude -I./arch/arm64/include/uapi -Iarch/arm64/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -mgeneral-regs-only -fno-pic -fno-delete-null-pointer-checks -Os -Wno-maybe-uninitialized --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(test.mod)" -D"KBUILD_MODNAME=KBUILD_STR(test)" -DMODULE -c -o /solomon-build/build_mxt_kmod/test.mod.o /solomon-build/build_mxt_kmod/test.mod.c
aarch64-linux-android-ld -EL -r -T ./scripts/module-common.lds --build-id --fix-cortex-a53-843419 -o /solomon-build/build_mxt_kmod/test.ko /solomon-build/build_mxt_kmod/test.o /solomon-build/build_mxt_kmod/test.mod.o
make[1]: Leaving directory `/solomon-build/MiNote2AOSB/kernel'
So, there are no messages saying there is a missing Module.symvers, so that's good, and I do get a built .ko file.
What I don't understand is the message "ERROR: Kernel configuration is invalid". The files it is talking about exist, so I know they have been created in my kernel build.
Anyway, trying to insmod this onto the phone gives the message I mentioned previously. If I cat Module.symvers I see:
Code:
0xff924338 backlight_force_update drivers/video/backlight/backlight EXPORT_SYMBOL
0x30254daf test_iosched_register block/test-iosched EXPORT_SYMBOL
<snip>
0xdd502540 backlight_device_unregister drivers/video/backlight/backlight EXPORT_SYMBOL
0x9939eba0 backlight_unregister_notifier drivers/video/backlight/backlight EXPORT_SYMBOL
So no symbol module_layout in the file, and thus no CRC, which is what I presume is creating the error message?
Any clues would be much appreciated, thank you.
Oh I should also mention that the module and kernel vermagic match:
Code:
# modinfo /data/local/tmp/test.ko
filename: /data/local/tmp/test.ko
depends:
vermagic: 3.18.20-mytestkernel-perf-g671c431-dirty SMP preempt mod_unload modversions aarch64
# uname -a
Linux localhost 3.18.20-mytestkernel-perf-g671c431-dirty #1 SMP PREEMPT Mon Jun 5 15:46:13 BST 2017 aarch64
I'm trying to build Lineage 14.1 for serranoltexx (for 6 days now).
When I started the compilation using "breakfast serranoltexx" an error appears after the 7 percent mark (~2minutes).
I followed this guide: wiki.lineageos. org/devices/serranoltexx/build
with a fresh Ubuntu 17.04 VM Box installation two times but that error always appears.
The only thing I still could mention is that pulled the proprietary blobs using my phone as stated in the instructions not with the stock Rom but Lineage 14.1 already installed.
Full console output:
(error at line #321) pastebin. com/vC06fV36
Error:
Code:
Code:
make: Leaving directory '/home/mrglue/android/lineage/kernel/samsung/msm8930-common'
[ 7% 2535/34256] Building Kernel
FAILED: /bin/bash -c "(
make
-j4
CFLAGS_MODULE=\"-fno-pic\"
-C kernel/samsung/msm8930-common
O=/home/mrglue/android/lineage/out/target/product/serranoltexx/obj/KERNEL_OBJ
ARCH=arm
CROSS_COMPILE=\"/home/mrglue/android/lineage/prebuilts/misc/linux-x86/ccache/ccache arm-linux-androidkernel-\"
zImage
) && (
if grep -q 'CONFIG_OF=y' /home/mrglue/android/lineage/out/target/product/serranoltexx/obj/KERNEL_OBJ/.config ; then
echo \"Building DTBs\" ;
make
-j4
CFLAGS_MODULE=\"-fno-pic\"
-C kernel/samsung/msm8930-common
O=/home/mrglue/android/lineage/out/target/product/serranoltexx/obj/KERNEL_OBJ
ARCH=arm CROSS_COMPILE=\"/home/mrglue/android/lineage/prebuilts/misc/linux-x86/ccache/ccache arm-linux-androidkernel-\" dtbs ;
else
echo \"DTBs not enabled\" ;
fi
) && (
if grep -q 'CONFIG_MODULES=y'/home/mrglue/android/lineage/out/target/product/serranoltexx/obj/KERNEL_OBJ/.config ; then
echo \"Building Kernel Modules\" ;
make
-j4
CFLAGS_MODULE=\"-fno-pic\"
-C kernel/samsung/msm8930-common
O=/home/mrglue/android/lineage/out/target/product/serranoltexx/obj/KERNEL_OBJ
ARCH=arm
CROSS_COMPILE=\"/home/mrglue/android/lineage/prebuilts/misc/linux-x86/ccache/ccache arm-linux-androidkernel-\" modules &&
make
-j4
CFLAGS_MODULE=\"-fno-pic\
-C kernel/samsung/msm8930-common
O=/home/mrglue/android/lineage/out/target/product/serranoltexx/obj/KERNEL_OBJ
INSTALL_MOD_PATH=../../system
ARCH=arm CROSS_COMPILE=\"/home/mrglue/android/lineage/prebuilts/misc/linux-x86/ccache/ccache arm-linux-androidkernel-\"
modules_install &&
mdpath=\`find /home/mrglue/android/lineage/out/target/product/serranoltexx/system/lib/modules
-type f
-name modules.order\`;
if [ \"\$mdpath\" != \"\" ];then
mpath=\`dirname \$mdpath\`;
ko=\`find \$mpath/kernel -type f -name *.ko\`;
for i in \$ko; do
arm-linux-androidkernel-strip --strip-unneeded \$i;
mv \$i /home/mrglue/android/lineage/out/target/product/serranoltexx/system/lib/modules/;
done;
fi &&
mdpath=\`find /home/mrglue/android/lineage/out/target/product/serranoltexx/system/lib/modules -type f -name modules.order\`;
if [ \"\$mdpath\" != \"\" ];then
mpath=\`dirname \$mdpath\`;
rm -rf \$mpath;
fi ;
else
echo \"Kernel Modules not enabled\" ;
fi )"
Edit1
I've also modified the .config following this guide
https:// null-byte.wonderhowto. com/how-to/android-cyanogenmod-kernel-building-monitor-mode-any-android-device-with-wireless-adapter-0162943/#Configuring-the-Kernel-&-Adding-Features
When I try to compile without this modification the error does not appear
Solved
Fixed.
Just modified the config with "make_defconfig.sh" in "kernel/VENDOR/KERNEL_NAME" instead of manually with make as stated in the guide!
I am running Ubuntu 16.10 under VirtualBox in a Windows 64-bit machine and trying to build the Sony's open source copyleft kernel for 34.3.A.0.217, which can be downloaded here: https://developer.sonymobile.com/do...rchives/open-source-archive-for-34-3-a-0-217/
-Untouched copyleft source code
-Untouched ramdisk extracted from stock kernel.elf file with this tool: https://forum.xda-developers.com/xp...oot-automatic-repack-stock-kernel-dm-t3301605
-Using AOSP mkbootimg (the new one written in Python: https://android.googlesource.com/platform/system/core/+/nougat-release/mkbootimg/mkbootimg) with arguments specified in README_Xperia (https://github.com/bamsbamx/BMSBMX_kernel_kugo/blob/master/README_Xperia)
Even if the build is succesful and the boot.img file is generated properly, the device gets stuck in SONY logo when flashing it
Any ideas about how can I find the problem?
The following is the build script:
Code:
#!/bin/bash
RED=1
GREEN=2
BLUE=4
colorPrint() {
tput setaf $2
echo $1
tput sgr0
}
colorPrint "Initializing workspace..." $BLUE
#Device config
device=kugo
#Workspace directories
workdir="$(pwd)"
outputfolder=${workdir}/OUTPUT
outputdir=${outputfolder}/${device}
toolchains=${workdir}/toolchains
ramdisk=${workdir}/ramdisks/${device}/ramdisk
export ARCH=arm64
export CROSS_COMPILE=${toolchains}/aarch64-linux-android-4.9-kernel/bin/aarch64-linux-android-
export KBUILD_DIFFCONFIG=kugo_diffconfig
colorPrint "Cleaning previous builds..." $BLUE
rm -rf $outputdir
mkdir -p $outputdir
colorPrint "Configuring kernel..." $BLUE
make msm-perf_defconfig O=$outputdir
colorPrint "Building kernel..." $BLUE
time make -j8 O=$outputdir 2>&1
if [ ! -f $outputdir/arch/arm64/boot/Image.gz-dtb ]; then
colorPrint "ERROR: kernel image not found. Kernel build failed" $RED
exit 1
fi
if [ ! -e $outputdir/ramdisk.cpio.gz ]; then
colorPrint "ERROR: ramdisk image file not found. Compression failed" $RED
exit 1
fi
colorPrint "Packaging boot image file" $BLUE
${workdir}/utils/mkqcdtbootimg \
--kernel $outputdir/arch/arm64/boot/Image.gz-dtb \
--ramdisk $outputdir/ramdisk.cpio.gz \
--base 0x20000000 \
--ramdisk_offset 0x02000000 \
--pagesize 2048 \
--tags_offset 0x01E00000 \
--cmdline "androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 zram.backend=z3fold earlyprintk" \
--output $outputdir/boot.img
if [ ! -f $outputdir/boot.img ]; then
colorPrint "ERROR: boot image file not found. boot packaging failed" $RED
exit 1
fi
colorPrint "DONE" $GREEN
colorPrint "boot image file can be found at ${outputdir}/boot.img" $GREEN
Hey xda I've been stuck on this problem for a while researched everywhere with no luck.
I have the kernel and device tree for my oneplus 6. I'm trying to flash Lineage 17.1 on it. I run a normal lunch and make which goes fine but then I get this sepolicy error:
Code:
[ 32% 33487/102384] build out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows
FAILED: out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows
/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -c 30 -o out/target/product/oneplus/obj/ETC/sepolicy_never
allows_intermediates/sepolicy_neverallows.tmp out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/policy.conf ) && (out/host/linux-x8
6/bin/sepolicy-analyze out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp neverallow -w -f out/target/produ
ct/oneplus/obj/ETC/sepolicy_neverallows_intermediates/policy_2.conf || ( echo \"\" 1>&2; echo \"sepolicy-analyze failed. This is most likely
due to the use\" 1>&2; echo \"of an expanded attribute in a neverallow assertion. Please fix\" 1>&2; echo \"the policy.\" 1>&2;
exit 1 ) ) && (touch out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp ) && (mv out/target/product/one
plus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy
_neverallows )"
vendor/oneplus/sdm845-common/sepolicy/private/hal_fod_sdm845.te:2:ERROR 'attribute hal_lineage_fod_server is not declared' at token ';' on line 48698:
typeattribute hal_fod_sdm845 hal_lineage_fod_server;
#line 2
checkpolicy: error(s) encountered while parsing configuration
[ 32% 33490/102384] build out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
FAILED: out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -c 30 -o out/target/product/oneplus/obj/ETC/sepolicy.recov
ery_intermediates/sepolicy.tmp out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy.recovery.conf ) && (out/host/linux-x86/bin/s
epolicy-analyze out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy.tmp permissive > out/target/product/oneplus/obj/ETC/sepolic
y.recovery_intermediates/sepolicy.permissivedomains ) && (if [ \"eng\" = \"user\" -a -s out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermedia
tes/sepolicy.permissivedomains ]; then echo \"==========\" 1>&2; echo \"ERROR: permissive domains not allowed in user builds\" 1
>&2; echo \"List of invalid domains:\" 1>&2; cat out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
.permissivedomains 1>&2; exit 1; fi ) && (mv out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
.tmp out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy )"
vendor/oneplus/sdm845-common/sepolicy/private/hal_fod_sdm845.te:2:ERROR 'attribute hal_lineage_fod_server is not declared' at token ';' on line 51970:
typeattribute hal_fod_sdm845 hal_lineage_fod_server;
#line 2
checkpolicy: error(s) encountered while parsing configuration
22:18:03 ninja failed with: exit status 1
#### failed to build some targets (02:10:23 (hh:mm:ss)) ####
The error seems to indicate that I'm missing an attribute declaration hal_lineage_fod_server in one of my files. Is this correct? Here's my hal_fod_sdm845.te file :
Code:
type hal_fod_sdm845, coredomain, domain;
hal_server_domain(hal_fod_sdm845, hal_lineage_fod)
type hal_fod_sdm845_exec, system_file_type, exec_type, file_type;
init_daemon_domain(hal_fod_sdm845)
# Allow access to the HALs
hal_client_domain(hal_fod_sdm845, hal_fingerprint)
# Allow binder communication with hal_display_default
binder_call(hal_fod_sdm845, hal_display_default)
# Allow binder communication with hal_fingerprint
binder_call(hal_fod_sdm845, hal_fingerprint)
# Allow hal_fod_sdm845 to hal_display_hwservice
allow hal_fod_sdm845 hal_display_hwservice:hwservice_manager find;
# Allow hal_fod_sdm845 to hal_fingerprint_hwservice
allow hal_fod_sdm845 hal_fingerprint_hwservice:hwservice_manager find;
# Allow hal_fod_sdm845 to read and write to sysfs_fod
allow hal_fod_sdm845 sysfs_fod:file rw_file_perms;
How do I go about solving this error?
Thanks
ps im a complete virgin when it comes to HAL and sepolicy dev on android or linux in general.
n0velti said:
Hey xda I've been stuck on this problem for a while researched everywhere with no luck.
I have the kernel and device tree for my oneplus 6. I'm trying to flash Lineage 17.1 on it. I run a normal lunch and make which goes fine but then I get this sepolicy error:
Code:
[ 32% 33487/102384] build out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows
FAILED: out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows
/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -c 30 -o out/target/product/oneplus/obj/ETC/sepolicy_never
allows_intermediates/sepolicy_neverallows.tmp out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/policy.conf ) && (out/host/linux-x8
6/bin/sepolicy-analyze out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp neverallow -w -f out/target/produ
ct/oneplus/obj/ETC/sepolicy_neverallows_intermediates/policy_2.conf || ( echo \"\" 1>&2; echo \"sepolicy-analyze failed. This is most likely
due to the use\" 1>&2; echo \"of an expanded attribute in a neverallow assertion. Please fix\" 1>&2; echo \"the policy.\" 1>&2;
exit 1 ) ) && (touch out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp ) && (mv out/target/product/one
plus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy_neverallows.tmp out/target/product/oneplus/obj/ETC/sepolicy_neverallows_intermediates/sepolicy
_neverallows )"
vendor/oneplus/sdm845-common/sepolicy/private/hal_fod_sdm845.te:2:ERROR 'attribute hal_lineage_fod_server is not declared' at token ';' on line 48698:
typeattribute hal_fod_sdm845 hal_lineage_fod_server;
#line 2
checkpolicy: error(s) encountered while parsing configuration
[ 32% 33490/102384] build out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
FAILED: out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
/bin/bash -c "(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -c 30 -o out/target/product/oneplus/obj/ETC/sepolicy.recov
ery_intermediates/sepolicy.tmp out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy.recovery.conf ) && (out/host/linux-x86/bin/s
epolicy-analyze out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy.tmp permissive > out/target/product/oneplus/obj/ETC/sepolic
y.recovery_intermediates/sepolicy.permissivedomains ) && (if [ \"eng\" = \"user\" -a -s out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermedia
tes/sepolicy.permissivedomains ]; then echo \"==========\" 1>&2; echo \"ERROR: permissive domains not allowed in user builds\" 1
>&2; echo \"List of invalid domains:\" 1>&2; cat out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
.permissivedomains 1>&2; exit 1; fi ) && (mv out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy
.tmp out/target/product/oneplus/obj/ETC/sepolicy.recovery_intermediates/sepolicy )"
vendor/oneplus/sdm845-common/sepolicy/private/hal_fod_sdm845.te:2:ERROR 'attribute hal_lineage_fod_server is not declared' at token ';' on line 51970:
typeattribute hal_fod_sdm845 hal_lineage_fod_server;
#line 2
checkpolicy: error(s) encountered while parsing configuration
22:18:03 ninja failed with: exit status 1
#### failed to build some targets (02:10:23 (hh:mm:ss)) ####
The error seems to indicate that I'm missing an attribute declaration hal_lineage_fod_server in one of my files. Is this correct? Here's my hal_fod_sdm845.te file :
Code:
type hal_fod_sdm845, coredomain, domain;
hal_server_domain(hal_fod_sdm845, hal_lineage_fod)
type hal_fod_sdm845_exec, system_file_type, exec_type, file_type;
init_daemon_domain(hal_fod_sdm845)
# Allow access to the HALs
hal_client_domain(hal_fod_sdm845, hal_fingerprint)
# Allow binder communication with hal_display_default
binder_call(hal_fod_sdm845, hal_display_default)
# Allow binder communication with hal_fingerprint
binder_call(hal_fod_sdm845, hal_fingerprint)
# Allow hal_fod_sdm845 to hal_display_hwservice
allow hal_fod_sdm845 hal_display_hwservice:hwservice_manager find;
# Allow hal_fod_sdm845 to hal_fingerprint_hwservice
allow hal_fod_sdm845 hal_fingerprint_hwservice:hwservice_manager find;
# Allow hal_fod_sdm845 to read and write to sysfs_fod
allow hal_fod_sdm845 sysfs_fod:file rw_file_perms;
How do I go about solving this error?
Thanks
ps im a complete virgin when it comes to HAL and sepolicy dev on android or linux in general.
Click to expand...
Click to collapse
Sir please help if u fixed this error