system/core/fs_mgr/fs_mgr_fstab.cpp:161:18: error: comparison of integers of different signs: 'int' and 'const uint64_t' (aka 'const unsigned long') [-Werror,-Wsign-compare]
if (flag == j->flag) {
~~~~ ^ ~~~~~~~
system/core/fs_mgr/fs_mgr.cpp:674:11: error: comparison of integers of different signs: 'int' and 'std::__1::vector<FstabEntry, std::__1::allocator<FstabEntry> >::size_type' (aka 'unsigned long') [-Werror,-Wsign-compare]
if (i < fstab.size()) --i;
~ ^ ~~~~~~~~~~~~
Test: m checkbuild
Change-Id: I056add222a92f99134a49ac141bd143ddd54179b
Adding a new fs_mgr flag 'slotselect_other' to mount _b when _a is
active, or vice versa.
Bug: 113182233
Bug: 112103720
Test: `mount_all fstab.test` with one line using `slotselect_other`.
Change-Id: I96c63141df7722dc30ca9817b0b154e493b9eef9
boot_devices in device tree is our last remaining device tree entry
for specifying the kernel commandline. Since this doesn't make sense
to be included in the fstab, especially as there is no way to
differentiate between different boot devices within a single device
tree as some devices do, it is moved to the kernel commandline.
Bug: 117933812
Test: boot blueline without boot_devices in DT
Change-Id: If498836ae2ef14e68ff761338ef352c20c4a7b3d
Extend test script to check non overlayfs case too. Establish
whether overlayfs is supported, or needed, and adjust expectations.
For the flash vendor code, make sure it is the _right_ vendor,
skip instead of fail.
Improve quality of the testing and handle more cases.
Test: adb-remount-test.sh
Bug: 109821005
Change-Id: Ic9957cb378d8e7737ffc4ba04078c1cb6bbd1bbd
Do not report errno if ENOENT or ENXIO as it is expected when verity
is in fact disabled or not setup on platform.
Reading the default fstab can also result in ENOENT if fstab or dt
are missing on purpose, but if we get an fstab then restore the
errno as we move on.
fs_mgr_has_shared_blocks sets errno, when all we care about is yes
or no answer (EPERM notwithstanding, which indicates do not know).
If no candidates are found to override, and not caused by EPERM,
then suppress errno.
Test: adb-remount-test.sh
Bug: 109821005
Change-Id: If7ae257cb6b738a64ba43d32805760cc292b2fae
We want to move all information required for first stage mount into
the first stage ramdisk instead of using device tree. A previous
change allowed reading the fstab from the first stage ramdisk, but
'vbmeta/parts' was still in device tree. This change allows
specifying the required vbmeta/parts information in the fstab.
The new syntax is that instead of simply specifying 'avb' as an fs_mgr
option, a partition may specify 'avb=<vbmeta partition name>' and that
vbmeta partition will also be initialized by first stage init before
attempting to mount any devices.
Bug: 117933812
Test: boot crosshatch without device tree fstab
Change-Id: Ida1a6da988c10d364b3ccdaa6c5d63e5264d1b27
Don't know why this was ever specified, but seems reasonable to remove
it now that we're so close.
Test: build
Change-Id: Ia8d056cd1c9660b3c22531317098ace78e661d6a
Adiantum is a crypto method Android is supporting for devices
which don't have AES CPU instructions. See the paper
"Adiantum: length-preserving encryption for entry-level processors"
(https://eprint.iacr.org/2018/720.pdf) for more details.
We add Adiantum to our list of supported encryption modes.
Bug: 112010205
Test: Tested on a device
Change-Id: I14a400164803a1e217d378ad9bd8b67a61b8b7d0
When allocating a partition with a size that is unaligned (to the
optimal alignment), the remaining sectors are wasted since they are
never reallocated. This is because the free list is guaranteed to only
contain optimally-aligned regions. Unfortunately this means when a
partition is resized, we are wasting a small amount of space each time.
On a non-A/B device, this could wind up being significant.
For example, with an alignment of 512KiB, a 4KiB partition at offset 0
will waste 508KiB of space. The next extent to be allocated by any
partition will start at the next 512KiB.
To address this, we round up extents to the optimal alignment. This
means partitions may wind up slightly over-allocated, versus before,
where they would waste space by making it unavailable.
Bug: 120434950
Test: liblp_test gtest
Change-Id: I555209b301058555526cc4309f7049ae81cf877d
This will ease the transition in the future to using an Fstab struct
that uses std::string instead of char*.
Bug: 62292478
Test: boot
Change-Id: I170db74c2eb6dc16bd21fe65d7e7c685ce5c8b11
* changes:
fs_mgr: overlay: use alternate for backing storage
fs_mgr: overlay: split out fs_mgr_overlayfs_create_scratch()
fs_mgr: overlay: split out fs_mgr_overlayfs_make_scratch()
When we have multiple physical super partitions, it is prudent to
take the alternate super physical partition in its raw entirety
rather than to construct a logical partition out of the current
super partition's limited remaining space.
SideEffect: alternate boot partitions destroyed for the sake of debug
Test: adb-remount-test.sh (including manually disabled to check
both code paths).
Bug: 119885423
Change-Id: I368d3a5619f69de3b0d1fcad73c4b42d25d0d969
Modernize a bit of code in preparation for the rest of the
modernization. Use more unique_fd and fix a few fd leaks in the
process.
Bug: 62292478
Test: boot
Change-Id: I2a6f1abaa1b9a4e979baea36764b91157c2ed218
In the non-retrofit case, the metadata source partition will be
hardcoded as "super", but such a partition may not exist or may have
been overridden by super_partition=<something>. Make this work reliably
by plumbing the resolved metadata block device through, and using it any
time a partition called "super" is requested.
This also fixes a case in the first_stage_mount code that assumed that
detected a non-A/B, non-retrofit case by assuming the metadata source
partition would be called "super".
Bug: 113175337
Test: boot test on cuttlefish
Change-Id: I8ce1defb902e257eeb7170d697b378eba31faee3
Provide a means to determine if overlayfs is currently active with
fs_mgr_overlayfs_is_setup(). Search for current clues in the system
that the overrides are in play. If /mnt/scratch/ is mounted, that
may be enough of a smoking gun because the resource itself may
interfere with operations.
Related to update_engine calling this function to reject performing
an OTA as its operations are incompatible with the overrides.
Test: adb-remount-test.sh
Bug: 120034852
Change-Id: I641163b1559c1a83fe7d0c336d04c10e9956ad3a
Now that we have a first stage ramdisk (or use recovery in its place),
it's possible to place a vendor specific fstab along with first stage
init, removing the need for device tree modifications to have an
fstab.
Bug: 117933812
Test: hikey boots with only an fstab in first stage ramdisk
Test: blueline mainline boots with a disabled DT fstab and an fstab in recovery
Change-Id: I4460b88851557a75ba06ff795cd842e7dfb6da46
When allocating "b" partitions on a non-retrofit A/B device, prioritize
regions occuring in the second half of the super partition. To make this
effective, the region covering the midpoint sector is split into two
additional regions.
This will allow OTAs to avoid unecessary fragmentation, since each
slot's partitions will be grouped together, leaving a large chunk of
contiguous space available when the OTA deletes the target slot. Since
updates are not allowed to consume more than half of the super
partition, this should guarantee one extent per partition. Note that, if
this restriction is not in place (for example, a developer flashes a
massive "system_b"), then an additional extent will be allocated due to
the region that was split.
Bug: 120433288
Test: liblp_test gtest
Change-Id: I1797e59e14c8b0d4d0e6855a1d984e8159b21df2
Found a device with a 3/4MB erase block, give a wider margin so that
flashing a single partition is unlikely to be blocked by scratch.
Add documentation to tell developers to flashall to clear scratch.
Test: adb-remount-test.sh
Bug: 109821005
Change-Id: Ic219283f4c42e457b98991bcd1752253e182eff3
Create a C++ Fstab struct with the intention to eventually deprecate
the legacy C 'fstab' struct. This also contains functions for
converting between the two fstab variants to ease in the transition.
Bug: 62292478
Test: boot
Change-Id: I6fb51c6a99e65192708792719df01960cf6b432a
Disable overrides if we are booting up in recovery or fastbootd.
Check for existence of /system/bin/recovery.
Test: adb-remount-test.sh
Bug: 120034852
Change-Id: I946eb605300226d31356ecac209d6367f4e13526