Commit graph

1275 commits

Author SHA1 Message Date
Iris Chang
705fd7f52c Support booting a chained boot-debug.img
boot-debug.img is introduced to allow 'adb root' if the device is
unlocked, and it cannot be release signed. If /boot partition is chained
in AVB signing and boot-debug.img is used, avb_slot_verify() in
userspace will return AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED
and fs_mgr will refuse to boot. This CL treats the public key rejection
as non-fatal for chained vbmeta to continue booting, if the device is
unlocked.

Bug: 129508966
Test: can root with user load which /boot chained in AVB signing
Change-Id: Idfa8caffbb96f33702b1749afd2e2a59616ddba7
2019-05-07 09:26:49 +00:00
David Anderson
eaf203d301 Merge "Add a liblp test that we can parse the device's super partition." 2019-05-07 04:00:57 +00:00
David Anderson
41d6792dec Merge "Add dm-snapshot targets to libdm and dmctl." 2019-05-07 00:43:19 +00:00
David Anderson
f5de989a55 Add a liblp test that we can parse the device's super partition.
Bug: 132112489
Test: liblp_test gtest
Change-Id: I1c0950dc30f42cd232e0616191d1365cdfc6512d
2019-05-06 17:06:33 -07:00
Tom Cherry
1cd30df584 Merge "Vboot1.0: remove code to read verity state in userspace" 2019-05-06 23:41:47 +00:00
David Anderson
29e6bf282f Add dm-snapshot targets to libdm and dmctl.
This adds DmTargetSnapshotOrigin and DmTargetSnapshot. The latter target
can handle both "snapshot" and "snapshot-merge" targets. The syntax for
dmctl is as follows:

    dmctl create <name> snapshot <start> <num_sectors> <base_device> \
          <cow_device> <P|N> <chunk_size>
    dmctl create <name> snapshot-merge <start> <num_sectors> <base_device> \
          <cow_device> <chunk_size>
    dmctl create <name> snapshot-origin <start> <num_sectors> <device>

Bug: N/A
Test: libdm_test gtests
Change-Id: I8eef987cb92121e81bedd37b9a66fad04c7a23a3
2019-05-06 13:59:44 -07:00
Mark Salyzyn
c3fc2aa964 fs_mgr: overlay: resize other OTA partitions to zero to make space
If we do not have at least the minimum space to create a scratch
partition, let's resize the other partitions to zero to make the
space and try again.

Specify additional shared library dependencies for remount command.
margin_size could never be calculated because "scratch" partition
does not exist, so use super partition instead as argument to
GetBlockDeviceInfo.

Add a "Now reboot your device for settings to take effect" message
if the -R argument was not supplied.  Adjust some of the messages
to be clearer.

Manual test: On a full DAP device, resize or flash both a and b side
for system, vendor and product with fastboot to duplicate failure
conditions of limited space and check remount command resizes other
side partitions to mitigate.

Test: manual and adb_remount_test.sh
Bug: 131390072
Change-Id: I34c4a973f88a5e1e06b64af9589a84721dd1bbbd
2019-05-02 13:46:22 -07:00
Treehugger Robot
74d84224ae Merge "Remove the mount points defined in skip_mount.cfg from ReadDefaultFstab()" 2019-04-24 02:53:53 +00:00
SzuWei Lin
77c28476f1 Remove the mount points defined in skip_mount.cfg from ReadDefaultFstab()
The first stage init skips mounting the mount points defined in
skip_mount.cfg, but these mount points still return from
ReadDefaultFstab(). The behavior causes some error logic which
try to access the partition which had been skipped.

After applying the patch. ReadDefaultFstab() will not contain the
skipped mount points.

Bug: 128961335
Test: `fastboot delete-logical-partition product_a`
Test: `fastboot flash system aosp_arm64-userdebug`
Test: `fastboot -w reboot` and boot to home screen
Change-Id: I3156260b5d37647dbecf98ca90601a089bea5c46
2019-04-23 17:42:40 +08:00
Treehugger Robot
1412f3c99d Merge "fs_mgr: overlayfs: suppress mkfs output" 2019-04-22 16:02:04 +00:00
Tom Cherry
f7545cea34 Vboot1.0: remove code to read verity state in userspace
The code to read verity state in userspace is deprecated in favor of
having the bootloader read and report the state, so this change
removes this now unused code.

Bug: 73456517
Test: boot
Change-Id: Ib626fd61850bce3016179ca92a9831c2ac29c032
2019-04-19 16:53:33 -07:00
David Anderson
0b0ee7af2f Don't assume an A/B device when overriding the super partition name.
Bug: 130750333
Test: launch cuttlefish with DAP enabled
Change-Id: I1ea309d448866a8914f58be98d860eca36d47062
2019-04-18 14:16:54 -07:00
Mark Salyzyn
4560714d10 fs_mgr: overlayfs: suppress mkfs output
After this change, all the noise from mkfs is suppressed:

$ adb remount
[libfs_mgr]superblock s_max_mnt_count:65535,/dev/block/by-name/system_b
[libfs_mgr]__mount(source=/dev/block/by-name/system_b,target=/mnt/scratch,type=ext4)=-1: Invalid argument
[libfs_mgr]__mount(source=/dev/block/by-name/system_b,target=/mnt/scratch,type=f2fs)=0: Success
Using overlayfs for /system
Using overlayfs for /vendor
Using overlayfs for /product
[libfs_mgr]__mount(source=overlay,target=/system,type=overlay,upperdir=/mnt/scratch/overlay/system/upper)=0
[libfs_mgr]__mount(source=overlay,target=/vendor,type=overlay,upperdir=/mnt/scratch/overlay/vendor/upper)=0
[libfs_mgr]__mount(source=overlay,target=/product,type=overlay,upperdir=/mnt/scratch/overlay/product/upper)=0
remount succeeded

Test: manual as above
Bug: 130739326
Change-Id: I7ed8842e42b74b6a487ce6324b28baf78f1f63bf
2019-04-17 12:47:31 -07:00
Yifan Hong
e438843ead Merge "init: add umount_all builtin." 2019-04-16 22:46:52 +00:00
Yifan Hong
402633d605 init: add umount_all builtin.
umount_all is the cleanup step for mount_all.

In particular, the mount_all builtin creates a verity device,
'postinstall-verity', for the following line:

system /postinstall ... ... slotselect_other,logical,avb_keys=...

cppreopt umounts /postinstall but doesn't destroy the postinstall-verity
device, causing OTA to fail (because it cannot destroy the
system_[other] device). umount_all also destroy the verity device.

Note that mount_all does not map system_[other]; it is mapped by
first stage init. Hence, umount_all doesn't destroy it either. The OTA
client is reponsible for unmapping the device itself.

Bug: 129988285
Test: flash, boot, then check `dmctl list devices`, then OTA

Change-Id: Id3ab65b3860b6ea6cfec310ab13652009c81f415
Merged-In: Id3ab65b3860b6ea6cfec310ab13652009c81f415
2019-04-15 15:11:28 -07:00
David Anderson
82dee3ea69 liblp: Use ro.boot.slot_suffix rather than ro.build.ab_update.
Bug: 130433329
Test: liblp_test gtests
Change-Id: I229f582dc829884e4e90187981902cd4d45637c6
2019-04-12 16:59:31 -07:00
David Anderson
243887b1e1 Handle empty strings in GetPartitionAbsolutePath.
Bug: N/A
Test: liblp_test gtests
Change-Id: I2440da17aa842d996a37d27b4bfba89ce71321d8
2019-04-12 16:59:30 -07:00
Treehugger Robot
3569a8817d Merge "fs_mgr: overlay check shared blocks for / if /system is not" 2019-04-12 05:38:03 +00:00
Treehugger Robot
543fdbefe6 Merge "avb_ops: support reading from a logical partition" 2019-04-12 00:04:49 +00:00
Mark Salyzyn
d6ef9d2411 fs_mgr: overlay check shared blocks for / if /system is not
For bringup devices that do not have right-sized partition, and if
/system is now root, check / to be sure.

Consider unshare blocks for ext4 as dead code, provide a strong
message to caller to provide all the dependencies to overlayfs.

Test: adb-remount-test.sh
Bug: 130327601
Change-Id: Iffa7c5f24d8f409e71f89fe9ece274d8c476f6fc
2019-04-11 16:04:54 -07:00
Mark Salyzyn
38af717a83 fs_mgr: overlay: only use system_<other> if other slot suffix not blank
Test: adb-remount-test.sh
Bug: 129988285
Change-Id: Ib929d242e7cc4953096eb6300bcf7888ce2259ab
2019-04-11 09:48:45 -07:00
Bowgo Tsai
84d4933686 avb_ops: support reading from a logical partition
On some devices (e.g., emulator), init needs to read AVB footer from
a logical partition because:

   1) Dynamic/logical partition is enabled
   2) The partition is AVB chained, i.e., need to locate footer from the end
   3) Logical partition is not understandable by bootloader,
      but there is no bootloader in this case

Bug: 125540538
Bug: 128434470
Test: boot and force the fallback path, to check it can get logical path
Change-Id: Ie304bce234cbf0f938f386f7ce59235c851e0e2d
2019-04-11 10:58:30 +08:00
David Anderson
ca66aac289 Merge "Fix ART build bustage." 2019-04-10 04:43:48 +00:00
David Anderson
569bff76fe Fix ART build bustage.
Bug: 130244092
Test: builds
Change-Id: I1e3f7e167716101809d788e5aa41c672046569e0
2019-04-09 23:50:11 +00:00
Mark Salyzyn
4c5d1f8245 fs_mgr: overlay: wait for logical partition to be created
Test: adb-remount-test.sh
Bug: 130238923
Change-Id: Iaff01565d6df5c4434e66f742ed0939f61f6005a
2019-04-09 14:13:48 -07:00
David Anderson
9a62481fc7 Merge "Add fiemap_writer_test to VTS." 2019-04-09 18:53:22 +00:00
Treehugger Robot
66b0c31f60 Merge "Increase adb-remount timeout" 2019-04-08 15:13:47 +00:00
Treehugger Robot
8e5bd5a247 Merge "Update GSI keys for dynamic system image" 2019-04-08 13:41:47 +00:00
Yifan Hong
a482da1d76 Allow to build non-sparse super image.
- Rename SparseBuilder to ImageBuilder, WriteSplitSparseFiles
  to WriteSplitImageFiles, WriteToSparseFile to WriteToImageFile, etc.
- Add sparsify argument to ImageBuilder, WriteToImageFile, and
  WriteSplitImageFiles

This allows lpmake to write non-sparse super image directly. Virtual
devices needs non-sparse images to work on.

Test: lpmake without --sparse
Test: liblp_test
Bug: 120041578

Change-Id: I76ee09efd02df7caaa8abd37a55ae0bebf9cfa29
2019-04-04 11:33:38 -07:00
Treehugger Robot
73bb342956 Merge "libfiemap_writer: test pinned file bit" 2019-04-03 21:31:18 +00:00
Julien Desprez
c25a9da325 Increase adb-remount timeout
Unblocked the previous error we are now reaching the
default 5min timeout which is too short for this test.
Increase it to 1h.

Test: None
Bug: 117670584
Change-Id: I7fe40e54a7fb978392ee919226c0f05413e7349e
2019-04-03 08:27:29 -07:00
Bowgo Tsai
b9b9a68f49 Update GSI keys for dynamic system image
Bug: 112293933
Test: tree hugger
Change-Id: Ia5fd08410fd680b8fd3676cfc4daae1caf1ff425
2019-04-03 17:54:01 +08:00
Treehugger Robot
cd68bda4ec Merge "Replace reboot-fastboot by reboot fastboot" 2019-04-03 08:24:34 +00:00
Jaegeuk Kim
a9b3c3d605 libfiemap_writer: test pinned file bit
The pinned file should have NOCOW_FL flag.

Bug: 129803146
Change-Id: Idaf5bdbbdcce1c3805cd16ddb0c1c7f1df87dcfb
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2019-04-03 04:35:33 +00:00
Julien Desprez
74239ea1b1 Replace reboot-fastboot by reboot fastboot
Older host adb client do not recognize reboot-fastboot,
switch it for "adb reboot fastboot" which should be the
same.

Test: None
Bug: 117670584
Change-Id: Iec5230ca66ec18fe7d7c0ebd3f9ab9596a6e7b3c
2019-04-02 17:04:39 -07:00
Treehugger Robot
2b8e96bd64 Merge "fs_mgr: remount: system is root" 2019-04-02 21:54:34 +00:00
Mark Salyzyn
b18aba0a9f fs_mgr: remount: system is root
For devices without overlayfs and system is root (Hikey, Hikey960)
correct "/system" to "/" if that is the mount point.

Test: adb-remount-test.sh
Bug: 129720614
Change-Id: I3bdbd5ea7b70d03477055e60521d8132b486c904
2019-04-02 21:22:27 +00:00
David Anderson
97d1fccd5b Merge "Fix device mapper name clashes on non-A/B devices." 2019-04-02 20:16:36 +00:00
Julien Desprez
61dea3d154 Add the basic config to run through atest
Add basic config that can run through atest the remount
script.
Very first step before being able to run in infra.

Test: atest adb-remount-sh
Bug: 117670584
Change-Id: I399f79fb7d7cd1b8a832be23efb3b625be693f7e
2019-03-28 10:21:02 -07:00
David Anderson
5aa37dc3dc Merge "init: Support booting off GSIs installed to non-userdata block devices." 2019-03-28 09:46:44 +00:00
Yifan Hong
f959fffc1c Merge changes from topic "lpdumpd"
* changes:
  libbase: realpath is wrapped with TEMP_FAILURE_RETRY
  liblp: Replace open with GetControlFileOrOpen
  init: expand prop in 'file'
  libcutils: android_get_control_file uses realpath.
2019-03-26 20:35:36 +00:00
Nicolas Geoffray
7f03e4eea1 Allow makefiles to be parsed in a trimmed down manifest.
Test: m
Change-Id: Id0e52eacc8e8b5fa75af2050a72be6a8bdadc984
Exempt-From-Owner-Approval: Unbreaks ART team
2019-03-25 09:14:33 +00:00
Treehugger Robot
dddf40a7f5 Merge changes from topic "b/129002747"
* changes:
  Make VTS run libdm_test
  Create a VTS test from liblp_test
2019-03-25 05:09:36 +00:00
Hridya Valsaraju
1a9a02c9a6 Make VTS run libdm_test
Bug: 129002747
Test: vts-tradefed run commandAndExit vts-kernel --primary-abi-only --module VtsKernelLibdmTest

Change-Id: If0fb06bde561ae839d3aff96a73eb395082b4653
2019-03-22 15:11:49 -07:00
Hridya Valsaraju
4e3b6332ab Create a VTS test from liblp_test
Bug: 129002747
Test: vts-tradefed run commandAndExit vts-kernel --primary-abi-only --module VtsKernelLiblpTest

Change-Id: I6497428ec1ce93f4c1814c3185c490d3701f1140
2019-03-22 15:11:49 -07:00
Yifan Hong
26328e80b1 liblp: Replace open with GetControlFileOrOpen
... so that fds from init can be used.

Bug: 126233777
Test: unit tests

Change-Id: Ife652e61305ef4fb6a02edfa765a91b5959d1b4b
2019-03-22 14:26:25 -07:00
David Anderson
db64c82fe7 Add fiemap_writer_test to VTS.
Note: fiemap_writer_test's default argument now defaults to
/data/local/unencrypted or /data (whichever exists), since there is no
way to pass arguments via AndroidTest.xml.

Bug: 129000341
Test: vts-tradefed run commandAndExit vts-kernel --primary-abi-only --module VtsFiemapWriterTest
Change-Id: I8cc2e39e170b26b53cf0a829b308171890ae82fd
2019-03-22 20:48:20 +00:00
David Anderson
7082f68808 Fix device mapper name clashes on non-A/B devices.
Bug: 123666267
Test: sysfs reports -verity suffix for verity node names
Change-Id: I07fe428ce86209825e39a0ebf7b4d622b93cc81b
2019-03-22 13:47:27 -07:00
Mark Salyzyn
b43448941a fs_mgr: overlay: test is alarming on legacy eng builds.
On taimen-eng build, the test reports:

  [  WARNING ] user fastboot missing required to invalidate, ignoring a failure
  ERROR: expected "cat: /vendor/hello: No such file or directory"
         got "Hello World! Fri Mar 22 08:56:32 PDT 2019"
  [  FAILED  ] vendor content after flash vendor

Which is a result of a corner case problem on devices that need to
use overlayfs to support adb remount, but do not have fastbootd as
required by Dynamic Android Partitions (DAP).  These legacy non-DAP
devices we consider this a Known Issue.

The message however is too alarming when reporting this Known Issue
that the test has notified you it accepts.  Use standard notification
output format, and change the result to a series of WARNING instead.

The output would then look like:

  [  WARNING ] user fastboot missing required to invalidate, ignoring a failure
  [  WARNING ] expected "cat: /vendor/hello: No such file or directory"
  [  WARNING ] got "Hello World! Fri Mar 22 08:56:32 PDT 2019"
  [  WARNING ] vendor content after flash vendor

Which still tells us there is an issue, but does not cause a state
of extreme alarm when looking at the test output.

Test: adb-remount-test.sh
Bug: 120448575
Bug: 128876541
Bug: 123079041
Change-Id: I1d8d60f23f7670ade7eae1be629264f7507e0cfd
2019-03-22 09:41:20 -07:00
David Anderson
ee725f610f init: Support booting off GSIs installed to non-userdata block devices.
Bug: 126230649
Bug: 127953521
Test: GSI boots when installed to sdcard on hikey960
      GSI boots when installed to /data/gsi
Change-Id: Id59926ebe363939c8c5745bb1bf5bd13722dae7e
2019-03-20 18:22:00 -07:00