The client of FirstStageMount class should check the existence of fstab
in device-tree prior to using it. So raising a FATAL error inside
FirstStageMount when failed to parsing the fstab, in order to expose
more accurate error messages.
Also fixing a comment in fs_mgr, where it might happen in either
non-A/B or A/B.
Bug: 69102431
Test: boot sailfish
Change-Id: Ifb525beaa3423b118644778bfe0f84bff9465303
This change adds fstab.${ro.boot.hardware.platform} file into list of
searched fstab filenames.
The ${ro.boot.hardware.platform} helps consolidate init sequence based
on platform. Potentially it allows same build serve different devices.
Bug: 68663168
Change-Id: I822d5bc432e823218ebc640093cfbe5e9271d3b1
Previously there is no vboot 1.0 metadata for ENG builds. It relies on
is_device_secure() to query "ro.secure" and skip setting up dm-verity
if the value is 0 (meaning ENG build).
This change will be submitted together with other changes to add vboot
1.0 metadata for ENG builds with a "disable magic". The resulting
metadata will be the same as triggering an "adb disable-verity" on an
USERDEBUG image.
Bug: 63056044
Test: boot sailfish eng/userdebug builds
Change-Id: I35eef771e1b30bfc6d01b8ed76b40c942fe7b783
This is needed if they will ever handle ro. properties that have
values longer than 92 characters.
Bug: 23102347
Bug: 34954705
Test: read and write properties with value length > 92 characters
Change-Id: I44aa135c97ec010f12162c30f743387810ae2c5d
fs_mgr isn't usable by C now as we've migrated all fs_mgr clients in AOSP
to CPP. Removing the support for C clients.
Bug: 67024518
Bug: 67444051
Test: boot sailfish
Change-Id: Iac57f51eb6a524c6dcdc625c83af75602b4f9b3b
No fs_mgr client is using fs_mgr_get_entry_for_mount_point_after(), which
supports matching a mount point iteratively by specifying a starting entry
in the fstab. So removes it.
Also switch the public API from C/C++ to C++-only:
fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const char* path);
==> fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const std::string& path);
Bug: 67024518
Test: boot sailfish, manually test fs_mgr_get_entry_for_mount_point().
Change-Id: I38e18fa6bd9485b6cd31b55474406a511df3f506
Currently when searching a mount point from a fstab, it checks whether the
mount point of an fstab entry is the prefix of a given path, and the
next char after the match is either '\0' or '/'.
However, it will always return the fstab entry with mount point
"/vendor" when searching path is "/vendor", "/vendor/abc" or "/vendor/cde"
in the following fstab. Because "/vendor" is the prefix of "/vendor/abc"
and "/vendor/cde", and the next char after the match is '/'.
/dev/block/platform/.../by-name/vendor /vendor ext4 ro wait
/dev/block/platform/.../by-name/abc /vendor/abc ext4 ro wait
/dev/block/platform/.../by-name/cde /vendor/cde ext4 ro wait
Fix this by performing an exact match when searching the mount point.
Bug: 63912287
Test: boot sailfish
Change-Id: I504655f5c71790c5d528085de416ce3c30d21fea
Execute mke2fs to create empty ext4 filesystem.
Execute e2fsdroid to initialize selinux context.
Test: zero-out first 4k of data partition and reboot,
fs_mgr successfully formats /data.
Bug: 35219933
Change-Id: If6f72f62c618c64be703b83f0114a4dd0a2b079f
(cherry picked from commit f71bc0c152)
On platforms that use ACPI instead of Device Tree (DT), such as
Ranchu x86/x86_64, /proc/device-tree/firmware/android/ does not
exist. As a result, Android O is unable to mount /system, etc.
at the first stage of init:
init: First stage mount skipped (missing/incompatible fstab in
device tree)
Those platforms may create another directory that mimics the layout
of the standard DT directory in procfs, and store early mount
configuration there. E.g., Ranchu x86/x86_64 creates one in sysfs
using information encoded in the ACPI tables:
https://android-review.googlesource.com/442472https://android-review.googlesource.com/443432https://android-review.googlesource.com/442393https://android-review.googlesource.com/442395
Therefore, instead of hardcoding the Android DT path, load it from
the kernel command line using a new Android-specific property key
("androidboot.android_dt_dir"). If no such property exists, fall
back to the standard procfs path (so no change is needed for DT-
aware platforms).
Note that init/ and fs_mgr/ each have their own copy of the Android
DT path, because they do not share any global state. A future CL
should remove the duplication by refactoring.
With this CL as well as the above ones, the said warning is gone,
but early mount fails. That is a separate bug, though, and will be
addressed by another CL.
Test: Boot patched sdk_phone_x86-userdebug system image with patched
Goldfish 3.18 x86 kernel in patched Android Emulator, verify
the "init: First stage mount skipped" warning no longer shows
in dmesg.
Change-Id: Ib6df577319503ec1ca778de2b5458cc72ce07415
Signed-off-by: Yu Ning <yu.ning@intel.com>
clang is the default compiler since Android nougat
Test: mma & verified it´s still build with clang
Change-Id: I34adaeef2f6558a09f26027271222bad94780507
Signed-off-by: Lennart Wieboldt <lennart.1997@gmx.de>
* changes:
fastboot: add mke2fs and e2fsdroid to build package
fastboot: call mke2fs tools to generate ext4 image
fs_mgr: call format_f2fs correctly with -f
init: require e2fsdroid and mke2fs when building init
init: rename mke2fs tools with _static suffix
Because full disk encryption make surper block is not except contents. Only
judge the magic number can prevent most of encrypted surper block.
In particular, magic number plaintext may be equal ciphertext. In order to
avoid this situation, we add the judgment of adaptive situation of the
s_rev_level, s_log_block_size and EXT4_INODE_SIZE.
Test: 1. Config fstab,userdata add flags: forceencrypt=footer,reservedsize=128M
2. build a new target files, and flash all image.
3. Config encrypt userdata surperblock,set magic number is 0xEF53
4. reboot system and check log of fs_mgr.
Change-Id: I925584d58f17afabbb3aa91f8be2302518172bb2
Signed-off-by: katao <katao@xiaomi.com>
This patch formats f2fs with -f option.
Change-Id: I3fc415f35d81f22cbf1eadebc619465d36205927
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
(cherry picked from commit 0331c2cf77)
On a A/B device, the image combination in VTS is:
- system.img (userdebug): provided by Google (system as root)
- vendor.img (user): provided by the OEM
The generic system.img provided by Google doesn't have /verity_key.
So verified boot will fail when it tries to verify the signature of
vendor.img. This CL allows signature verification error (including
no verity_key) when the device is unlocked.
This CL also changes the return value to FS_MGR_SETUP_VERITY_SKIPPED when
signature verification failed in logging mode. Otherwise, first stage
mount will fail because it assumes verity device initialization should be
successful when receiving FS_MGR_SETUP_VERITY_SUCCESS.
Bug: 63821912
Test: boot generic system.img on a A/B device
Change-Id: I33e5ef753913ae9f0c8b02c518ae94d4c8505611
Upstream kernels (v4.9+, v4.4.67+) have started to enforce that
encryption policies cannot be set on ext4 directories unless
EXT4_FEATURE_INCOMPAT_ENCRYPT is set in the filesystem superblock, as
was the original design. Since Android's userspace was not setting this
flag, it was not possible to use "file-based encryption" (FBE) on
devices whose kernels enforce this constraint. Fix this by updating
fs_mgr to set the flag if needed, similar to how it enables the quota
feature if needed.
Note that it would, eventually, be simpler to set this flag at mkfs
time. But that seems infeasible for now, given the many different ways
the userdata filesystem can be formatted --- including via 'fastboot',
which I believe is expected to still be compatible with old devices
whose kernel and/or e2fsprogs don't support the 'encrypt' flag.
Bug: 36231741
Change-Id: Ibafb9a7116fc853b62f8ee074a78499399f290a6
There were several duplications in the code that runs before a
filesystem is mounted. This made it difficult to start running tune2fs
to set the encryption feature flag. Refactor to deduplicate the logic,
and improve the log messages.
Bug: 36231741
Change-Id: I90846dad9c5ec85b3c5460615dec4cc19cb7e198