Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

[DO NOT MERGE] Tune the code of checking kernelflinger upgrade. #38

Open
wants to merge 1,084 commits into
base: master
Choose a base branch
from

Conversation

phireg
Copy link
Contributor

@phireg phireg commented Mar 12, 2019

This code will be merge with an other PR, so not need to merge it.

Move the code to libkernelflinger, so other program can call this
function.
Also change the logical of checking upgrade file.
Also add the function StrcaseCmp.

Change-Id: I7311ab9a2a8a97e6ada2fcac6b0c64a8418b04aa
Tracked-On: OAM-76158
Signed-off-by: Ming Tan ming.tan@intel.com

ustcxd and others added 30 commits December 22, 2017 06:42
According to basic requirements on jira, need to remove two
duplicate parameters 'androidboot.bootloader=' and 'androidboot.
serialno=' by reading from /proc/cmdline.

Change-Id: I632fcb14ed78cf305999177d7bac7256a39e29b7
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-53759
Signed-off-by: dengx2x <xiangx.deng@intel.com>
Reviewed-on: https://android.intel.com:443/611587
Change-Id: I41b4a921c073c22313f4e6d49b517e9fddea56fe
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-54165
Signed-off-by: biyilix <biyix.li@intel.com>
Reviewed-on: https://android.intel.com:443/612358
Change-Id: I9677e807940420e04a7468b7e76b60344ee560c3
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-54048
Signed-off-by: dengx2x <xiangx.deng@intel.com>
Reviewed-on: https://android.intel.com:443/612208
Change-Id: Iff7ee04d34b0766546780e5b6fe073f5e675b3c0
Signed-off-by: Qi, Yadong <yadong.qi@intel.com>
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-54470
Reviewed-on: https://android.intel.com:443/612119
if USE_TRUSTY not defined, unused variables will cause
kernelflinger compile error

Change-Id: Ica343189b36c3588c2f0f22f97e0ab4771a640a0
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-54530
Signed-off-by: zhouji3x <jianfengx.zhou@intel.com>
Reviewed-on: https://android.intel.com:443/613207
Early version of slimboot did not pass parameters necessary for boot
Linux kernel, as workaround, osloader added necessary parameters by hard
code.
this patch delete the hard code boot parameters

Change-Id: I42eab3f2e257b80c1596f2d1450a97899c931d4d
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-54491
Signed-off-by: Zhou, JianFengX <jianfengx.zhou@intel.com>
Reviewed-on: https://android.intel.com:443/613070
print less logs to console save coldboot time.

Change-Id: I258a9eb946a8fdbd11e37d22fd734891cf9a2da2
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-54577
Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>
Reviewed-on: https://android.intel.com:443/613423
Change-Id: I1febb897af50e67c5dc97251330f87a8c6f3eead
Signed-off-by: duminx <minx.du@intel.com>
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-54464
Reviewed-on: https://android.intel.com:443/613030
Change-Id: Ic0cd16e6820212e44a06b25c554fe4fbf4661f8c
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-54464
Signed-off-by: Zhang, Qi <qi1.zhang@intel.com>
Reviewed-on: https://android.intel.com:443/612951
Change-Id: Ia01aa005a4f8bec4b319badb3127a3a89849c411
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-54594
Signed-off-by: biyilix <biyix.li@intel.com>
Reviewed-on: https://android.intel.com:443/601979
Refine the name of macro which distinguish OS loader build
for EFI BIOS and SBL/ABL.

Change-Id: Iea307aa7987ed26f267152092e5a1c8aacb91063
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-54579
Signed-off-by: Chen, ZhiminX <zhiminx.chen@intel.com>
Reviewed-on: https://android.intel.com:443/613872
In real rpmb case, should clear simulation rpmb key also
from the teedata partition.

Change-Id: Icd078f0ed85533fea4e24df03379b25bf911e773
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-55925
Signed-off-by: dengx2x <xiangx.deng@intel.com>
Reviewed-on: https://android.intel.com:443/615843
Change-Id: I13d227adf37651d664e85e425cc665c750beca22
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-56286
Signed-off-by: Yang, Kai <kaix.yang@intel.com>
Reviewed-on: https://android.intel.com:443/616471
  KW issue is that pointer 'slot_data' checked for NULL
at line 1957 may be dereferenced at line 1966.
  This patch try to add check for pointer 'slot_data'
to avoid that 'slot_data' is dereferenced in below line
when it was check for NULL.

Change-Id: Ie21c835810867bc773ef3ac4c5daedba4e9576f8
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-56258
Signed-off-by: yayongdx <yayongx.duan@intel.com>
Reviewed-on: https://android.intel.com:443/616239
Change-Id: If12bceeeb2ecfc2122eb4f07fda16d01a6ec3178
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-56339
Signed-off-by: Ming Tan <ming.tan@intel.com>
Reviewed-on: https://android.intel.com:443/616666
The changes detail boot stages of OSloader.
eg. in cmdline:
androidboot.boottime=FWS:555,CBS:40,VBS:172,VTS:363,SKS:5

FWS: firmware stage boot time;
CBS: check bcb stage boot time;
VBS: android verify boot image stage;
VTS: android verify trusty and launch trusty os stage;
SKS: jump to start kernel stage

Change-Id: I8b60e0862384711c56ae262b990eda4fe5764999
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-56119
Signed-off-by: Yang, Kai <kaix.yang@intel.com>
Reviewed-on: https://android.intel.com:443/614698
Support build 64 bit OS loader in ABL/SBL platform

Change-Id: I7c20c5ee0cecc7a31783f079c330139c29ad7434
Tracked-On:https://jira01.devtools.intel.com/browse/OAM-56835
Signed-off-by: zhouji3x <jianfengx.zhou@intel.com>
Reviewed-on: https://android.intel.com:443/615473
Change-Id: I7a656e789fce50465f3c59bc78f684482016320a
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-56161
Signed-off-by: jiangyao <yaox.jiang@intel.com>
Reviewed-on: https://android.intel.com:443/615456
when trusty is not enabled, do not build libtipc

Change-Id: Iaed31472fc613970ce4a6330fd30d126cb84462a
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-56815
Signed-off-by: zhouji3x <jianfengx.zhou@intel.com>
Reviewed-on: https://android.intel.com:443/617175
Since clear-rpmb operation was only based on secureboot status before,
now it should be based on secureboot & eom(end of manufacturing) status,
also support to erase teedata partition when using simulation rpmb.

Change-Id: I8b733eb49b9220bc032b074af59894ff1d0d690d
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-56797
Signed-off-by: dengx2x <xiangx.deng@intel.com>
Reviewed-on: https://android.intel.com:443/617056
Set KERNELFLINGER_AVB_CMDLINE := true to let kernelflinger
process the command line option of vbmeta in UEFI based platform.
Before enable this feature, please make sure the android kernel
already support the AVB dm-verity, otherwise maybe cause kernel
report error.

Change-Id: I2038416613880b6bfb2d99c6e629d2c70b8d59ca
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-54527
Signed-off-by: Ming Tan <ming.tan@intel.com>
Reviewed-on: https://android.intel.com:443/613240
Change-Id: If50342ffe5128cf774467bdb19df8b8bc1a413d7
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-56891
Signed-off-by: Yang, Kai <kaix.yang@intel.com>
Reviewed-on: https://android.intel.com:443/617805
Change-Id: I2806f8e3d8d45170babe513f831566539a9c2593
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-56888
Signed-off-by: dengx2x <xiangx.deng@intel.com>
Reviewed-on: https://android.intel.com:443/617742
Change-Id: I82e333e007a8746e2e2a44df0328773f2800c69f
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-54855
Signed-off-by: jwu55 <ji.j.wu@intel.com>
Reviewed-on: https://android.intel.com:443/614749
We use the edk2 library for creating and managing the TPM
entities in kernelflinger. The necessary TPM functions are
ported to kernelflinger/libedk2_tpm. The Tcg2 protocol headers
are ported to libedk2_tpm/include.

Github link : https://github.com/tianocore/edk2

Change-Id: I8ce9545e35cff9bc5a0d8b63ee49ea4aeb1b35cd
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-52486
Signed-off-by: adattatr <anisha.dattatraya.kulkarni@intel.com>
Reviewed-on: https://android.intel.com:443/607205
If EFI_TCG2_PROTOCOL is supported by BIOS and if the device
has Intel PTT (or fTPM), the SEED for Trusty is created by and
stored in fTPM. With this change:

- tpm2_security adds functions to write, read and create nv indexes.
  and generate seed for trusty.
- fastboot oem fuse commands - at-perms-attr and vbmeta-verify-hash
  are added.
- USE_TPM flag is added to enable the fuse commands
- SOFT_FUSE flag is used in development phase so we can delete the
  NVRAM indexes.

Change-Id: Ia9b714b084dc84a27c2860cb9e6f2e67c78bf0b4
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-52486
Signed-off-by: adattatr <anisha.dattatraya.kulkarni@intel.com>
Reviewed-on: https://android.intel.com:443/607206
NVRAM indexes can be of type ORDINARY, COUNTER, or
BITFIELD. The bootloader policy fuse is a bitfield
nvindex with Bits signifying if provisioning is
complete, if the device can be unlocked.

Additionally with this change:
- Add comments for the helper functions in Tpm2Help.c.
- Add Tpm2NvSetBits and associated helper functions
  to manipulate the NVRAM bitfields.

Tracked-On: https://jira01.devtools.intel.com/browse/OAM-52486
Change-Id: I41b3c4256c3517e9e77a5d3cd42df6402047bf7c
Signed-off-by: adattatr <anisha.dattatraya.kulkarni@intel.com>
Reviewed-on: https://android.intel.com:443/607207
Under 64 bit mode, linux kernel entry is 512 bytes after the start

Change-Id: I5d8f188d7ead071af62528ec68cee5d9cb1aa7d0
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-57095
Signed-off-by: zhouji3x <jianfengx.zhou@intel.com>
Reviewed-on: https://android.intel.com:443/618200
If trigger warning_disallowed, avb & slot-ab enable,will find some errors
during osloader's 64bit complie progress.

error:
hardware/intel/kernelflinger/avb/libavb/uefi_avb_ops.c:85:17: error: comparison
between signed and unsigned integer expressions [-Werror=sign-compare]
 if (num_bytes > (partition_size - offset_from_partition))
 ^
 cc1: all warnings being treated as errors

Change-Id: I58511eaeb9c33053c50a44caec676fc9345938d4
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-57217
Signed-off-by: dengx2x <xiangx.deng@intel.com>
Reviewed-on: https://android.intel.com:443/618741
Change-Id: I72d5608522ce7747506ad6a3bd2e97eb6b2687d1
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-57014
Signed-off-by: Yang, Kai <kaix.yang@intel.com>
Reviewed-on: https://android.intel.com:443/617401
kmengX and others added 27 commits January 17, 2019 04:16
warning(message) will add '\n' at the end of message, and
warning_n(message) will not, it need warning_n(L"\n") explicitly
to terminate message.
They will output in both of serial port and UI with yellow color.

Change-Id: I6f3ed69ccf6d9c2926d69dfb6647bba4d6152a20
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-73971
Signed-off-by: Meng, KangX <kangx.meng@intel.com>
Signed-off-by: Meng Xianglin <xianglinx.meng@intel.com>
Reviewed-on: https://android.intel.com:443/656861
Add info() and info_n() function which will output in both of serial
port and UI with green color. info(message) will add "\n" at the
end of message.

Change-Id: Iac013806553d3d7720d07e778df02bc49a9b66ad
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75049
Signed-off-by: Meng Xianglin <xianglinx.meng@intel.com>
Reviewed-on: https://android.intel.com:443/657584
erasing infomation should be output by erasing function
implemented for specific media

Change-Id: Ie316a142c231ce729ebc93688102645761cc5722
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-63521
Signed-off-by: Meng, KangX <kangx.meng@intel.com>
Signed-off-by: Meng Xianglin <xianglinx.meng@intel.com>
Reviewed-on: https://android.intel.com:443/656882
print infomation both to console and ui when flashing image,
include "Flashing xxx", "Flash done", and download progress.

function printProgress() use '\r' to print "xx% [=====]" at
the same line repeatedly, but not all terminal support '\r'
and ui ignores all control characters. Modify printProgress
to output in form of "0....10....20..."

Change-Id: I6899cc56202f1453a1ee5e9c1bf5d57d072db886
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75051
Signed-off-by: Meng Xianglin <xianglinx.meng@intel.com>
Reviewed-on: https://android.intel.com:443/657597
Coreboot pass boot tsc instead of boot time to kernelflinger.

Change-Id: Ifc04872b1424d59234c25e6e458993d4fdd8f65c
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75343
Signed-off-by: Yang, Kai <kaix.yang@intel.com>
Reviewed-on: https://android.intel.com:443/658254
Change-Id: I846c6b0dd06df5d598fe0c1a6198b3e6d6c6b304
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75465
Signed-off-by: Ming Tan <ming.tan@intel.com>
Reviewed-on: https://android.intel.com:443/658636
Change-Id: Ib7efa97e5bd30a799a4b64b46f45fb3b64a57a9c
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75350
Signed-off-by: jwu55 <ji.j.wu@intel.com>
Signed-off-by: sunxunou <xunoux.sun@intel.com>
Signed-off-by: Chen, ZhiminX <zhiminx.chen@intel.com>
Reviewed-on: https://android.intel.com:443/658269
With vbmeta and slots, the boot target MEMORY lost its purposes.  The
default fastboot boot behavior tested on Google Android Devices show
that the kernel should be taken from the downloaded boot image but
that the rootfs parameters, slots information, shoud be retrieve from
the eMMC.

This patch redefines the MEMORY boot target.  MEMORY boot target means
to load and boot the image loaded in memory regardless of what is on
the persistent storage.

Change-Id: Ibeacb6fd28cabc8a7e986e9bd55ef03c52548775
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75350
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Signed-off-by: "Sun, XunouX" <xunoux.sun@intel.com>
Reviewed-on: https://android.intel.com:443/658270
When invoke ui_display_texts, the first parameter should be
a "Null terminated" ui_textline_t array, or an array boudary
overflow will cause BIOS crash.

Change-Id: I9b545959a5aa361abf7623321c1e41830d0dd4cb
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75378
Signed-off-by: Meng Xianglin <xianglinx.meng@intel.com>
Reviewed-on: https://android.intel.com:443/658811
In 'fastboot boot' case, load image without slot data will
lost vbmeta options which will be passed as kernel parameters,
and android can't boot to UI

Change-Id: I690df26f42cabaa4b5f79a0e64b7e65b54849f42
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75078
Signed-off-by: Meng Xianglin <xianglinx.meng@intel.com>
Reviewed-on: https://android.intel.com:443/658645
kf4abl.c:
error: use of undeclared identifier 'vbmeta_pub_key_len'

Change-Id: I7dc3d52ec9b9945f314e21b88699649cec163c3b
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75605
Signed-off-by: Chen, ZhiminX <zhiminx.chen@intel.com>
Reviewed-on: https://android.intel.com:443/659079
Change-Id: Ia0c25357944fd1050c4b5ad66996cd1eb27a0360
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75934
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://android.intel.com:443/655388
This patch adds the support of PNG RGBA non-interlaced loading to
Kernelflinger.  It considerably reduces the size of Kernelflinger of
54% which a very negligeable impact on the boot time.

Change-Id: Id512fd84b5de75ddc2e77e69a8dc98f379313ca5
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75934
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://android.intel.com:443/655814
This patch makes the ui_image_draw_scale() function skips the scaling
part on images which do not need to be scale before being drawn.

Change-Id: Id588d071ab2d0d0e3d2a19ecfa152d0cc1e4b6bc
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75934
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
Reviewed-on: https://android.intel.com:443/655815
Fix:
1) merge two string to one string. size of memory allocated for
the string is string lenth +1, merge another string to the string
will result in  memory corruption.
2) merge two string to a fix size buffer in stack. it may cause
stack overflow if length of the string larger than the buffer size
3) copy string from memory that has been freed. it may cause
unpredictable results.

Change-Id: Ie3ccba256baea965c1f6e2a5cf6bf321d97eb86a
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75623
Signed-off-by: JianFeng,Zhou <jianfeng.zhou@intel.com>
Reviewed-on: https://android.intel.com:443/659117
Print operation is a kind of time consuming operation, printing
progress of erasing or flashing increase time consumption significantly.
print event ocurring within a second should be cached in a buffer and
print it later.

Change-Id: I6752d5fa58bae8eb2389c4290ae53d5951bd5ab4
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75466
Signed-off-by: Meng Xianglin <xianglinx.meng@intel.com>
Reviewed-on: https://android.intel.com:443/659072
Change-Id: Ie18a7415fef5fe046c59b5628038c02e05176cf4
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75484
Signed-off-by: keyuliux <keyux.liu@intel.com>
https://android.intel.com:443/658805
Reviewed-on: https://android.intel.com:443/658805
Move the code from kernelflinger.c to uefi_util.c.
Then the other program can call the function to check BIOS upgrade.

Change-Id: I1a226e8aa61aa72eb1bf9552b3159484cb80a467
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75982
Signed-off-by: Ming Tan <ming.tan@intel.com>
Reviewed-on: https://android.intel.com:443/659431
Change-Id: I52f7393a863cf34257f5e2057272e6722f692258
Tracked-On: https://jira.devtools.intel.com/browse/OAM-76099
Signed-off-by: Meng Xianglin <xianglinx.meng@intel.com>
Reviewed-on: https://android.intel.com:443/659920
Do not expand tab now.

Change-Id: Ia14132f7f9416ab19b5a166b288f7b250235dc06
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75981
Signed-off-by: Ming Tan <ming.tan@intel.com>
Reviewed-on: https://android.intel.com:443/659430
Change-Id: Ifb6d42fb4b65d8109feb796c4d7772ced17eee92
Tracked-On: https://jira.devtools.intel.com/browse/OAM-76189
Signed-off-by: Xihua Chen <xihua.chen@intel.com>
Reviewed-on: https://android.intel.com:443/660192
Change-Id: I6cdc010e40ccac532093f405bc710d5f9fa4d3ef
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-76248
Signed-off-by: Zhang, Xuepeng <xuepeng.zhang@intel.com>
Reviewed-on: https://android.intel.com:443/661583
On x86, stack protector save canary value(4 bytes) to GS:0x14.
GS is set to the same selector as DS, base address of the
selector is 0,  limit is 4G.

android_clear_memory clear page 0, so stack canary need
be saved before clear and be restored after clear.

referrences
kernel/4.14/arch/x86/include/asm/stackprotector.h

Change-Id: I1804427d0701085bd5024c39e3ffaab8350124b7
Tracked-On: https://jira.devtools.intel.com/browse/OAM-75572
Signed-off-by: keyuliux <keyux.liu@intel.com>
Reviewed-on: https://android.intel.com/660286
Reviewed-on: https://android.intel.com:443/660286
we perform a "safe flash procedure" for esp partition:
1. write data to the BOOTLOADER_TMP_PART partition
2. perform sanity check on BOOTLOADER_TMP_PART partition files
3. swap BOOTLOADER_PART and BOOTLOADER_TMP_PART partition
4. erase BOOTLOADER_TMP_PART partition

5. install the load options into the Boot Manager

Change-Id: I402917c9802945e947f126fc7209106794be4371
Tracked-On: https://jira.devtools.intel.com/browse/OAM-73951
Signed-off-by: Heng Luo <heng.luo@intel.com>
Reviewed-on: https://android.intel.com:443/661700
For non UEFI platform, perform "default flash procedure".
For UEFI platform, perform a "safe flash procedure"
if bootloader2 partition exists;  otherwise, return EFI_UNSUPPORTED.

Change-Id: I731a2e63362386e5ae417ddb7a3fd483a4b65159
Tracked-On: https://jira.devtools.intel.com/browse/OAM-73952
Signed-off-by: Heng Luo <heng.luo@intel.com>
Reviewed-on: https://android.intel.com:443/661701
Change-Id: I407d0a9a7db199c2f8204a5dd7abacca1e0aafcd
Tracked-On: https://jira01.devtools.intel.com/browse/OAM-52565
Signed-off-by: JianFeng,Zhou <jianfeng.zhou@intel.com>
Reviewed-on: https://android.intel.com:443/657011
Access SATA by PassThru, if transfer length is larger than the ATA
controller can handle, EFI_BAD_BUFFER_SIZE is returned and The number
of bytes that could be transferred is returned in InTransferLength.
But it is not always true, espacially in AHCI mode, IntransferLength
is not updated.

Change-Id: I32b79685cad91bac265e5991caa623f14d98774a
Tracked-On: https://jira.devtools.intel.com/browse/OAM-76102
Signed-off-by: Meng Xianglin <xianglinx.meng@intel.com>
Reviewed-on: https://android.intel.com:443/661761
This code will be merge with an other PR, so not need to merge it.

Move the code to libkernelflinger, so other program can call this
function.
Also change the logical of checking upgrade file.
Also add the function StrcaseCmp.

Change-Id: I7311ab9a2a8a97e6ada2fcac6b0c64a8418b04aa
Tracked-On: OAM-76158
Signed-off-by: Ming Tan <ming.tan@intel.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet