Skip to content

Conversation

@andylin-hao
Copy link

Current script finds patch files that have two hard links. But the links in fact seem to be soft links (at least after git clone), causing the script to miss all patch files. So maybe we should use the .patch suffix to find the patch files instead.

The original script finds patch files that have two hard links.
But the links seem to be soft links (at least after git clone).
So maybe we should use the .patch suffix to find the patch files instead.
@zhouziyang
Copy link
Member

I'm getting confused. With find * -links 2 (better with find * -type d -links 2), I just want to find all leaf directory paths, and it should work on all POSIX compliant Linux environment.

I just followed your instructions (git clone ...), and it worked as expected. Can you provide more details about your concern?

@andylin-hao
Copy link
Author

Looks like the behavior of find -links may be subject to the specific filesystem features. I'm using Btrfs, which sets directory link count to 1 instead of >=2 like ext4 (https://archive.kernel.org/oldwiki/btrfs.wiki.kernel.org/index.php/Project_ideas.html#Track_link_count_for_directories, https://unix.stackexchange.com/questions/101515/why-does-a-new-directory-have-a-hard-link-count-of-2-before-anything-is-added-to). Perhaps that's why my "find * -links 2" simply outputs empty. Though this is indeed a corner case, I think it's propably a good idea to make the commands agnostic to filesystems.

@zhouziyang
Copy link
Member

Thanks for pointing out, and indeed it's a issue on btrfs. Well, I'm not sure anyone build AOSP on such filesystem.
I will rework this if any more issues pop out.

BTW, I think your changes are suboptimal (git command runs many more times) and may introduce errors (the found patches may be not ordered).

@andylin-hao
Copy link
Author

andylin-hao commented Feb 6, 2024

BTW, I think your changes are suboptimal (git command runs many more times) and may introduce errors (the found patches may be not ordered).

Ah yes, I missed that. Perhaps a better way is to find the directories that have no subdirectories. I just updated my changes if you're interested. I tested it on my environment and it seems to work fine.

detect AOSP tag from manifest
===== AOSP SRC: /home/dev/redroid
===== AOSP TAG: android-11.0.0_r48

process project: ./external/minijail
Applying: disable seccomp
Checking patch libminijail.c...
Applied patch libminijail.c cleanly.

process project: ./external/selinux
Applying: ignore selinux
Checking patch libselinux/include/selinux/selinux.h...
Checking patch libselinux/src/android/android.c...
Checking patch libselinux/src/android/android_platform.c...
Checking patch libselinux/src/checkAccess.c...
Checking patch libselinux/src/getenforce.c...
Checking patch libselinux/src/getfilecon.c...
Checking patch libselinux/src/getpeercon.c...
Checking patch libselinux/src/init.c...
Checking patch libselinux/src/label.c...
Checking patch libselinux/src/lgetfilecon.c...
Checking patch libselinux/src/lsetfilecon.c...
Checking patch libselinux/src/procattr.c...
Checking patch libselinux/src/sestatus.c...
Applied patch libselinux/include/selinux/selinux.h cleanly.
Applied patch libselinux/src/android/android.c cleanly.
Applied patch libselinux/src/android/android_platform.c cleanly.
Applied patch libselinux/src/checkAccess.c cleanly.
Applied patch libselinux/src/getenforce.c cleanly.
Applied patch libselinux/src/getfilecon.c cleanly.
Applied patch libselinux/src/getpeercon.c cleanly.
Applied patch libselinux/src/init.c cleanly.
Applied patch libselinux/src/label.c cleanly.
Applied patch libselinux/src/lgetfilecon.c cleanly.
Applied patch libselinux/src/lsetfilecon.c cleanly.
Applied patch libselinux/src/procattr.c cleanly.
Applied patch libselinux/src/sestatus.c cleanly.

process project: ./frameworks/av
Applying: video playback workaround
Checking patch media/libstagefright/colorconversion/SoftwareRenderer.cpp...
Applied patch media/libstagefright/colorconversion/SoftwareRenderer.cpp cleanly.

process project: ./frameworks/base
Applying: fix booting
Checking patch packages/SystemUI/src/com/android/systemui/BatteryMeterView.java...
Applied patch packages/SystemUI/src/com/android/systemui/BatteryMeterView.java cleanly.
Applying: mocked WiFi
Checking patch core/java/android/net/ConnectivityManager.java...
Applied patch core/java/android/net/ConnectivityManager.java cleanly.

process project: ./frameworks/native
Applying: fix booting
Checking patch libs/binder/Binder.cpp...
Checking patch libs/binder/ProcessState.cpp...
Applied patch libs/binder/Binder.cpp cleanly.
Applied patch libs/binder/ProcessState.cpp cleanly.

process project: ./system/bpf
Applying: fix booting
Checking patch bpfloader/BpfLoader.cpp...
Applied patch bpfloader/BpfLoader.cpp cleanly.

process project: ./system/core
Applying: fix booting
Checking patch init/first_stage_init.cpp...
Checking patch init/service.cpp...
Checking patch init/util.cpp...
Checking patch rootdir/init.rc...
Applied patch init/first_stage_init.cpp cleanly.
Applied patch init/service.cpp cleanly.
Applied patch init/util.cpp cleanly.
Applied patch rootdir/init.rc cleanly.
Applying: allow override ro.* prop
Checking patch init/property_service.cpp...
Applied patch init/property_service.cpp cleanly.
Applying: ignore input subsystem
Checking patch rootdir/ueventd.rc...
Applied patch rootdir/ueventd.rc cleanly.
Applying: ignore devfs mount
Checking patch init/first_stage_init.cpp...
Applied patch init/first_stage_init.cpp cleanly.
Applying: auto alloc binder devices
Checking patch rootdir/init.rc...
Applied patch rootdir/init.rc cleanly.
Applying: mount cpuacct and cpu together
Checking patch libprocessgroup/setup/cgroup_map_write.cpp...
Applied patch libprocessgroup/setup/cgroup_map_write.cpp cleanly.
Applying: skip fusectl mount
Checking patch rootdir/init.rc...
Applied patch rootdir/init.rc cleanly.

process project: ./system/libhwbinder
Applying: fix booting
Checking patch Binder.cpp...
Checking patch ProcessState.cpp...
Applied patch Binder.cpp cleanly.
Applied patch ProcessState.cpp cleanly.

process project: ./system/libvintf
Applying: ignore compatibility check
Checking patch VintfObject.cpp...
Applied patch VintfObject.cpp cleanly.

process project: ./system/netd
Applying: ? fix networking
Checking patch server/IptablesRestoreController.cpp...
Checking patch server/TrafficController.cpp...
Applied patch server/IptablesRestoreController.cpp cleanly.
Applied patch server/TrafficController.cpp cleanly.

process project: ./system/vold
Applying: fix remote-android/redroid-doc#42 ignore project quota error
Checking patch Utils.cpp...
Applied patch Utils.cpp cleanly.

Anyway, thanks for your feedback! Feel free to close the PR if you believe it's not a major issue. It can still be a reference for anyone building redroid on Btrfs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants