In the avb_ops_user.c file, we use some
functions provided by tipc, so excute the
functions may depend on tipc. If the config
is not enable, it may compile fail.
Change-Id: I323f7e8d675407f2ec2f9f5358d1696b3b118880
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
The libavb_user provide some fuctions to get
a/b and avb information from misc or vbmeta
partitions, which can be use in libavb...
It also can use to enable or disable the verification
function by using avb_user_verity_set in the file
avb_user_verify.c.
Since we use fastboot to program our firmware,
some necessary function is provided to fastboot
to get useful information, like slot number, current
slot and so on.
Some functions in the avb_ops_user.c, like read_rollback_index,
depend on the OpteeClientTest.h.
Change-Id: I94f77db30d5c7896724b5da3d218041ebdc1f46a
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Add interface functions for external programs,
other functions can use it to read and write
rpmb partitions.
Change-Id: Ie94a6586077e1e9f4fc2924d283029f0a4a3e545
Signed-off-by: Hisping Lin <hisping.lin@rock-chips.com>
input mmc testrpmb to test store data to rpmb.
Change-Id: I0b8361bd7a22fc7854e1a94ae4ae81972e523b3b
Signed-off-by: Hisping Lin <hisping.lin@rock-chips.com>
tipc functions is used for uboot communicate
with TEE. uboot can request service for secure
store or secure algorithm.
Change-Id: Ie44095aff4c044feceb5f362abf6e3d24ceb8d4c
Signed-off-by: Hisping Lin <hisping.lin@rock-chips.com>
add support for uboot read Multi block data from
rpmb partition and write Multi block data to rpmb partition.
The previous patch can only read or write one block one time,
and it affect reading and writing efficiency.
Change-Id: I4b0b19a4a0d985e1d08930fdfbce13ffb847d2f8
Signed-off-by: Hisping Lin <hisping.lin@rock-chips.com>
Android Things requires specific public key
metadata and verification logic to correctly
verify vbmeta public keys.
This commit provide fuction avb_atx_validate_vbmeta_public_key
to verify the vbmeta.
Change-Id: I227e93b342671b4395cbaa7dea2121cbf0d7234b
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
This commit is based on google avb, and it
can be getted by https://android.googlesource.com/platform/external/avb.
This new rk_libavb_ab depend on rk_libavb.
This commit provide some useful functions.
The function of avb_ab_flow can be use to
chose a/b system and flow.The other functions
can be used to debug.
Change-Id: I768272286898b36e9a64749ff30bc6ff0cb019a1
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
The avb lib is provided by google, and it must be
used in the android things to boot and verify
android system. It can be getted in
https://android.googlesource.com/platform/external/avb.
Then we can use the functions suported by avb to program
the a/b and avb code.
Change-Id: I09371fe53cd50233a69533cfa09d5ebca5b10871
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
The static_assert() is support in C11, which may used in source code,
use _Static_assert for it.
Change-Id: Id029c4db3a899c9531c481e55541090e0b92e2b6
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Android kernel image format can include an initramfs image in the same
kernel partition. This patch passes the initramfs to the kernel, which
in the normal boot mode ignores it by passing "skip_initramfs" in the
command line.
Bug: 34346003
Test: `am broadcast -a android.intent.action.MASTER_CLEAR` factory
reseted the device.
Change-Id: I21d89e34a0f54badf3b2e3ad8981cef75f6d5edf
When concatenating the strings to form a new command line in the
android bootloader flow, the null-terminator was placed one byte after
the end of the allocated string.
Bug: None
Test: booted a rpi3.
Change-Id: I120e09a77bb1c27980e7ce2b5f9b8961424ed0c3
The android_bootloader_control struct defined in bootloader_message.h
stored the A/B metadata used to decide which slot should we use to boot
the device. This patch implements the bootloader side of the slot
selection in a new "android_ab_select" command which decides the
current slot and updates the metadata as needed.
Bug: 32707546
Test: Booted a rpi3, updated to the other slot.
Change-Id: I9344ff5b76194160d2b466a50e84f4f423b1a98a
part_get_info_by_name() was extended to support more than just mmc/efi
partitions. This patch remove this restriction from the
part_get_info_by_dev_and_name() function.
Bug: 32707546
Test: Booted rpi3.
Change-Id: If6399f7d24e99911b3b14a125a6bc1f472b7eecf
In order to support booting from either slot, this patch passes the
slot name from the command line.
Bug: 32707546
Test: Booted rpi3.
Change-Id: I30582bd8b1b95dc0f25b0c6624e7909ee4118bd0
The new "boot_android" command simply executes the Android Bootloader
flow. This receives the location (interface, dev, partition) of the
Android "misc" partition which is then used to lookup and infer the
kernel and system images that should be booted.
Bug: 32707546
Test: Booted a rpi3 build with Android Things.
Signed-off-by: Alex Deymo <deymo@google.com>
Change-Id: Ibf3f31e38b159d42db7a0835b99ad7ec260fc2a7
An Android Bootloader must comply with certain boot modes and change
the kernel command line accordingly. This patch introduces the Android
boot mode concept which determines whether the device should boot to
one of the following:
* recovery: which should boot to the recovery image,
* bootloader: which should boot to the "bootloader" (fastboot) and
* normal: which should boot to the system image.
The boot mode is determined in part by the Boot Control Block (BCB)
which is stored at the beginning of the "misc" partition. The BCB
is defined in the "bootloader_message.h" file in AOSP, now copied
here as android_bootloader_message.h with minor modifications.
This patch implements the basic boot flow that loads and boots an
Android kernel image assuming an A/B device which implies that it uses
boot as recovery (BOARD_USES_RECOVERY_AS_BOOT in the BoardConfig.mk).
This means that the recovery image shares the same kernel with the
normal boot system image, but stores the recovery image as a ramdisk
which is not used in normal mode.
Among the limitations, this patch doesn't implement the A/B slot
selection, it only boots from the slot "a".
Bug: 31887729
Test: Booted a rpi3 with this flow.
Signed-off-by: Alex Deymo <deymo@google.com>
Change-Id: Ia2932c6f398f1ae713f0cd9670828f84103dca38
update setenv/getenv to env_set/env_get.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This patch moves the Android Image loading logic from the load_android
command to a new android_load_image() function in image-android.c so it
can be re-used from other commands.
Bug: 32707546
Test: Booted the rpi3 with this patch.
Signed-off-by: Alex Deymo <deymo@google.com>
Change-Id: I12d206141ead1b94ebbcc90ee05512a276c7595a
Implement the rest of the variables and fastboot commands for flashall.
For A/B related commands, slot A is always selected.
Bug: 31887729
Test: "fastboot flashall" does not result in any unknown commands or
variables
Change-Id: Iec794a0a0805aeb744157ab25b417443a3fc7f5a
Flashing a 400Mb sparse system image takes ~10 minutes. The fastboot UDP
protocol expects a response within 1 minute, so during long flash
operations, the device must send fastboot "INFO" packets.
This patch does the following:
- Separate large writes into writes of size FASTBOOT_MAX_BLK_WRITE.
This parameter was tuned by hand to result in a ~10 second write.
- Keep a timer and send an INFO packet every 30 seconds.
- Adjust the sequence number in the header of the fastboot OKAY packet
to account for any INFO packets sent during flashing.
- Reduce busywaiting in the bcm2835 MMC driver. This change is based on
what the kernel does, and doesn't seem to corrupt the MMC. Without
this change, "flashall" takes 25 minutes.
Bug: 31887729
Test: "fastboot -s udp:$RPI_IP flashall" works, rpi3 boots
- Compute CRC checksum over every write to verify written data
was not corrupted.
Change-Id: Ib17ef6a85715705a8b5f722a8b7d3e5fd1a6625d
Add functions to respond to fastboot continue, reboot, and
reboot-bootloader. Continue continues the normal android boot process.
Reboot-bootloader writes a message to the start of the fastboot
buffer, to be parsed at the start of the android boot process. Boot
boots the previously downloaded image from memory.
Bug: 31887729
Test: - Sending "continue" boots into android.
- Sending "reboot" reboots the device.
- Sending "reboot-bootloader" reboots the device, and the
message persists in memory.
- Sending "boot boot.img" boots into kernel.
Change-Id: I8b14724de4612450ccc382bb7532edb993e6e8a4
Add function to respond to fastboot flash and erase. Flash writes the
previously downloaded image to indicated partition. Erase clears the
indicated partition. fb_flash and fb_erase are essentially wrappers
for fb_mmc_flash_write and fb_mmc_erase, which are implemented in
common/fb_mmc.c.
Added common/fb_common.c, where fastboot_okay/fail are implemented.
common/fb_mmc.c assumes fasboot_okay() and fastboot_fail() are
implemented, but they were tied to the fastboot USB implementation.
This refactor adds the response string as a parameter to
fastboot_okay/fail, instead of modifying a global.
Bug: 31887729
Test: FLASH:
- Create file "foo" containing 2048 chars = "-"
- Start "fastboot udp" on device and run
"fastboot -s udp:$RPI_IP flash misc foo" from host
- From U-boot console, read into memory the first 4 blocks from
misc partition, observe each byte is "-".
ERASE
- Start "fastboot udp" on device and run
"fastboot -s udp:$RPI_IP erase misc" from host
- From U-boot console, read into memory many blocks from misc
partition, observe each byte is 0x00
Configs that use fastboot USB implementation still build.
Change-Id: I5bd54868990bd9d5736d0969b3db240c2926eeec
Adds function to respond to fastboot download, and copy downloaded
image to buffer in RAM.
Bug: 31887729
Test: - Create file "foo" containing 2048 chars = "-"
- Start "fastboot udp" on device and run
"fastboot -s udp:$RPI_IP flash boot foo" from host
- Observe that rpi received 2048 bytes of data, and
CONFIG_FASTBOOT_BUF_ADDR contains "-"*2048
Change-Id: Ib42378448627b48c629af89f39a0394db93c3824
This patch adds functionality to parse Fastboot packet types, and send
a response to getvar commands.
Bug: 31887729
Test: Responds to getvar commands with correct values for variables
version, bootloader-version, downloadsize, serialno.
Change-Id: I752a6119d3019745f20defbb1f0c13dba1f24221
The Raspberry Pi does not support USB device mode, so fastboot over
USB does not work. This patch adds support for and partially
implements the device side fastboot UDP protocol as a U-boot command.
It requires an ip address set and ethernet initialized.
- Modify U-boot fastboot command to do fastboot over UDP
- Add net/fastboot.c, which implements fastboot server functions
- Handle QUERY and INIT fastboot packets
- Add CONFIG_UDP_FUNCION_FASTBOOT to enable fastboot over UDP
Bug: 31887729
Test: Tested with fastboot, responds correctly to query and init
packets.
Change-Id: I4045abaf7a4455d756b7c1c00215afaa90c70a6e
Android kernel images include a header that specifies addresses and
kernel size. This patch adds a command to load these images from
storage without specifying the size or address of them, and parsing
them from the header instead.
Bug: 31636643
Change-Id: I84a9cf82cff78ce2299b1981c4f6f9a5720e4d0d
The Raspberry Pi bootloader (bootcode.bin and start.elf) will load
the device tree from the same FAT partition and combine it with
device tree overlays specified in config.txt. This device tree is then
passed to the kernel (in this case U-Boot) in the r2 register.
This patch retrieves the machine id (r1 register) and the device tree
(r2 register) passed to U-Boot and store those in environment variables
on boot so boot scripts can refer to those and pass them to the kernel.
When CONFIG_OF_BOARD is defined, the same device tree passed to U-Boot
will be used in lieu of bundling one with the U-Boot image at build
time.
Bug: 31636643
Test: Booted a Raspberry Pi3 passing the DT from the bootloader.
Change-Id: Ibf9c754719b3e0f41d20382833abf853ba7613e2
To keep synchronization with other paltforms, RK312x
will also check all bootmode information from one
register--PMU_SYS_REG0(0x0x100a0038).
This change should based on rk3126_ddr_300MHz_v2.09.bin
Change-Id: Ia09c87a2d55337b4d6f3ddc58f1a8dfcef8bb4a2
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
The peripherals pclk rate is the same, use a common interface
for peripherals like i2c, pwm and etc.
Change-Id: Id9668400f2bb24be397adee312da5365e09c9237
Signed-off-by: David Wu <david.wu@rock-chips.com>
We will use the common interface to set gamc rgmii sometimes,
but the set_rgmii is a private ops. So abstract an exposed
interface out for use.
Change-Id: Ie1cd15033465ff324b77de389e57d32b28c3d389
Signed-off-by: David Wu <david.wu@rock-chips.com>
1. rename RK_BLK_OFFSET to RK_PARAM_OFFSET;
2. parameter.txt should promise partition address is physical.
Change-Id: Ibadc0589c14f6e48475e4db8526535b8a986d944
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
If failed, we fall back to bootrom download mode.
Change-Id: I003a496d1162e56c459ed54b7d69930a48d91210
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
charge animation will call fuel gauge to set charge current according
to adapter before exit, it promises lower power battery has enough power
supply during some long time preboot command execution.
Change-Id: I7fe5b19a0a48422528956310d5ee272ef556b840
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>