Skip to contentSkip to conversation

refpolicy: new package

PATCH New Adam Duskett 3 participants 9 messages May 20, 2017 – Jun 6, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/3 refpolicy: new package

The patch is for adding selinux reference policy (refpolicy). It is a complete SELinux policy that can be used as the system policy for a variety of systems and used as the basis for creating other policies.

---
Changes v3 -> v4:
- Split the REFPOLICY_MAKE define into several lines for formatting cleanliness.
- Added TEST_TOOLCHAIN=$(HOST_DIR) to the REFPOLICY_MAKE define. This fixes repfolicy from attempting to use selinux tools on the host machine. Line 49 of the Makefile shows that userbindir, usersbindir, and sbin dir are set when the TEST_TOOLCHAIN variable is passed to the Makefile. TEST_TOOLCHAIN in this instance looks to match up properly with the HOST_DIR, so pass HOST_DIR as TEST_TOOLCHAIN. This fix has been tested with Debian 8 sid without SELinux installed.
- Removed Coverletter from patch set.

Changes v2 -> v3:
- Removed 0001-fc_sort-use-CFLAGS_FOR_BUILD.patch as this causes compilation problems in the newer refpolicy and doesn't seem to be needed anymore.

Changes v1 -> v2:
- Added cover letter explaining the new patch set.
- Added 0001-fc_sort-use-CFLAGS_FOR_BUILD.patch from previous patch set.
- Readded dependencies from Bryce Ferguson's patch set.
- Readded comment in refpolicy.mk explaining why git submodules is needed.

 package/Config.in                |  1 +
 package/refpolicy/Config.in      | 37 ++++++++++++++++++++++++++++
 package/refpolicy/refpolicy.hash |  2 ++
 package/refpolicy/refpolicy.mk   | 53 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 93 insertions(+)
 create mode 100644 package/refpolicy/Config.in
 create mode 100644 package/refpolicy/refpolicy.hash
 create mode 100644 package/refpolicy/refpolicy.mk
package/Config.in +1 -0
index 7991353..5e2fa8d 100644
@@ -1757,6 +1757,7 @@ endmenu
 menu "Security"
 	source "package/checkpolicy/Config.in"
 	source "package/policycoreutils/Config.in"
+	source "package/refpolicy/Config.in"
 	source "package/sepolgen/Config.in"
 	source "package/setools/Config.in"
 endmenu
package/refpolicy/Config.in new file +37 -0
new file mode 100644
index 0000000..a937055
@@ -0,0 +1,37 @@
+config BR2_PACKAGE_REFPOLICY
+	bool "refpolicy"
+	depends on BR2_TOOLCHAIN_HAS_THREADS # policycoreutils
+	depends on BR2_TOOLCHAIN_USES_GLIBC # policycoreutils
+	depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS # libsemanage
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libsemanage
+	depends on BR2_TOOLCHAIN_USES_GLIBC # libsemanage
+	depends on !BR2_STATIC_LIBS #libsemanage
+	depends on !BR2_arc # libsemanage
+	select BR2_PACKAGE_POLICYCOREUTILS
+	select BR2_PACKAGE_BUSYBOX_SELINUX if BR2_PACKAGE_BUSYBOX
+	help
+	  The SELinux Reference Policy project (refpolicy) is a
+	  complete SELinux policy that can be used as the system
+	  policy for a variety of systems and used as the basis
+	  for creating other policies. Reference Policy was originally
+	  based on the NSA example policy, but aims to accomplish
+	  many additional goals.
+
+	  The current refpolicy does not fully support Buildroot
+	  and needs modifications to work with the default system
+	  file layout. These changes should be added as patches to
+	  the refpolicy that modify a single SELinux policy.
+
+	  The refpolicy works for the most part in permissive mode. Only
+	  the basic set of utilities are enabled in the example policy
+	  config and some of the pathing in the policies is not correct.
+	  Individual policies would need to be tweaked to get everything
+	  functioning properly.
+
+	  https://github.com/TresysTechnology/refpolicy
+
+comment "refpolicy needs a glibc toolchain w/ threads, dynamic library"
+	depends on !BR2_arc
+	depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS
+	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || \
+		!BR2_TOOLCHAIN_USES_GLIBC
package/refpolicy/refpolicy.hash new file +2 -0
new file mode 100644
index 0000000..7aeac41
@@ -0,0 +1,2 @@
+#From https://github.com/TresysTechnology/refpolicy/wiki/DownloadRelease
+sha256 08f9e2afc5e4939c23e56deeec7c47da029d7b85d82fb4ded01a36eb5da0651e  refpolicy-RELEASE_2_20170204.tar.gz
package/refpolicy/refpolicy.mk new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.9.3
#1 lore raw

PATCH v4 2/3 refpolicy add ability to specify policy version

Refpolicy by default will build the highest version supported. This may cause older kernels to not load the policy.

This patch adds a custom policy version string which is defaulted to 30, which is the highest supported as of today.

---
Changes v2 -> v3:
- Removed Coverletter from patch set.

Changes v1 -> v2:
- Added cover letter explaining the new patch set.

 package/refpolicy/Config.in    | 8 ++++++++
 package/refpolicy/refpolicy.mk | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
package/refpolicy/Config.in +8 -0
index a937055..9d4e0e6 100644
@@ -35,3 +35,11 @@ comment "refpolicy needs a glibc toolchain w/ threads, dynamic library"
 	depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS
 	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || \
 		!BR2_TOOLCHAIN_USES_GLIBC
+
+if BR2_PACKAGE_REFPOLICY
+
+config BR2_PACKAGE_REFPOLICY_VERSION
+	string "Policy version"
+	default "30"
+
+endif
package/refpolicy/refpolicy.mk +1 -1
index 117e570..fa02b5a 100644
@@ -32,7 +32,7 @@ REFPOLICY_MAKE = \
 	$(MAKE1)
 
 define REFPOLICY_CONFIGURE_CMDS
-	$(SED) "/OUTPUT_POLICY/c\OUTPUT_POLICY = 30" $(@D)/build.conf
+	$(SED) "/OUTPUT_POLICY/c\OUTPUT_POLICY = $(BR2_PACKAGE_REFPOLICY_VERSION)" $(@D)/build.conf
 	$(SED) "/MONOLITHIC/c\MONOLITHIC = y" $(@D)/build.conf
 	$(SED) "/NAME/c\NAME = targeted" $(@D)/build.conf
 endef
Signature · 1 line
2.9.3
#2 lore raw

PATCH v4 2/3 refpolicy add ability to specify policy version

Adam,

Quoted 7 lines · Adam Duskett

Refpolicy by default will build the highest version supported. This may cause older kernels to not load the policy.

This patch adds a custom policy version string which is defaulted to 30, which is the highest supported as of today.

Quoted 47 lines

---
Changes v2 -> v3:
- Removed Coverletter from patch set.

Changes v1 -> v2:
- Added cover letter explaining the new patch set.

 package/refpolicy/Config.in    | 8 ++++++++
 package/refpolicy/refpolicy.mk | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)
package/refpolicy/Config.in +8 -0
index a937055..9d4e0e6 100644
@@ -35,3 +35,11 @@ comment "refpolicy needs a glibc toolchain w/ threads, dynamic library"
        depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS
        depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || \
                !BR2_TOOLCHAIN_USES_GLIBC
+
+if BR2_PACKAGE_REFPOLICY
+
+config BR2_PACKAGE_REFPOLICY_VERSION
+       string "Policy version"
+       default "30"
+
+endif
package/refpolicy/refpolicy.mk +1 -2
index 117e570..fa02b5a 100644
@@ -32,7 +32,7 @@ REFPOLICY_MAKE = \
        $(MAKE1)
 
 define REFPOLICY_CONFIGURE_CMDS
-       $(SED) "/OUTPUT_POLICY/c\OUTPUT_POLICY = 30" $(@D)/build.conf
+       $(SED) "/OUTPUT_POLICY/c\OUTPUT_POLICY = $(BR2_PACKAGE_REFPOLICY_VERSION)" $(@D)/build.conf
        $(SED) "/MONOLITHIC/c\MONOLITHIC = y" $(@D)/build.conf
        $(SED) "/NAME/c\NAME = targeted" $(@D)/build.conf
 endef
--

2.9.3

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 8 lines
Matthew L Weber / Pr Software Engineer
Airborne Information Systems / Security Systems and Software / Secure Platforms
MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA
www.rockwellcollins.com

Note: Any Export License Required Information and License Restricted
Third Party Intellectual Property (TPIP) content must be encrypted and
sent to matthew.weber at corp.rockwellcollins.com.
#3 lore raw

PATCH v4 2/3 refpolicy add ability to specify policy version

In reply to Adam Duskett

Hello,

Quoted 7 lines · Adam Duskett

Refpolicy by default will build the highest version supported. This may cause older kernels to not load the policy.

This patch adds a custom policy version string which is defaulted to 30, which is the highest supported as of today.

I've applied, after doing some minor changes. See below.

Quoted 1 line

+config BR2_PACKAGE_REFPOLICY_VERSION

I've renamed this option to:

BR2_PACKAGE_REFPOLICY_POLICY_VERSION

see below why.

Quoted 9 lines
package/refpolicy/Config.in +4 -0
+	string "Policy version"
+	default "30"
+
+endif
package/refpolicy/refpolicy.mk +0 -0
index 117e570..fa02b5a 100644

package/refpolicy/refpolicy.mk REFPOLICY_MAKE = \ · line 35

Quoted 5 lines
package/refpolicy/refpolicy.mk +1 -1
@@ -32,7 +32,7 @@ REFPOLICY_MAKE = \
 	$(MAKE1)
 
 define REFPOLICY_CONFIGURE_CMDS
-	$(SED) "/OUTPUT_POLICY/c\OUTPUT_POLICY = 30" $(@D)/build.conf
+	$(SED) "/OUTPUT_POLICY/c\OUTPUT_POLICY = $(BR2_PACKAGE_REFPOLICY_VERSION)" $(@D)/build.conf

This adds some double quotes which were not present before. And we normally qstrip string Config.in options in Buildroot.

If I had kept your original Config.in option name, it would have given

REFPOLICY_VERSION = $(call qstrip,$(BR2_PACKAGE_REFPOLICY_VERSION))

except that REFPOLICY_VERSION would override the version of the package.

So I've changed the code to:

+REFPOLICY_POLICY_VERSION = \
+ $(call qstrip,$(BR2_PACKAGE_REFPOLICY_POLICY_VERSION))
+
define REFPOLICY_CONFIGURE_CMDS
- $(SED) "/OUTPUT_POLICY/c\OUTPUT_POLICY = 30" $(@D)/build.conf
+ $(SED) "/OUTPUT_POLICY/c\OUTPUT_POLICY = $(REFPOLICY_POLICY_VERSION)" \
+ $(@D)/build.conf

        $(SED) "/MONOLITHIC/c\MONOLITHIC = y" $(@D)/build.conf
        $(SED) "/NAME/c\NAME = targeted" $(@D)/build.conf

endef

Please check that everything still works fine for you.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#4 lore raw

PATCH v4 3/3 refpolicy: add ability to set default state.

In reply to Adam Duskett

SELinux requires a config file in /etc/selinux which controls the state of SELinux on the system.

This config file has two options set in it:
SELINUX which set's the state of selinux on boot.
SELINUXTYPE which should equal the name of the policy. In this case, the default name is targeted.

This patch adds:
- A choice menu on Config.in that allows the user to select a default SELinux state.

- A basic config file that will be installed to target/etc/selinux and will set SELINUX= to the selected state.

---
Changes v3 -> v4:
- Removed a trailing newline in refpolicy/config
- Removed Coverletter from patch set.

Changes v2 -> v3:
- No changes.

Changes v1 -> v2:
- Added cover letter explaining the new patch set.

 package/refpolicy/Config.in    | 26 ++++++++++++++++++++++++++
 package/refpolicy/config       |  8 ++++++++
 package/refpolicy/refpolicy.mk |  6 ++++++
 3 files changed, 40 insertions(+)
 create mode 100644 package/refpolicy/config
package/refpolicy/Config.in +26 -0
index 9d4e0e6..3eb2a7f 100644
@@ -42,4 +42,30 @@ config BR2_PACKAGE_REFPOLICY_VERSION
 	string "Policy version"
 	default "30"
 
+choice
+	prompt "SELinux default state"
+	default BR2_PACKAGE_REFPOLICY_STATE_PERMISSIVE
+
+config BR2_PACKAGE_REFPOLICY_STATE_ENFORCING
+	bool "Enforcing"
+	help
+	  SELinux security policy is enforced
+
+config BR2_PACKAGE_REFPOLICY_STATE_PERMISSIVE
+	bool "Permissive"
+	help
+	  SELinux prints warnings instead of enforcing
+
+config BR2_PACKAGE_REFPOLICY_STATE_DISABLED
+	bool "Disabled"
+	help
+	  No SELinux policy is loaded
+endchoice
+
+config BR2_PACKAGE_REFPOLICY_STATE
+	string
+	default "permissive" if BR2_PACKAGE_REFPOLICY_STATE_PERMISSIVE
+	default "enforcing" if BR2_PACKAGE_REFPOLICY_STATE_ENFORCING
+	default "disabled" if BR2_PACKAGE_REFPOLICY_STATE_DISABLED
+
 endif
package/refpolicy/config new file +8 -0
new file mode 100644
index 0000000..087297c
@@ -0,0 +1,8 @@
+# This file controls the state of SELinux on the system.
+# SELINUX= can take one of these three values:
+#     enforcing - SELinux security policy is enforced.
+#     permissive - SELinux prints warnings instead of enforcing.
+#     disabled - No SELinux policy is loaded.
+SELINUX=disabled
+
+SELINUXTYPE=targeted
package/refpolicy/refpolicy.mk +6 -0
index fa02b5a..94a0cf8 100644
@@ -23,6 +23,7 @@ REFPOLICY_DEPENDENCIES += \
 	policycoreutils
 
 REFPOLICY_PYINC = -I$(HOST_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)/site-packages
+REFPOLICY_NAME = "targeted"
 
 # Cannot use multiple threads to build the reference policy
 REFPOLICY_MAKE = \
@@ -48,6 +49,11 @@ endef
 
 define REFPOLICY_INSTALL_TARGET_CMDS
 	$(REFPOLICY_MAKE) -C $(@D) install DESTDIR=$(TARGET_DIR)
+	$(INSTALL) -m 0755 -D package/refpolicy/config \
+		$(TARGET_DIR)/etc/selinux/config
+
+	$(SED) "/^SELINUX=/c\SELINUX=$(BR2_PACKAGE_REFPOLICY_STATE)" \
+		$(TARGET_DIR)/etc/selinux/config
 endef
 
 $(eval $(generic-package))
Signature · 1 line
2.9.3
#5 lore raw

PATCH v4 3/3 refpolicy: add ability to set default state.

Adam,

Quoted 8 lines · Adam Duskett

SELinux requires a config file in /etc/selinux which controls the state of SELinux on the system.

This config file has two options set in it:
SELINUX which set's the state of selinux on boot.
SELINUXTYPE which should equal the name of the policy. In this case, the default name is targeted.

Quoted 8 lines

This patch adds:
- A choice menu on Config.in that allows the user to select a default SELinux state.

- A basic config file that will be installed to target/etc/selinux and will set SELINUX= to the selected state.

#6 lore raw

PATCH v4 3/3 refpolicy: add ability to set default state.

In reply to Adam Duskett

Hello,

Quoted 8 lines · Adam Duskett

SELinux requires a config file in /etc/selinux which controls the state of SELinux on the system.

This config file has two options set in it:
SELINUX which set's the state of selinux on boot.
SELINUXTYPE which should equal the name of the policy. In this case, the default name is targeted.

Quoted 8 lines

This patch adds:
- A choice menu on Config.in that allows the user to select a default SELinux state.

- A basic config file that will be installed to target/etc/selinux and will set SELINUX= to the selected state.

I've applied, after doing a few changes as well.

Quoted 15 lines
(quoted diff) +15 -0
+choice
+	prompt "SELinux default state"
+	default BR2_PACKAGE_REFPOLICY_STATE_PERMISSIVE
+
+config BR2_PACKAGE_REFPOLICY_STATE_ENFORCING
+	bool "Enforcing"
+	help
+	  SELinux security policy is enforced
+
+config BR2_PACKAGE_REFPOLICY_STATE_PERMISSIVE
+	bool "Permissive"
+	help
+	  SELinux prints warnings instead of enforcing
+
+config BR2_PACKAGE_REFPOLICY_STATE_DISABLED

Review

Quoted 10 lines
(quoted diff) +10 -0
+	bool "Disabled"
+	help
+	  No SELinux policy is loaded
+endchoice
+
+config BR2_PACKAGE_REFPOLICY_STATE
+	string
+	default "permissive" if BR2_PACKAGE_REFPOLICY_STATE_PERMISSIVE
+	default "enforcing" if BR2_PACKAGE_REFPOLICY_STATE_ENFORCING
+	default "disabled" if BR2_PACKAGE_REFPOLICY_STATE_DISABLED

To be consistent with the other option, I've renamed all options to BR2_PACKAGE_REFPOLICY_POLICY_STATE_xyz.

Quoted 2 lines

REFPOLICY_PYINC = -I$(HOST_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)/site-packages
+REFPOLICY_NAME = "targeted"

This variable is unused, so I dropped it.

Review

Quoted 7 lines

define REFPOLICY_INSTALL_TARGET_CMDS

(quoted diff) +5 -0
 	$(REFPOLICY_MAKE) -C $(@D) install DESTDIR=$(TARGET_DIR)
+	$(INSTALL) -m 0755 -D package/refpolicy/config \
+		$(TARGET_DIR)/etc/selinux/config
+
+	$(SED) "/^SELINUX=/c\SELINUX=$(BR2_PACKAGE_REFPOLICY_STATE)" \
+		$(TARGET_DIR)/etc/selinux/config

And I've added a qstripped version this variable. So the code looks like this:

package/refpolicy/refpolicy.mk +6 -0
index 4d85ee5..aab1877 100644
@@ -31,6 +31,8 @@ REFPOLICY_MAKE = \
 
 REFPOLICY_POLICY_VERSION = \
        $(call qstrip,$(BR2_PACKAGE_REFPOLICY_POLICY_VERSION))
+REFPOLICY_POLICY_STATE = \
+       $(call qstrip,$(BR2_PACKAGE_REFPOLICY_POLICY_STATE))
 
 define REFPOLICY_CONFIGURE_CMDS
        $(SED) "/OUTPUT_POLICY/c\OUTPUT_POLICY = $(REFPOLICY_POLICY_VERSION)" \
@@ -50,6 +52,10 @@ endef
 
 define REFPOLICY_INSTALL_TARGET_CMDS
        $(REFPOLICY_MAKE) -C $(@D) DESTDIR=$(TARGET_DIR) install
+       $(INSTALL) -m 0755 -D package/refpolicy/config \
+               $(TARGET_DIR)/etc/selinux/config
+       $(SED) "/^SELINUX=/c\SELINUX=$(REFPOLICY_POLICY_STATE)" \
+               $(TARGET_DIR)/etc/selinux/config
 endef
 

Once again, please test that everything still works fine for you after my changes.

Thanks a lot for this work on refpolicy.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#7 lore raw

PATCH v4 1/3 refpolicy: new package

In reply to Adam Duskett

Adam,

Quoted 6 lines · Adam Duskett

The patch is for adding selinux reference policy (refpolicy). It is a complete SELinux policy that can be used as the system policy for a variety of systems and used as the basis for creating other policies.

---

Please list the person who suggested the change or group by the person requesting the change.
https://buildroot.org/downloads/manual/manual.html#submitting-patches
21.5.4. Patch revision changelog

Quoted 12 lines

Changes v3 -> v4:
- Split the REFPOLICY_MAKE define into several lines for formatting cleanliness.
- Added TEST_TOOLCHAIN=$(HOST_DIR) to the REFPOLICY_MAKE define. This fixes repfolicy from attempting to use selinux tools on the host machine. Line 49 of the Makefile shows that userbindir, usersbindir, and sbin dir are set when the TEST_TOOLCHAIN variable is passed to the Makefile. TEST_TOOLCHAIN in this instance looks to match up properly with the HOST_DIR, so pass HOST_DIR as TEST_TOOLCHAIN. This fix has been tested with Debian 8 sid without SELinux installed.
- Removed Coverletter from patch set.

<snip>

test-pkg tested this patch series against the following. Plus my own personal development use of refpolicy.

# BR2_PACKAGE_CHECKPOLICY is not set BR2_PACKAGE_POLICYCOREUTILS=y
# BR2_PACKAGE_POLICYCOREUTILS_AUDIT2ALLOW is not set # BR2_PACKAGE_POLICYCOREUTILS_RESTORECOND is not set BR2_PACKAGE_REFPOLICY=y BR2_PACKAGE_REFPOLICY_VERSION="30"
# BR2_PACKAGE_REFPOLICY_STATE_ENFORCING is not set BR2_PACKAGE_REFPOLICY_STATE_PERMISSIVE=y
# BR2_PACKAGE_REFPOLICY_STATE_DISABLED is not set BR2_PACKAGE_REFPOLICY_STATE="permissive"
# BR2_PACKAGE_REFPOLICY_CUSTOM_GIT is not set # BR2_PACKAGE_SEPOLGEN is not set BR2_PACKAGE_SETOOLS=y

### Limited # of builds because of BR2_PACKAGE_AUDIT_ARCH_SUPPORTS (arm/powerpc/intel)

                armv5-ctng-linux-gnueabi [ 1/49]: OK
              armv7-ctng-linux-gnueabihf [ 2/49]: OK
                        br-aarch64-glibc [ 3/49]: OK
                  br-arm-cortex-a9-glibc [ 6/49]: OK
               br-powerpc64-power7-glibc [26/49]: OK
                     i686-ctng-linux-gnu [34/49]: OK
#8 lore raw

PATCH v4 1/3 refpolicy: new package

In reply to Adam Duskett

Hello Adam,

Quoted 3 lines · Adam Duskett

The patch is for adding selinux reference policy (refpolicy). It is a complete SELinux policy that can be used as the system policy for a variety of systems and used as the basis for creating other policies.

I've applied, after doing a few fixes. I also have one question. See below.

Quoted 4 lines
 package/Config.in                |  1 +
 package/refpolicy/Config.in      | 37 ++++++++++++++++++++++++++++
 package/refpolicy/refpolicy.hash |  2 ++
 package/refpolicy/refpolicy.mk   | 53 ++++++++++++++++++++++++++++++++++++++++

Entry to DEVELOPERS file missing.

package/refpolicy/Config.in line 8

Quoted 8 lines
package/refpolicy/Config.in new file +8 -0
+config BR2_PACKAGE_REFPOLICY
+	bool "refpolicy"
+	depends on BR2_TOOLCHAIN_HAS_THREADS # policycoreutils
+	depends on BR2_TOOLCHAIN_USES_GLIBC # policycoreutils
+	depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS # libsemanage
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libsemanage
+	depends on BR2_TOOLCHAIN_USES_GLIBC # libsemanage
+	depends on !BR2_STATIC_LIBS #libsemanage

Repeating dependencies is useless. Also having as a comment a package that isn't selected by refpolicy doesn't make sense. I've fixed this.

package/refpolicy/Config.in line 9

Quoted 1 line
package/refpolicy/Config.in new file +1 -0
+	depends on !BR2_arc # libsemanage

Ditto.

package/refpolicy/refpolicy.mk line 13

Quoted 5 lines
package/refpolicy/refpolicy.mk new file +5 -0
+# Do not use GitHub helper as git submodules are needed for refpolicy-contrib
+REFPOLICY_SITE = https://github.com/TresysTechnology/refpolicy.git
+REFPOLICY_SITE_METHOD = git
+REFPOLICY_GIT_SUBMODULES = y # Required for refpolicy-contrib
+REFPOLICY_LICENSE = GPLv2

We use SPDX license tags now, so GPL-2.0.

package/refpolicy/refpolicy.mk line 16

Quoted 3 lines
package/refpolicy/refpolicy.mk new file +3 -0
+REFPOLICY_LICENSE_FILES = COPYING
+REFPOLICY_INSTALL_STAGING = YES
+REFPOLICY_DEPENDENCIES += \

+= not needed here.

package/refpolicy/refpolicy.mk line 25

Quoted 9 lines
package/refpolicy/refpolicy.mk new file +9 -0
+	host-m4 \
+	host-checkpolicy \
+	host-policycoreutils \
+	host-setools \
+	host-gawk \
+	host-python \
+	policycoreutils
+
+REFPOLICY_PYINC = -I$(HOST_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)/site-packages

Variable unused, so dropped.

Quoted 5 lines
package/refpolicy/refpolicy.mk new file +5 -0
+# Cannot use multiple threads to build the reference policy
+REFPOLICY_MAKE = \
+	TEST_TOOLCHAIN=$(HOST_DIR) \
+	PYTHON="$(HOST_DIR)/usr/bin/python2" \
+	$(TARGET_MAKE_ENV) \

package/refpolicy/refpolicy.mk line 41

Quoted 10 lines
package/refpolicy/refpolicy.mk new file +10 -0
+	$(MAKE1)
+
+define REFPOLICY_CONFIGURE_CMDS
+	$(SED) "/OUTPUT_POLICY/c\OUTPUT_POLICY = 30" $(@D)/build.conf
+	$(SED) "/MONOLITHIC/c\MONOLITHIC = y" $(@D)/build.conf
+	$(SED) "/NAME/c\NAME = targeted" $(@D)/build.conf
+endef
+
+define REFPOLICY_BUILD_CMDS
+	$(REFPOLICY_MAKE) -C $(@D) bare conf DESTDIR=$(STAGING_DIR)

We usually put DESTDIR before the targets, so changed.

package/refpolicy/refpolicy.mk line 46

Quoted 5 lines
package/refpolicy/refpolicy.mk new file +5 -0
+endef
+
+define REFPOLICY_INSTALL_STAGING_CMDS
+	$(REFPOLICY_MAKE) -C $(@D) install-src install-headers \
+	DESTDIR=$(STAGING_DIR)

Second line should be indented with two tabs.

package/refpolicy/refpolicy.mk line 51

Quoted 5 lines
package/refpolicy/refpolicy.mk new file +5 -0
+endef
+
+define REFPOLICY_INSTALL_TARGET_CMDS
+	$(REFPOLICY_MAKE) -C $(@D) install DESTDIR=$(TARGET_DIR)
+endef

My question is: why "install-src install-headers" for staging and just "install" for target ?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com