云梦
www.htcp.net

[DEV]How to compile TWRP touch recovery 译文

All of TWRP 2.x source is public. You can compile it on your own. This guide isn’t going to be a step-by-step, word-for-word type of guide. If you’re not familiar with basic Linux commands and/or building in AOSP then you probably won’t be able to do this.

已经公布所有TWRP 2.x 版本的源码。您可以编译它到您的设备。此教程不是让你一步一步操作的。假如你不熟悉基本的Linux命令或如何建立AOSP项目可能你无法做下去。

You can currently use Omni 4.3, Omni 4.4, CM7, CM9, CM10.0, CM10.1, CM10.2, and CM11.0 source code. Omni 4.4 is recommended. CM9 and older will not be able to support SELinux for installing 4.4 ROMs.

目前,您可以使用 Omni 4.3、Omni 4.4、CM7、CM9、CM10.0、CM10.1、CM10.2和CM11.0源代码。但是建议使用Omni 4.4。CM9及以下版本不支持SELinux,所以不支持安装4.4.x及以上的ROM。

If you are using CM, you’ll need to replace CM/bootable/recovery with this:
https://github.com/omnirom/android_bootable_recovery
Select the newest branch available. This step is not necessary with Omni because Omni already includes TWRP source by default.

假如您正在使用CM,您需要将CM/bootable/recovery 替换为这里的源码:https://github.com/omnirom/android_bootable_recovery
选择最新的分支。假如你使用Omni 源码,就不需要这一步了,因为Omni已经默认包含了TWRP的源码。

*FOR CM7 ONLY*

仅适用于基于CM7源码的:

Replace the entire CM7/build folder with this:
https://github.com/Dees-Troy/TWRP2-CM7_build
Make sure that you get the twrp2.3 branch and *not* the master branch.

整个替换CM7/build 文件夹为这里的源码:https://github.com/Dees-Troy/TWRP2-CM7_build
一定要确保你使用的是twrp2.3的分支而不是master或者其他分支。

*BEFORE YOU COMPILE*

在编译之前的注意事项:

Note: If you add or change any flags, you will need to make clean or make clobber before recompiling or your flag changes will not be picked up.

假如您新增或者更改了任何标志,您在重新编译之前需要使用make clean或make clobber清空一下,这样您修改的内容才会生效。

Now that you have the source code, you’ll need to set or change a few build flags for your device(s). Find the BoardConfig.mk for your device. The BoardConfig.mk is in your devices/manufacturer/codename folder (e.g. devices/lge/hammerhead/BoardConfig.mk). First, scan the BoardConfig.mk file for
TARGET_RECOVERY_INITRC :=
If your device has this line, it will have a path to a custom, prebuilt init.rc that is used in recovery. Most likely you will need to change the custom init.rc slightly. Find the recovery’s init.rc file and open it. Near the top you will see something like this:
Code:
on init
export PATH /sbin
export LD_LIBRARY_PATH .:/sbin

现在您已经有了源码了,您需要设置或更改一下您的设备的构建标志。找一下您设备的BoardConfig.mk文件。BoardConfig.mk在 devices/厂商名/设备代号 文件夹下(例如nexus5的:devices/lge/hammerhead/BoardConfig.mk)。
首先,找一找BoardConfig.mk中有没有
TARGET_RECOVERY_INITRC :=
假如你的设备有这一行代码,就证明它一定有一个自定义路径,在recovery中使用预构建的init.rc引导文件。有可能您需要顺手改一下自定义init.rc。找一下recovery的init.rc并且打开它。在这个文件的开头,您会找到像这样的代码:

on init
export PATH /sbin
export LD_LIBRARY_PATH .:/sbin

Add the last line needed. This line is needed to get the linker running. Unlike ClockworkMod, TWRP is a dynamically linked recovery. Dynamic linking allows us to save a considerable amount of space to help make sure that TWRP recovery images will fit on more devices. It also lets us use dynamically linked touchscreen binaries as seen on the Motorola Photon and Atrix and the HP TouchPad without having to mount /system.

上述代码需要添加到最后一行。这一行需要linker的运行。不像ClockworkMod,TWRP使用的是动态链接的recovery。动态链接可以让我们节省大量的空间,以确保TWRP recovery镜像适配于更多的设备。它也能让我们使用动态链接链接到管触屏的二进制组件,例如Motorola Photon 和 Atrix 和 HP TouchPad,而无需挂载/system。

Your board config also needs to include architecture and platform settings. Usually these are already included if you’re using device configs that someone else created, but if you created your own, you may need to add them. Without them, recovery may seg fault during startup and you’ll just see the teamwin curtain flash on the screen over and over.

您的BoardConfig.mk也需要包含架构和平台设置。假如你使用别人建立好的设备配置,这些一般已经包含进去了。假如没有这些配置,recovery可能会在启动过程中发生故障,并且你只能看到teamwin标志一遍又一遍的闪,而不能正常启动。

We usually put all of our flags at the bottom of the BoardConfig.mk under a heading of #twrp For all devices you’ll need to set a resolution. TWRP needs to know the resolution at compile time so that it knows what stock theme to include. You can only use resolutions that have a theme so if you don’t see your resolution, you’ll have to pick one that’s less than or equal to your resolution. You can find the list of stock themes in bootable/recovery/gui/devices. So if your device has a 540×960 display, you would add this:
DEVICE_RESOLUTION := 540×960

我们通常将我们的标志放到 BoardConfig.mk 的底部,用#twrp注释作为标题,然后再设置所需设备的分辨率。TWRP在编译的时候,需要知道你设备的分辨率,这样它就可以确定需要包含哪个分辨率的默认主题。您只能使用一个分辨率的主题,假如你看不出您设备的分辨率,您就必须挑选一个小于等于您设备分辨率的主题。您可以在bootable/recovery/gui/devices目录下找到所有支持的分辨率的主题。假如您的设备使用的是540×960的分辨率,您需要在#twrp下添加一行如下代码:
DEVICE_RESOLUTION := 540x960

Note that themes do not rotate, so the 1280×800 theme is intended for tablets and would not work on the Samsung Galaxy Note that expects a 800×1280 type of theme.

请注意,主题是不支持旋转的,所以1280×800 的主题是为平板设计的,例如在三星galaxy note(800×1280分辨率)上是没法使用的。

In addition to the resolution, we have the following build flags:

除了分辨率以外,我们还有其他的一些构建标志:

RECOVERY_SDCARD_ON_DATA := true — this enables proper handling of /data/media on devices that have this folder for storage (most Honeycomb and devices that originally shipped with ICS like Galaxy Nexus)

RECOVERY_SDCARD_ON_DATA := true — 这样就可以处理有 /data/media 文件夹的存储设备(大多数Honeycomb 2.3和ICS 4.0都是用的这种,例如Galaxy Nexus)。

RECOVERY_GRAPHICS_USE_LINELENGTH := true — fixes slanty looking graphics on some devices

RECOVERY_GRAPHICS_USE_LINELENGTH := true — 修复在一些设备上生成图像发生错位的问题。

BOARD_HAS_NO_REAL_SDCARD := true — disables things like sdcard partitioning and may save you some space if TWRP isn’t fitting in your recovery patition

BOARD_HAS_NO_REAL_SDCARD := true — 假如TWRP没有装在您的recovery分区,禁用例如SD卡分区之类的东西,并且会为您节省一些空间。

TW_INCLUDE_DUMLOCK := true — includes HTC Dumlock for devices that need it

TW_INCLUDE_DUMLOCK := true — 一些HTC设备需要包含 HTC Dumlock。

This is how you would define dual storage for devices that have dual storage devices. For devices that have internal storage we usually define that as /emmc. Note that the mount point must match something in the recovery.fstab These flags are somewhat deprecated in TWRP 2.5+ but they are still used for a few things.

如下是在有双存储的设备上如何定义双存储。对于设备的内置存储,我们通常定义为/emmc。注意一些挂载点必须和 recovery.fstab 匹配。这些标志有些在 TWRP 2.5以上版本被废弃了,但是它仍然在一些情况下用的到。

TW_INTERNAL_STORAGE_PATH := "/data/media"
TW_INTERNAL_STORAGE_MOUNT_POINT := "data"
TW_EXTERNAL_STORAGE_PATH := "/sdcard"
TW_EXTERNAL_STORAGE_MOUNT_POINT := "sdcard"

TW_NO_BATT_PERCENT := true — disables the display of the battery percentage for devices that don’t support it properly

— 在不支持正确显示电量百分比的设备上禁止显示电量。

TW_CUSTOM_POWER_BUTTON := 107 — custom maps the power button for the lockscreen

— 为锁屏使用自定义电源按钮映射

TW_NO_REBOOT_BOOTLOADER := true — removes the reboot bootloader button from the reboot menu

— 从重启菜单中移除重启到bootloader选项。

TW_NO_REBOOT_RECOVERY := true — removes the reboot recovery button from the reboot menu

— 从重启菜单中移除重启到recovery选项。

TW_NO_USB_STORAGE := true — removes the USB storage button on devices that don’t support USB storage

— 在一些不支持USB存储上移除 USB 存储按钮。

RECOVERY_TOUCHSCREEN_SWAP_XY := true — swaps the mapping of touches between the X and Y axis

— 交换触摸屏X轴和Y轴之间的映射

RECOVERY_TOUCHSCREEN_FLIP_Y := true — flips y axis touchscreen values

— 翻转触屏Y轴的值

RECOVERY_TOUCHSCREEN_FLIP_X := true — flips x axis touchscreen values

— 翻转触屏X轴的值

TW_ALWAYS_RMRF := true — forces the rm -rf option to always be on (needed for some Motorola devices)

— 强制使用rm -rf命令(在一些Motorola设备上可能需要)

TW_NEVER_UNMOUNT_SYSTEM := true — never unmount system (needed for some Motorola devices)

— 永不解除挂载system分区(在一些Motorola设备上可能需要)

TW_INCLUDE_INJECTTWRP := true — adds ability to inject TWRP into some Samsung boot images for Samsung devices that have recovery as a second ramdisk in the boot image

— 为一些在boot镜像中包含recovery作为第二ramdisk的三星设备添加注入TWRP到boot镜像的功能。

TW_DEFAULT_EXTERNAL_STORAGE := true — defaults to external storage instead of internal on dual storage devices (largely deprecated)

— 默认存储为外置存储,而不是内置存储,用于在一些具有双存储的设备上(非常不推荐)。

TWRP_EVENT_LOGGING := true — enables touch event logging to help debug touchscreen issues (don’t leave this on for a release – it will fill up your logfile very quickly)

— 使用触摸时间日志记录,来帮助调试触摸问题(<???翻不出来> -它将会迅速的填满你的日志文件)

Here’s some flags that may help you, but are not specific to TWRP (works in CWM too):
This flag has multiple options, but can be used to set different graphics modes that may be need to correct color space issues on some devices:

如下标志可能会对你有所帮助。但是这些并不是TWRP特定的(同样可适用于CWM):
这个标志具有多个选项,但是可以用来在一些可能需要纠正色彩空间的设备上设置默认的图形模式。

TARGET_RECOVERY_PIXEL_FORMAT := "BGRA_8888"
TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"
TARGET_RECOVERY_PIXEL_FORMAT := "RGB_565"

BOARD_HAS_FLIPPED_SCREEN := true — flips the screen upside down for screens that were mounted upside-down

— 翻转屏幕,用于一些屏幕被反向安装的设备上。

TARGET_PREBUILT_RECOVERY_KERNEL := path/to/kernel — use to specify a kernel specifically for building recovery

TARGET_PREBUILT_RECOVERY_KERNEL := 路径名/内核文件夹名 — 使用特殊的内核来制作Recovery。

*RECOVERY.FSTAB*

关于recovery.fstab 分区表的注意事项

TWRP 2.5 and higher supports some new recovery.fstab features that you can use to extend TWRP’s backup/restore capabilities. You do not have to add fstab flags as most partitions are handled automatically.

TWRP 2.5及以上版本支持一些新的recovery.fstab 特性,用来扩展TWRP的备份/恢复功能。您不需要添加任何fstab标志,因为它们在大多数情况下会自动处理。

Note that TWRP does not currently support the “fstab 2” version of fstab files seen in 4.3 or higher. You will still need to use the “old” format of fstab for TWRP (example of that format is below). To maximize TWRP’s compatibility with your build tree, you can create a twrp.fstab and use PRODUCT_COPY_FILES to place the file in /etc/twrp.fstab When TWRP boots, if it finds a twrp.fstab in the ramdisk it will rename /etc/recovery.fstab to /etc/recovery.fstab.bak and then rename /etc/twrp.fstab to /etc/recovery.fstab. Effectively this will “replace” the fstab 2 file that your device files are providing with the TWRP fstab allowing you to maintain compatibility within your device files and with other recoveries.

请注意TWRP目前不支持在Android 4.3及以上使用“fstab 2”版本的fstab文件。所以您仍然需要使用“旧”格式的TWRP fstab文件(例如下面所说明的格式)。为了最大程度的让TWRP兼容您的构建树,您可以创建一个名为twrp.fstab文件,并使用PRODUCT_COPY_FILES来在放置此文件到/etc/twrp.fstab。当TWRP启动时,假如发现有twrp.fstab在ramdisk闪存盘中,TWRP会将/etc/recovery.fstab重命名为/etc/recovery.fstab.bak,然后再将/etc/twrp.fstab重命名为/etc/recovery.fstab。也就是这会“替换”fstab 2 文件,您的设备文件所提供给TWRP的fstab允许和您的设备文件、其他recovery保持兼容。

Code:

代码如下:

PRODUCT_COPY_FILES += device/lge/hammerhead/twrp.fstab:recovery/root/etc/twrp.fstab

The fstab in TWRP can contain some “flags” for each partition listed in the fstab.

在fstab所列出的每个分区中,可以包含一些“标志”。

Here’s a sample TWRP fstab for the Galaxy S4 that we will use for reference:

这里使用Galaxy S4的TWRP fstab样本,给大家作为参考:

Code:

代码如下:

/boot emmc /dev/block/platform/msm_sdcc.1/by-name/boot
/system ext4 /dev/block/platform/msm_sdcc.1/by-name/system
/data ext4 /dev/block/platform/msm_sdcc.1/by-name/userdata length=-16384
/cache ext4 /dev/block/platform/msm_sdcc.1/by-name/cache
/recovery emmc /dev/block/platform/msm_sdcc.1/by-name/recovery
/efs ext4 /dev/block/platform/msm_sdcc.1/by-name/efs flags=display="EFS";backup=1
/external_sd vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=display="Micro SDcard";storage;wipeingui;removable
/usb-otg vfat /dev/block/sda1 /dev/block/sda flags=display="USB-OTG";storage;wipeingui;removable
/preload ext4 /dev/block/platform/msm_sdcc.1/by-name/hidden flags=display="Preload";wipeingui;backup=1
/modem ext4 /dev/block/platform/msm_sdcc.1/by-name/apnhlos
/mdm emmc /dev/block/platform/msm_sdcc.1/by-name/mdm

Flags are added to the end of the partition listing in the fstab separated by white space (spaces or tabs are fine). The flags affect only that partition but not any of the others. Flags are separated by semicolons. If your display name is going to have a space, you must surround the display name with quotes.

标志被添加到fstab的分区列表的末尾,用空格隔开(空格或者制表符都可以)。每个分区的标志仅影响这个分区,对其他分区无影响,每个标志要用英文半角分号隔开。如果您的显示名中有个空格,您必须用英文半角引号将完整的显示名括起来。

Code:
代码如下:

/external_sd vfat /dev/block/mmcblk1p1 flags=display="Micro SDcard";storage;wipeingui;removable

The flags for this partition give it a display name of “Micro SDcard” which is displayed to the user. wipeingui makes this partition available for wiping in the advanced wipe menu. The removable flag indicates that sometimes this partition may not be present preventing mounting errors from being displayed during startup. Here is a full list of flags:

这个标志为上面这个分区赋予“Micro SDcard”的名称,wipeingui标志让此分区在高级擦除菜单中作为可以擦除的分区。removable 标志表示这个分区有时候可以不存在,防止在启动过程中显示挂载错误。如下为完整的标志列表:

removable — indicates that the partition may not be present preventing mounting errors from being displayed during boot

— 表示该分区可以不存在,防止在启动过程中显示挂载错误。

storage — indicates that the partition can be used as storage which makes the partition available as storage for backup, restore, zip installs, etc.

— 表示该分区可以用做存储,使分区可以用于备份、恢复、安装ROM等等。

settingsstorage — only one partition should be set as settings storage, this partition is used as the location for storing TWRP’s settings file

— 仅一个分区应设置为存储,此分区被用作存储位置,存储TWRP的设置文件。

canbewiped — indicates that the partition can be wiped by the back-end system, but may not be listed in the GUI for wiping by the user

— 表示该分区可以被系统后台擦除,但可能不会在用户界面中罗列出来让用户来手动擦除。

userrmrf — overrides the normal format type of wiping and only allows the partition to be wiped using the rm -rf command

— 覆盖正常的擦除类型,仅允许使用rm -rf命令来擦除分区。

backup= — must be succeeded by the equals sign, so backup=1 or backup=0, 1 indicates that the partition can be listed in the backup/restore list while 0 ensures that this partition will not show up in the backup list.

— 后面必须有等号来承继,例如backup=1或backup=0,1表明分区可以在 备份/恢复 列表中罗列,0表明确保这个分区不在备份列表中罗列。

wipeingui — makes the partition show up in the GUI to allow the user to select it for wiping in the advanced wipe menu

— 让此分区显示在高级擦除菜单中,允许用户选择它来手动擦除。

wipeduringfactoryreset — the partition will be wiped during a factory reset

— 当使用恢复出厂时这个分区会被擦除。

ignoreblkid — blkid is used to determine what file system is in use by TWRP, this flag will cause TWRP to skip/ignore the results of blkid and use the file system specified in the fstab only

— blkid用于确定在TWRP中使用什么文件系统,该标志会使得TWRP 跳过/忽略blkid的结果,并仅使用在fstab中指定的文件系统。

retainlayoutversion — causes TWRP to retain the .layoutversion file in /data on devices like Sony Xperia S which sort of uses /data/media but still has a separate /sdcard partition

— 让 TWRP 保留.layoutversion文件在 /data 目录中,像索尼Xperia S使用 /data/meida但仍然有一个单独的 /sdcard 分区。

symlink= — causes TWRP to run an additional mount command when mounting the partition, generally used with /data/media to create /sdcard

— 让TWRP挂载分区时运行一个额外挂载命令,通常用于在 /data/media 中来创建/sdcard。

display= — sets a display name for the partition for listing in the GUI

— 为分区设置在用户界面中显示的名称

storagename= — sets a storage name for the partition for listing in the GUI storage list

— 在存储列表界面中设置一个分区的存储名称

backupname= — sets a backup name for the partition for listing in the GUI backup/restore list

— 在备份/还原列表界面中设置一个分区的备份名称

length= — usually used to reserve empty space at the end of the /data partition for storing the decryption key when Android’s full device encryption is present, not setting this may lead to the inability to encrypt the device

— 通常用于当Android存在全设备加密时,在 /data 分区末尾为存储解密密钥保留空的空间。

canencryptbackup= — 1 or 0 to enable/disable, makes TWRP encrypt the backup of this partition if the user chooses encryption (only applies to tar backups, not images)

— 使用1或0值来启用/禁用,假如用户选择加密时,让TWRP可以加密此分区的备份。

userdataencryptbackup= — 1 or 0 to enable/disable, makes TWRP encrypt only the userdata portion of this partition, certain subfuldes like /data/app would not be encrypted to save time

— 使用1或0值来启用/禁用,使TWRP仅加密用户数据的部分,例如 /data/app 等将不被加密,以节省时间。

subpartitionof= — must be succeeded by the equals sign and the path of the partition it is a subpartition of. A subpartition is treated as “part” of the main partition so for instance, TWRP automatically makes /datadata a subpartition of /data. This means that /datadata will not show up in the GUI listings, but /datadata would be wiped, backed up, restored, mounted, and unmounted anytime those operations are performed on /data. A good example of the use of subpartitions is the 3x efs partitions on the LG Optimus G:

— 必须后面有等于号和子分区的路径名承继。子分区被视为主分区的一部分,例如TWRP自动使/datadata作为 /data 分区的子分区。这意味着/datadata将不会显示在界面列表中,但是/datadata被擦除、备份、还原、挂载、解除挂载,任何时间这些操作都会在/data执行。一个很好的使用子分区的例子是在LG Optimus G上使用了3个efs分区:

Code:
代码如下:

/efs1 emmc /dev/block/mmcblk0p12 flags=backup=1;display=EFS
/efs2 emmc /dev/block/mmcblk0p13 flags=backup=1;subpartitionof=/efs1
/efs3 emmc /dev/block/mmcblk0p14 flags=backup=1;subpartitionof=/efs1

If you have questions, feel free to stop by #twrp on Freenode. If you post here I may not see it for a while as I have lots of threads out there and there’s no way for me to keep track of them all. If you successfully port TWRP to a new device, please let us know! We love to hear success stories!

如果您有任何疑问,可随时在Feenode上通过#twrp来询问。如果您在这里回复,我可能看不到,因为我有很多的帖子,我没有办法跟踪他们的全部动态。假如您成功了设配TWRP到一个新的设备,请告诉我!我喜欢听到您成功的消息!

If you have code changes that you’d like to submit, please submit them through the Omni Gerrit server. Guide is here.

如果您修改了代码,想要提交,请将它们提交到Omni 的Gerrit服务器上。教程:teamw.in/twrp2-gerrit

Once you get Omni or CM sync’ed and your TWRP flags set, you should do a source ./build/envsetup.sh We usually lunch for the device in question, so something like “lunch omni_hammerhead-eng”.

一旦您同步完Omni或者CM的源码,并且已经设置好了TWRP标志,您应该先执行 source ./buidl/envsetup.sh。我们通常使用lunch命令来配置设备,例如像nexus5应执行lunch omni_hammerhead-eng命令。

After you lunch successfully for your device this is the command used for most devices:

当您成功的lunch好您的设备,这是用于大多数设备的命令:

Code:
代码如下:


make clean && make -j# recoveryimage

Replace the # with the core count +1, so if you have a dual core it’s -j3 and a quad core becomes -j5, etc. If you’re dealing with a “typical” Samsung device, then you’ll need to

替换#号为您的CPU的核心数并加上1,假如您有一个双核的CPU,它应该是 -j3,假如您有一个4核的CPU,它应该为 -j5,以此类推。假如您正在处理一个“典型的”三星设备,那么您可能需要:

Code:

代码如下:


make -j# bootimage

Most Samsung devices have the recovery included as an extra ramdisk in the boot image instead of a separate recovery partition as found on most other devices.

大多数三星设备都包含一个recovery的额外的ramdisk闪存盘在boot镜像中,而不是像大多数设备那样将recovery作为一个单独的分区。

Notes about 4.4 Kit Kat ROMs and SELinux

关于 4.4 KitKat 固件和 SELinux的一些注意事项

There’s absolutely no SELinux support in ICS trees or older. libselinux is not included in these trees and some dependencies for libselinux don’t exist elsewhere in these older trees so there’s no way to get SELinux support unless you move to a newer tree. I recommend using a 4.3 based tree or higher.

ICS及以下的树绝对不支持的SELinux。libselinux不包含这些树,一些libselinux的依赖在老的树上不存在。所以没有办法获得SELinux的支持,除非您将其移动到新的树上。我建议大家使用基于Android 4.3或更高的树。

SELinux support is included in all builds of TWRP so long as you build in a tree that has libselinux present. However, for SELinux support to work, your kernel must support EXT4 security labels as well. If you’re using an older kernel, your TWRP won’t support SELinux and you will get errors when installing 4.4 Kit Kat ROMs due to set_metadata not being able to set SELinux contexts. You’ll see an error in the recovery log stating something along the lines of “Operation not supported on transport endpoint.” This means you need to add proper support to the kernel you are using in recovery. (Yes, at least in most cases, recovery has its own kernel.)

SELinux支持构建所有版本的TWRP,只要您在具有libselinux的树上建立即可。然而,为了让SELinux能够正常工作,您的内核必须支持EXT4安全标签才行。如果您使用老的内核,您的TWRP将不支持SELinux,由于set_metadata不能设置SELinux 环境,您在安装4.4 KitKat 固件时,会报错。您将会在recovery的日志中看到一行:“Operation not supported on transport endpoint.”的报错。这意味着您需要为正在使用的内核添加一些适当的支持(没错,在大多数情况下,recovery都具有自己的内核)。

In the kernel source I was testing, the needed flag was CONFIG_EXT4_FS_SECURITY=y and the option was called Ext4 Security Labels under the file systems menu. If you want full SELinux in your kernel you will need to add auditing support (usually found under general setup) then enable SELinux under security options. There’s multiple flags and some dependencies involved so your setup may vary slightly.

我尝试在内核源码上,需要添加 CONFIG_EXT4_FS_SECURITY=y 标志,此选项将会在文件系统菜单调用 Ext4 安全标签。如果您想您的内核支持完整的SELinux,您需要添加审核支持(通常在常规设置中找到)。然后在安全选项下启用SELinux。这里有很多标志,并且涉及一些依赖。所以您的设置可能会有所不同。

The android-4.4 branch of TWRP from Omni now includes a check during boot. You will see text in the log and in the console indicating the SELinux status. This should help you identify what issue(s) you may have with SELinux support.

Omni TWRP中的android-4.4 分支包含启动检查,您将会在文本日志和控制台中显示SELinux的状态。这也许可以帮助你验证关于SELinux支持出现的问题。

Deprecated build flags:

废弃的构建标志:

For TWRP < 2.5:

适用于TWRP 2.5版本以下:

The below is how you can add custom / special partitions to the list of partitions available for backup. The SP1_NAME must match the name of a partition defined in recovery.fstab. The SP1_DISPLAY_NAME is the name displayed on the backup page if it needs to be different than SP1_NAME. SP1_BACKUP_METHOD defines how the partition should be backed up (files or image). And SP1_MOUNTABLE determines if the partition can be mounted.

下面是介绍您如何添加用在备份分区列表的自定义/特殊分区。SP1_NAME必须和recovery.fstab中定义的分区名称相匹配。假如您需要和SP1_NAME 显示的名称不同,SP1_DISPLAY_NAME则是在备份页面上显示的名称。SP1_BACKUP_METHOD 定义了分区该如何备份(file或image)。SP1_MOUNTABLE 决定了一个分区是否可被挂载。

SP1_NAME := "pds"
SP1_BACKUP_METHOD := files
SP1_MOUNTABLE := 1
SP2_NAME := "osh"
SP2_DISPLAY_NAME := "Webtop"
SP2_BACKUP_METHOD := files
SP2_MOUNTABLE := 1
SP3_NAME := "preinstall"
SP3_BACKUP_METHOD := image
SP3_MOUNTABLE := 0
赞(1) 打赏
文章通过 CC 4.0 BY-NC-ND 协议发布,转载请注明出处:云梦 » [DEV]How to compile TWRP touch recovery 译文

评论 4

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #4

    尘封是否能做个适配NOTE4的TWRP v3.0啊?国行机用不了官方的版本。

    如风清扬3年前 (2016-02-14)回复
  2. #3

    签到成功!签到时间:2015-10-26 19:06:16,每日打卡,生活更精彩哦~

    by3年前 (2015-10-26)回复
  3. #2

    支持

    by3年前 (2015-10-26)回复
  4. #1

    支持

    莫沉4年前 (2014-12-11)回复

如果您觉得文章有用,可以支持一下本站

支付宝扫一扫打赏

QQ 扫一扫打赏