How to Enable SELinux Mode in OpenHarmony? RK3566 Development Board Demonstration

How to Enable SELinux Mode in OpenHarmony? RK3566 Development Board Demonstration

This article introduces how to enable/disable SELinux permissions in the open-source OpenHarmony system,demonstrated on the Tactile Intelligence Purple Pi OH development board, which is equipped with the Rockchip RK3566 chip, designed like a Raspberry Pi, recommended by the Laval official community, and has adapted to the new OpenHarmony 5.0 Release system!

How to Enable SELinux Mode in OpenHarmony? RK3566 Development Board Demonstration
How to Enable SELinux Mode in OpenHarmony? RK3566 Development Board Demonstration

SELinux Permission Status

SELinux has a total of 3 states: Enforcing, Permissive, and Disabled.

Enforcing: Mandatory mode, actions violating SELinux rules will be blocked and logged.

Permissive: Tolerant mode, actions violating SELinux rules will only be logged, generally for debugging.

Disabled: SELinux permissions are turned off.

To check SELinux permissions, use the command below:

C:\\Users\\industio>hdc shell//Check SELinux permissions status# getenforce//In this state, SELinux permissions are enabled in Enforcing mode
How to Enable SELinux Mode in OpenHarmony? RK3566 Development Board Demonstration

How to Enable SELinux Mode in OpenHarmony? RK3566 Development Board Demonstration

How to Enable SELinux Mode in OpenHarmony? RK3566 Development Board Demonstration
Temporarily Modify SELinux Permissions
To temporarily disable SELinux permissions, use the command below:
//Temporarily disable SELinux permissions# setenforce 0# getenforcePermissive
How to Enable SELinux Mode in OpenHarmony? RK3566 Development Board Demonstration
Note: Doing this will temporarily disable SELinux permissions, but this method will be ineffective after system reboot. Below shows how to permanently modify SELinux permissions.
How to Enable SELinux Mode in OpenHarmony? RK3566 Development Board DemonstrationHow to Enable SELinux Mode in OpenHarmony? RK3566 Development Board DemonstrationPermanent Enable and Disable SELinux Permissions
  • Method 1

The path of the SELinux config file in the OpenHarmony system is

system/etc/selinux/config, as shown in the figure below:
How to Enable SELinux Mode in OpenHarmony? RK3566 Development Board Demonstration

Use the hdc command to drag the file to your local machine, the command is as follows:

C:\\Users\\industio>hdc shell mount -o remount,rw /C:\\Users\\industio>hdc file recv system/etc/selinux/config "local path"

After modifying the SELinux permission status in the local config file, push the file back to the system

C:\\Users\\industio>hdc file send "local path" system/etc/selinux/FileTransfer finish, Size:624, File count = 1, time:30ms rate:20.80kB/s
Note: This way the SELinux permissions will be permanently modified, and the permission status will not change after rebooting the system, but this method will still be ineffective if the firmware is re-burned.
  • Method 2

Modify the SELinux permission path in the SDK:

/base/security/selinux_adapter/selinux.gni , as shown in the figure below:
How to Enable SELinux Mode in OpenHarmony? RK3566 Development Board Demonstration

The command is as follows:

declare_args() {//Modify permissions as needed, currently in enabled state. Change true to false to disable selinux_enforce = true }

After modifying, save and exit, and recompile the entire SDK.

How to Enable SELinux Mode in OpenHarmony? RK3566 Development Board DemonstrationHow to Enable SELinux Mode in OpenHarmony? RK3566 Development Board Demonstration
Product Purchase
As a leader in open-source OpenHarmony hardware solutions, Tactile Intelligence adheres to the spirit of open-source co-creation, the Purple Pi OH development board source code is fully open, continuously bringing various technical shares to everyone, and the products have the following advantages:
  • Supports OpenHarmony/Android/Linux
    multiple operating systems, compatible with Raspberry Pi pin headers;
  • Rockchip RK3566 chip, quad-core A55 processor,
    1.8GHz frequency, Mali G52-2EE GPU;
  • Supports OpenGL/CL/Vulkan, 8M ISP;
  • 1T computing power NPU, supports TensorFlow/Caffe/
    MXNet/PyTorch and other deep learning frameworks;
  • Supports 1 x Gigabit Ethernet, 3 x USB2.0
    1 x USB3.0, 3 x UART, 2 x SPI
    2 x I2C, 28 x GPIO, 1 x MIPI DSI
    1 x MIPI CSI, 1 x HDMI;
  • First to support OpenHarmony 5.0/4.1/4.0/
    3.2, open SDK source code, 3D printed shell;
  • Active developer community, more experts online for interaction
    and technical support;
  • Super small size, extreme cost performance, only 249 yuan;
Taobao purchase link:https://item.taobao.com/item.htm?ft=t&id=712926836474
Product introduction video
END
How to Enable SELinux Mode in OpenHarmony? RK3566 Development Board Demonstration

Leave a Comment

Your email address will not be published. Required fields are marked *