Commit graph

1289 commits

Author SHA1 Message Date
Mark Salyzyn
fb31593542 adb-remount-test: report lsusb for broken connection
Get more details about the usb connection when it times out.

Test: adb-remount-test.sh
Bug: 132070014
Change-Id: I784bea3a2cefcef423b576854abb795add47d123
2019-05-22 14:47:50 -07:00
Mark Salyzyn
1e5ab4811a adb-remount-test: stderr cleanup
Push stderr redirection to outer blocks if possible.

Test: adb-remount-test.sh
Bug: 132070014
Change-Id: Id3b2dfdcf0d778053e10fdb26eb0b1d99b455a46
2019-05-22 14:47:41 -07:00
Tao Bao
3c94eaad5f Merge "fs_mgr: Fix EnsurePathMounted with a given mount_point." 2019-05-15 16:10:18 +00:00
Mark Salyzyn
fe04d7ce7e Merge "fs_mgr: overlayfs readme caveats" 2019-05-14 20:28:17 +00:00
David Anderson
57467074a2 Merge "libdm: Add dm-crypt and dm-default-key support to libdm." 2019-05-14 20:00:39 +00:00
Mark Salyzyn
8338b01bae fs_mgr: overlayfs readme caveats
Itemized list of additional overlayfs caveats

Test: none
Bug: 109821005
Change-Id: I3550ddf6544749cdc68c803f0577002346890518
2019-05-14 10:29:25 -07:00
Mark Salyzyn
98a0128e44 fs_mgr: overlayfs: ReadFstabFromFile touches errno
Regression from commit 77c28476f1
("Remove the mount points defined in skip_mount.cfg from
ReadDefaultFstab()") resulted in ReadFstabFromFile to report
errno ENOENT even upon success, preventing clear error propagation
for real failures (ReadFstabFromFile would _always_ report ENOENT).

The bad error propagation resulted in an adb remount failure.

Added immunization against future adjustments that may also
result in a similar regression in adb remount behaviors.

Test: adb-remount-test.sh
Bug: 132594161
Bug: 128961335
Change-Id: Icf5d48bbfc6d938d4b9657ca8004a6a6ddaab5a6
2019-05-13 10:02:51 -07:00
Treehugger Robot
e27cd0c54e Merge "Fix bug that would prevent us from reserving right amount of space." 2019-05-13 15:29:26 +00:00
Martijn Coenen
20c4cfaa81 Fix bug that would prevent us from reserving right amount of space.
Bug: 132403230
Test: inspect dmesg output:
[   10.762678] init: [libfs_mgr]Setting reserved block count on
/dev/block/dm-2 to 32768
[   10.782652] tune2fs: Setting reserved blocks gid to 1065\x0a
[   10.782655] tune2fs: Setting reserved blocks count to 32768\x0a

Change-Id: Id366d478bdd8a748bb1ba97d08a3b52e3cdd1efb
Merged-In: Id366d478bdd8a748bb1ba97d08a3b52e3cdd1efb
2019-05-13 08:50:50 +02:00
Tao Bao
15fe3b48a5 fs_mgr: Fix EnsurePathMounted with a given mount_point.
The expected behavior is to ensure the path mounted at the given mount
point, instead of the one in fstab.

Test: Boot into taimen recovery. Choose "Mount /system" from menu. Check
      that system image is mounted at /mnt/system.
Change-Id: I07128e34bc47561afee8164611709a2b5393f9b7
2019-05-10 15:10:26 -07:00
David Anderson
55f8b894a3 Merge "fs_mgr: Don't try to suffix "vroot" with "-verity"." 2019-05-10 19:54:58 +00:00
David Anderson
9655c7bf9e fs_mgr: Don't try to suffix "vroot" with "-verity".
The vroot device is specified on the kernel command-line, rather than
being created by fs_mgr.

Bug: 132275224
Test: taimen boots
Change-Id: I368450a333f383d434591555a6ea562e1bd0bc1e
2019-05-09 17:57:15 -07:00
David Anderson
e17405fd9c libdm: Add dm-crypt and dm-default-key support to libdm.
Also, add an Emplace() method to DmTable to make target construction
easier. For example,

    table.AddTarget(std::make_unique<DmTargetLinear>(...));

Becomes:

    table.Emplace<DmTargetLinear>(...);

Bug: 132206403
Test: libdm_test gtest
Change-Id: Iac62c74546ebaa660cb32d6894a019bdac24a305
2019-05-09 15:14:13 -07:00
Bowgo Tsai
2badf73b99 fs_mgr_remount: fix a typo
Replacing "ro.boot.vbmeta.devices_state" with
"ro.boot.vbmeta.device_state" to check if the device is locked.

Bug: 132224452
Test: tree hugger
Change-Id: If4f312730cc82ad5a5d5104a7aca8b9691cf6600
2019-05-09 13:19:29 +08:00
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