Commit Graph

24 Commits

Author SHA1 Message Date
Jason Zhu 6a1e3c91ed cmd: boot_android: separate the avb & ab cmd
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Change-Id: I328a76af35481bdcad6b127dad9adc43843fcbd1
2020-11-03 18:20:02 +08:00
Joseph Chen c6666740ee common: android/rkimg: remove/clean android a/b (slot) code
- the partition disk layer takes over the responsibility of slot suffix
  appending, we remove relative code to make file clean;
- put android a/b code together and name them to be eary understood,
  this makes file esay to read.

Change-Id: Id8c838da682ce6098bd7192d7d7c64269f4e86ba
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-04 15:43:46 +08:00
Joseph Chen 0ed06f16e2 rockchip: support boot from U-disk
- The U-disk boot is only supported from U-Boot, the earlier preloader
  doesn't support it;
- MMC1(SD) has higher priority than U-disk;
- Always boot into recovery mode and deliver "usbfwupdate" to cmdline;
- Usb driver may depend on clock/regulator init, so behind of them;
- Suggest to add ./dts/kern.dtb file to promise the kernel dtb always
  to be loaded successfully even the native images are all damaged.

Change-Id: Ibbb2a061a727752277ac1b80abf362de5d94cca2
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2019-11-04 14:53:45 +08:00
Joseph Chen ee465021fe android: support boot images packed with rockchip android hdr
For some legacy reasons, rockchip use mkbootimg tool to pack android
images with special pack parameters(SDK version lower than 8.1) to
assign kernel/ramdisk/seconds address and page size.

Android hdr on RK3399 SDK-7.1:
   kernel size:      1299808
   kernel address:   60408000
   ramdisk size:     1e6b80
   ramdisk addrress: 62000000
   second size:      41c00
   second address:   60f00000
   tags address:     60088000
   page size:        4000
   header_version:   0
   os_version:       e041114 (ver: 1.7.2, level: 2017.4)
   name:
   cmdline:          buildvariant=userdebug

The kernel/ramdisk/seconds address base is not from 0x10000000 and
page size is not 0x800!

This patch makes bootflow to compatible with above legacy packing.

Change-Id: I663a0d1386694658c97586706ff21ed887d6a2e7
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2018-11-01 08:42:27 +08:00
Jason Zhu cc527546d3 androidboot: nodify cmd bootavb
1.printf necessary information
2.delete useless function: do_avb_write,
    do_avb_write_ab_metada

Change-Id: I5f932e7774ecf9b383358b3c081369cdc7db0167
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-07-19 09:57:37 +08:00
Andy Yan 008aee876a boot_android: add runtime compatible for un/compressed kernel image
This patch add auto parse the compress format of kernel image.
Then decompress the compressed kernel image for arm64, as for
arm32 zImage, we only need to load it to a higher memory, then
the kernel will handle the decompress itself.

Test on RK3308 AARCH64 mode (Cortex A35 816 MHZ) boot with eMMC:

------------------------------------------------------------------
Format    |  Size(Byte) | Ratio | Decomp time(ms) | Boot time(ms) |
-------------------------------------------------------------------
Image     | 7720968     |       |                 |     488       |
-------------------------------------------------------------------
Image.lz4 | 4119448     | 53%   |       59        |     455       |
-------------------------------------------------------------------
Image.lzo | 3858322     | 49%   |       141       |     536       |
-------------------------------------------------------------------
Image.gz  | 3529108     | 45%   |       222       |     609       |
-------------------------------------------------------------------
Image.bz2 | 3295914     | 42%   |       2940      |               |
-------------------------------------------------------------------
Image.lzma| 2683750     | 34%   |                 |               |
-------------------------------------------------------------------

Note: the boot time is counted from first ddr init log to first Kernel log.

Change-Id: I73b12ec944fbc8238b0e061a37e2f31aa3093231
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
2018-07-14 11:39:04 +08:00
Jason Zhu d9d5eb7401 androidboot: add cmd bootavb perm_attr_test
Read and print the perm_attr.

Change-Id: I1e2b73afa1e872eea7abf75d55570b1c8b19c311
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-03-07 08:59:46 +08:00
Jason Zhu 326572ea3b androidboot: fix compile error in arm64
Change-Id: I68bff703ffbf8ef9a65e4d62a5cf1052bc49ac9b
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-03-05 11:34:47 +08:00
Kever Yang 3f251879bf boot_android: fix load address for boot image
The kernel image follows the header(default 0x800) in boot.img, we need to fix
the load address for boot.img so that kernel image can align to 0x80000 as
required by ARM64 kernel booting.

Change-Id: I526ff38bfce2d8fd1571aff817ade11086f196e3
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2018-02-23 10:28:26 +08:00
Jason Zhu 37a7bc39c0 lib: avb: update and modify the avb library
The commit point is updated to google external/avb/
which commit point is cf8c56208d2d9643804a7f123b196c7ebc9af276.

Change-Id: I5a10a8a45d3e9e2c9d20d9b3d44946073c9a49ff
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2018-02-10 10:41:04 +08:00
Kever Yang 891380b57d cmd: boot_android: support legacy aosp image from rockchip
New cmd usage:
boot_android mmc 0

update boot_android:
- do not need provide argv for misc partition and slot
- If CONFIG_ROCKCHIP_RESOURCE_IMAGE is enabled, try to get dtb from resource
partition.

Change-Id: I7242880f9cde916ca10d677ddac07790c66a07a4
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2017-12-08 18:13:25 +08:00
Jason Zhu bf17c6275d androidboot: boot the system without a/b avb
Support boot the system in the old mode, and there
is no need to differentiate the _a or _b slot
in the gpt table.

Change-Id: I162e34a9bd0120db051f709faec06daf3bc0aa9c
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2017-11-20 10:32:54 +08:00
Jason Zhu 9aed1a1336 androidboot: add some new info to cmdline
The android things system need some avb info
in the stage of u-boot, like VBH value and so
on.

Change-Id: Ia102931f3b0c912c7e1f34f668d8af0b45fa4a6e
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2017-11-20 10:32:54 +08:00
Wenping Zhang 9f7ea89d5d androidboot: add BOOT_RECOVERY support
if user input "reboot recovery" by adb or serial console,
uboot will load recovery ramfs image to run.

Change-Id: Ibad1709ed78938dbf1826446a0de5c822c6ce4e4
Signed-off-by: Wenping Zhang <wenping.zhang@rock-chips.com>
split boot_android and boot_mode int two commits.
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2017-11-14 10:55:57 +08:00
Jason Zhu 82ee22d4d3 androidboot: support recovery and fastboot mode
The system must support recovery and fastboot
mode, so the u-boot must judge the boot command
in the misc partition.

Change-Id: I53c876eeefdc20ebe313a6a73d4cfac443fafa67
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2017-11-14 10:55:56 +08:00
Jason Zhu cf7b148dc2 androidboot: free no use buffer
If excute avb_ab_flow() failed, the free the
no use buffer.

Change-Id: I874f3367eceb35424b069a04a1ec35c37b46e639
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2017-11-14 10:55:56 +08:00
Jason Zhu 708de1435a androidboot: close optee client when start kernel
Change-Id: I4b4626e8e2bc89c711988fe23245fa6e71ac7204
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2017-11-14 10:55:56 +08:00
Jason Zhu 4397fdfd14 androidboot: modify do_avb_flow
In the fuction do_avb_flow, the return value of
avb_ab_flow() must be judged. If not, the process
can not return to u-boot command line when execute
avb_ab_flow failing.

Change-Id: I925c9c63cee2153d365ea78b286d8958624b106c
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2017-11-14 10:55:53 +08:00
Jason Zhu f0864c7f9d androidboot: init slot_partition
Change-Id: I1be603307523d245ef8961815a0df38786366d0d
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2017-11-14 10:55:51 +08:00
Jason Zhu e8e29e8d8b androidboot: add new android boot cmds with avb.
The android things boot must have avb function,
then we add the fuction in file cmd/boot_android.c.
In boot_android.c, we add bootavb flow v/n to
bootload android system.

The bootavb flow v bootload android system
with avb.And bootavb flow n bootload android
system as usual.

Change-Id: I3064f8a4aebf2b4bfdb0cf6f0458f42438c27027
Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
2017-11-14 10:55:51 +08:00
Alex Deymo 180cc7c601 android: Implement A/B slot select.
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
2017-11-14 10:55:46 +08:00
Alex Deymo df7cce4361 boot_android: Drop the "mmc" restriction on the partition name.
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
2017-11-14 10:55:46 +08:00
Alex Deymo 8062224026 boot_android: Pass the slot from the command.
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
2017-11-14 10:55:46 +08:00
Alex Deymo 06f4a8746e Add "boot_android" command.
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
2017-11-14 10:55:46 +08:00