Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration #3

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
9cde589
sepolicy: update some selinux related rules
liuyq Jun 14, 2016
cd77c68
init.te: allow create sdcard link in /mnt
liuyq Jun 15, 2016
6c1cf5e
init.hikey.rc: set right user and group for uim service
liuyq Jun 16, 2016
0c5a64e
Merge "init.hikey.rc: set right user and group for uim service"
Jun 20, 2016
7266c5f
HiKey: Add initial powerHAL
johnstultz-work Jun 9, 2016
daa32a7
init.hikey.rc: remove permission setting on /dev/cpuctl
liuyq Jul 6, 2016
9a67d91
hikey: Add wrapper script to build uefi
vishalbhoj Jun 9, 2016
14c7bc0
suppress netd sys_module denial
nickkral Apr 21, 2014
2df2ca7
flash-all.sh: Allow flashing uefi built from source
vishalbhoj Jul 12, 2016
74aa066
flash-all.sh: support for case that not run lunch
liuyq Jul 16, 2016
776e1e1
init.hikey.usb.rc: fix to bring down tethering interface
pundiramit Jun 7, 2016
f914ccd
Merge "init.hikey.rc: remove permission setting on /dev/cpuctl"
Jul 21, 2016
6c13121
Merge "suppress netd sys_module denial"
Jul 25, 2016
644d7ab
HiKey: Remove configfs SELinux definitions.
jlucangelio Jul 26, 2016
57c4c72
enable SELinux for hikey
liuyq Jul 7, 2016
1ccc21d
hikey: Fix serial console for kernel 4.1
Jul 28, 2016
064a170
hikey: wl18xx-fw: Update wifi firmware
johnstultz-work Jul 28, 2016
73e309e
Merge "hikey: wl18xx-fw: Update wifi firmware"
Jul 28, 2016
4c18461
Merge "init.hikey.usb.rc: fix to bring down tethering interface"
Jul 29, 2016
3965ada
hikey: Add PRODUCT_BRAND := Android to change build fingerprint
Aug 5, 2016
128d7e6
hikey: Use ro.serialno to set usb_gadget string
Jul 13, 2016
abe8022
hikey: flash-all.sh: Add command to set unique serial number on flash
johnstultz-work Aug 4, 2016
b5d7339
Add make clean option for bootloader build
johnstultz-work Aug 5, 2016
c53fc0c
hikey: bootloader: Update prebuilt fip.bin and l-loader.bin to curren…
johnstultz-work Aug 5, 2016
da09247
HACK: hikey: Add system_server sepolicy rules to allow /proc/tid/time…
johnstultz-work Aug 11, 2016
78f1f74
Merge branch 'master' of https://android-review.googlesource.com/devi…
Aug 15, 2016
a2633a6
Update Kernel image name
Aug 17, 2016
a16e377
Update fip.bin
Aug 17, 2016
2411d4d
Add SELinux support for tee-supplicant
Aug 19, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ BOARD_WPA_SUPPLICANT_DRIVER := NL80211
BOARD_HOSTAPD_DRIVER := NL80211
CONFIG_DRIVER_NL80211 := y

BOARD_KERNEL_CMDLINE := console=ttyFIQ0 androidboot.console=ttyFIQ0 androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime androidboot.selinux=permissive
ifeq ($(TARGET_KERNEL_USE_4_1), true)
BOARD_KERNEL_CMDLINE := console=ttyAMA3,115200 androidboot.console=ttyAMA3 androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime
else
BOARD_KERNEL_CMDLINE := console=ttyFIQ0 androidboot.console=ttyFIQ0 androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime
endif

TARGET_NO_BOOTLOADER := true
TARGET_NO_KERNEL := false
Expand All @@ -55,6 +59,11 @@ ENABLE_CPUSETS := true

BOARD_SEPOLICY_DIRS := device/linaro/hikey/sepolicy

BOARD_SEPOLICY_UNION += \
file_contexts \
sepolicy.te


ifeq ($(HOST_OS), linux)
ifeq ($(TARGET_SYSTEMIMAGES_USE_SQUASHFS), true)
BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := squashfs
Expand Down
10 changes: 5 additions & 5 deletions bootloader/EFI/BOOT/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@ set timeout=1
menuentry 'AOSP' {
search.fs_label boot root
set root=($root)
linux /Image console=ttyFIQ0 androidboot.console=ttyFIQ0 androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime androidboot.selinux=permissive
linux /Image console=ttyFIQ0 androidboot.console=ttyFIQ0 androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime
initrd /ramdisk.img
devicetree /hi6220-hikey.dtb
}
menuentry 'AOSP-DEBUG' {
search.fs_label boot root
set root=($root)
linux /Image earlycon=pl011,0xf7113000 no_console_suspend=1 console=ttyFIQ0 androidboot.console=ttyFIQ0 sysrq_always_enabled androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime androidboot.selinux=permissive
linux /Image earlycon=pl011,0xf7113000 no_console_suspend=1 console=ttyFIQ0 androidboot.console=ttyFIQ0 sysrq_always_enabled androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime
initrd /ramdisk.img
devicetree /hi6220-hikey.dtb
}
menuentry 'AOSP-CONSOLE' {
search.fs_label boot root
set root=($root)
linux /Image console=ttyAMA3,115200 androidboot.console=ttyAMA3 fiq_debugger.disable=Y androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime androidboot.selinux=permissive
linux /Image console=ttyAMA3,115200 androidboot.console=ttyAMA3 fiq_debugger.disable=Y androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime
initrd /ramdisk.img
devicetree /hi6220-hikey.dtb
}
menuentry 'AOSP@720P' {
search.fs_label boot root
set root=($root)
linux /Image console=ttyFIQ0 androidboot.console=ttyFIQ0 androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime video=HDMI-A-1:1280x720@60 androidboot.selinux=permissive
linux /Image console=ttyFIQ0 androidboot.console=ttyFIQ0 androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime video=HDMI-A-1:1280x720@60
initrd /ramdisk.img
devicetree /hi6220-hikey.dtb
}
menuentry 'AOSP@SVGA' {
search.fs_label boot root
set root=($root)
linux /Image console=ttyFIQ0 androidboot.console=ttyFIQ0 androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime video=HDMI-A-1:800x600@60 androidboot.selinux=permissive
linux /Image console=ttyFIQ0 androidboot.console=ttyFIQ0 androidboot.hardware=hikey firmware_class.path=/system/etc/firmware efi=noruntime video=HDMI-A-1:800x600@60
initrd /ramdisk.img
devicetree /hi6220-hikey.dtb
}
Expand Down
33 changes: 33 additions & 0 deletions bootloader/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
AARCH64_TOOLCHAIN=GCC49
EDK2_DIR=$(ANDROID_BUILD_TOP)/device/linaro/bootloader/edk2
UEFI_TOOLS_DIR=$(ANDROID_BUILD_TOP)/device/linaro/hikey/uefi-tools
ATF_DIR=$(ANDROID_BUILD_TOP)/device/linaro/bootloader/arm-trusted-firmware
PRODUCT_OUT?=out/target/product/hikey
DIST_DIR?=$(ANDROID_BUILD_TOP)/out/dist

all: $(DIST_DIR)/fip.bin $(DIST_DIR)/l-loader.bin

$(DIST_DIR)/fip.bin:
cd $(EDK2_DIR) && \
rm -rf Conf/tools_def.txt Conf/BuildEnv.sh Conf/build_rule.txt Conf/target.txt Conf/tools_def.txt && \
export CROSS_COMPILE_32=arm-linux-androideabi- && \
export CROSS_COMPILE_64=aarch64-linux-android- && \
rm -rf OpenPlatformPkg && \
ln -sf $(EDK2_DIR)/../OpenPlatformPkg OpenPlatformPkg && \
rm -rf $(EDK2_DIR)/Build/ && \
mkdir -p $(EDK2_DIR)/Build/ && \
mkdir -p $(DIST_DIR) && \
mkdir -p $(ANDROID_BUILD_TOP)/$(PRODUCT_OUT)/obj/uefi && \
ln -sf $(ANDROID_BUILD_TOP)/$(PRODUCT_OUT)/obj/uefi $(EDK2_DIR)/Build/HiKey && \
$(UEFI_TOOLS_DIR)/uefi-build.sh -b RELEASE -D EDK2_OUT_DIR=$(ANDROID_BUILD_TOP)/$(PRODUCT_OUT)/obj/uefi -a $(ATF_DIR) hikey && \
cp $(EDK2_DIR)/Build/HiKey/RELEASE_GCC49/FV/fip.bin $(DIST_DIR)/

$(DIST_DIR)/l-loader.bin: $(DIST_DIR)/fip.bin
cd $(ANDROID_BUILD_TOP)/device/linaro/hikey/l-loader && \
ln -sf $(EDK2_DIR)/Build/HiKey/RELEASE_GCC49/FV//bl1.bin && \
make CROSS_COMPILE=arm-linux-androideabi- l-loader.bin && \
mv l-loader.bin $(DIST_DIR)/

clean:
rm -rf $(DIST_DIR)/fip.bin $(DIST_DIR)/l-loader.bin

10 changes: 10 additions & 0 deletions bootloader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Bootloader is build with ArmTF and UEFI from sources located at:
device/linaro/bootloader
To build fip.bin and l-loader.bin do:
$ cd device/linaro/hikey/bootloader
$ make
Results will be in out/dist

We can also generate ptable (needs root privilege) with below commands:
$ cd device/linaro/hikey/l-loader/
$ make ptable.img
Binary file modified bt-wifi-firmware-util/wl18xx-fw-4.bin
Binary file not shown.
5 changes: 4 additions & 1 deletion device.mk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
$(call inherit-product-if-exists, frameworks/native/build/tablet-10in-xhdpi-2048-dalvik-heap.mk)

ifeq ($(TARGET_PREBUILT_KERNEL),)
LOCAL_KERNEL := $(ANDROID_PRODUCT_OUT)/kernel_obj/arch/arm64/boot/Image
LOCAL_KERNEL := $(ANDROID_PRODUCT_OUT)/kernel_obj/arch/arm64/boot/Image-dtb
LOCAL_DTB := $(ANDROID_PRODUCT_OUT)/kernel_obj/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dtb
LOCAL_FSTAB := fstab.hikey
else
Expand Down Expand Up @@ -99,6 +99,9 @@ PRODUCT_PACKAGES += TIInit_11.8.32.bts \
wl18xx-fw-4.bin \
wl18xx-conf.bin

# PowerHAL
PRODUCT_PACKAGES += power.hikey

# Copy hardware config file(s)
PRODUCT_COPY_FILES += \
device/linaro/hikey/etc/permissions/android.hardware.screen.xml:system/etc/permissions/android.hardware.screen.xml \
Expand Down
1 change: 1 addition & 0 deletions hikey.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
# Overrides
PRODUCT_NAME := hikey
PRODUCT_DEVICE := hikey
PRODUCT_BRAND := Android
11 changes: 5 additions & 6 deletions init.hikey.rc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on init
# (if randomization is enabled the AEM-JIT will have a lower cache hit rate)
write /proc/sys/kernel/randomize_va_space 0


on fs
mount_all /fstab.hikey
setprop ro.crypto.fuse_sdcard false
Expand Down Expand Up @@ -48,10 +49,6 @@ on post-fs
# Set supported opengles version
setprop ro.opengles.version 196608

# change permissions for process groups
# https://bugs.launchpad.net/bugs/1037611
chmod 0660 /dev/cpuctl

# update cpuset now that processors are up
# Foreground should contain all cores
write /dev/cpuset/foreground/cpus 0-7
Expand Down Expand Up @@ -87,12 +84,14 @@ on property:usb_speed.switch=full
#userspace daemon needed for bluetooth
service uim /system/bin/uim
class main
user root
user bluetooth
group bluetooth net_bt_admin system net_bt_stack
oneshot

service tee-supplicant /system/bin/tee-supplicant
service tee_supplicant /system/bin/tee-supplicant
class main
user root
group shell
oneshot

service wpa_supplicant /system/bin/wpa_supplicant \
Expand Down
4 changes: 1 addition & 3 deletions init.hikey.usb.rc
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ on boot
write /config/usb_gadget/g1/bcdDevice 0x0223
write /config/usb_gadget/g1/bcdUSB 0x0200
mkdir /config/usb_gadget/g1/strings/0x409 0770
write /config/usb_gadget/g1/strings/0x409/serialnumber "0123456789"
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
write /config/usb_gadget/g1/strings/0x409/manufacturer "HISILICON"
write /config/usb_gadget/g1/strings/0x409/product "ADB Gadget"
mkdir /config/usb_gadget/g1/functions/accessory.gs2
mkdir /config/usb_gadget/g1/functions/audio_source.gs3
mkdir /config/usb_gadget/g1/functions/ffs.adb
mkdir /config/usb_gadget/g1/functions/mtp.gs0
mkdir /config/usb_gadget/g1/functions/ptp.gs1
mkdir /config/usb_gadget/g1/functions/rndis.gs4
write /config/usb_gadget/g1/functions/rndis.gs4/wceis 1
mkdir /config/usb_gadget/g1/functions/midi.gs5
mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell
mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
Expand Down
Binary file added installer/fip.bin
Binary file not shown.
64 changes: 41 additions & 23 deletions installer/flash-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,69 @@ if [ $# -eq 0 ]
exit
fi

if [ ! -e $1 ]
if [ ! -e "${1}" ]
then
echo "device: $1 does not exist"
echo "device: ${1} does not exist"
exit
fi
DEVICE_PORT=${1}
DEVICE_PORT="${1}"
PTABLE=ptable-aosp-8g.img
if [ $# -gt 1 ]
then
if [ $2 == '4g' ]
if [ "${2}" == '4g' ]
then
PTABLE=ptable-aosp-4g.img
fi
fi

INSTALLER_DIR="`dirname $0`"
ANDROID_TOP=${INSTALLER_DIR}/../../../../
INSTALLER_DIR="`dirname ${0}`"
FIRMWARE_DIR="${INSTALLER_DIR}"

# for cases that not run "lunch hikey-userdebu"
if [ -z "${ANDROID_BUILD_TOP}" ]; then
ANDROID_BUILD_TOP=${INSTALLER_DIR}/../../../../
ANDROID_PRODUCT_OUT="${ANDROID_BUILD_TOP}/out/target/product/hikey"
fi

if [ -z "${DIST_DIR}" ]; then
DIST_DIR="${ANDROID_BUILD_TOP}"/out/dist
fi

#get out directory path
while [ $# -ne 0 ]; do
case "$1" in
--out) OUT_IMGDIR=$2;shift;
case "${1}" in
--out) OUT_IMGDIR=${2};shift;;
--use-compiled-binaries) FIRMWARE_DIR="${DIST_DIR}";shift;;
esac
shift
done

if [ -z $OUT_IMGDIR ]; then
if [ ! -z $ANDROID_PRODUCT_OUT ]; then
OUT_IMGDIR=${ANDROID_PRODUCT_OUT}
else
OUT_IMGDIR="${ANDROID_TOP}/out/target/product/hikey"
if [[ "${FIRMWARE_DIR}" == "${DIST_DIR}" && ! -e "${DIST_DIR}"/fip.bin && ! -e "${DIST_DIR}"/l-loader.bin ]]; then
echo "No binaries found at ${DIST_DIR}. Please build the bootloader first"
exit
fi

if [ -z "${OUT_IMGDIR}" ]; then
if [ ! -z "${ANDROID_PRODUCT_OUT}" ]; then
OUT_IMGDIR="${ANDROID_PRODUCT_OUT}"
fi
fi

if [ ! -d $OUT_IMGDIR ]; then
if [ ! -d "${OUT_IMGDIR}" ]; then
echo "error in locating out directory, check if it exist"
exit
fi
echo "android out dir:$OUT_IMGDIR"

sudo python ${INSTALLER_DIR}/hisi-idt.py --img1=${INSTALLER_DIR}/l-loader.bin -d ${DEVICE_PORT}
fastboot flash ptable ${INSTALLER_DIR}/${PTABLE}
fastboot flash fastboot ${INSTALLER_DIR}/fip.bin
fastboot flash nvme ${INSTALLER_DIR}/nvme.img
fastboot flash boot ${OUT_IMGDIR}/boot_fat.uefi.img
fastboot flash system ${OUT_IMGDIR}/system.img
fastboot flash cache ${OUT_IMGDIR}/cache.img
fastboot flash userdata ${OUT_IMGDIR}/userdata.img

echo "android out dir:${OUT_IMGDIR}"

sudo python "${INSTALLER_DIR}"/hisi-idt.py --img1="${FIRMWARE_DIR}"/l-loader.bin -d "${DEVICE_PORT}"
# set a unique serial number
fastboot oem serialno
fastboot flash ptable "${INSTALLER_DIR}"/"${PTABLE}"
fastboot flash fastboot "${FIRMWARE_DIR}"/fip.bin
fastboot flash nvme "${INSTALLER_DIR}"/nvme.img
fastboot flash boot "${OUT_IMGDIR}"/boot.img
fastboot flash system "${OUT_IMGDIR}"/system.img
fastboot flash cache "${OUT_IMGDIR}"/cache.img
fastboot flash userdata "${OUT_IMGDIR}"/userdata.img
Binary file modified installer/l-loader.bin
Binary file not shown.
3 changes: 3 additions & 0 deletions l-loader/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/*.o
/*.img
/*.bin
25 changes: 25 additions & 0 deletions l-loader/COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright (c) 2014-2016, Linaro Ltd. 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.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER 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.
27 changes: 27 additions & 0 deletions l-loader/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
CROSS_COMPILE?=arm-linux-gnueabihf-
CC=$(CROSS_COMPILE)gcc
CFLAGS=-march=armv7-a
LD=$(CROSS_COMPILE)ld
OBJCOPY=$(CROSS_COMPILE)objcopy
BL1=bl1.bin
PTABLE_LST:=aosp-4g aosp-8g linux-4g linux-8g

all: l-loader.bin ptable.img

%.o: %.S $(DEPS)
$(CC) $(CFLAGS) -c -o $@ $<

l-loader.bin: start.o $(BL1)
$(LD) -Bstatic -Tl-loader.lds -Ttext 0xf9800800 start.o -o loader
$(OBJCOPY) -O binary loader temp
python gen_loader.py -o $@ --img_loader=temp --img_bl1=$(BL1)
rm -f loader temp

ptable.img:
for ptable in $(PTABLE_LST); do \
sudo PTABLE=$${ptable} bash -x generate_ptable.sh;\
python gen_loader.py -o ptable-$${ptable}.img --img_prm_ptable=prm_ptable.img;\
done

clean:
rm -f *.o *.img l-loader.bin
6 changes: 6 additions & 0 deletions l-loader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# l-loader

Used to switch from aarch32 to aarch64 and boot. First image to be flashed
when in recovery mode.

HiKey specific.
Loading