Re: How is policy.31 created from modules under /usr/share/selinux

Chris PeBenito <[email protected]>
Newsgroups org.kernel.vger.selinux-refpolicy,org.kernel.vger.selinux
Message-ID <[email protected]>
(SELinux main mail list to BCC since this is a refpolicy question.)

On 12/7/20 8:26 AM, Ashish Mishra wrote:
>   4)  Further debugging I can confirm that the final binary (policy.31)
> seems to be
>        using HARD-CODDED location of /etc/selinux instead of what is
> being passed as DESTDIR.
>       The policy.31 is created not at custom-embedded-rootfs location.
> 
>        Due to this :
>          - policy.31 is created in /etc/selinux/refpolicy/policy/policy.31
>            instead of what i was expecting at
> /tmp/custom-embedded-rootfs/etc/selinux/refpolicy/policy/policy.31
>            as DESTDIR=${ROOT}  and i do get *.pp at the expected
> location of /tmp/custom-embedded-rootfs/etc/selinux/refpolicy/src/policy
>                   ${MAKE} -C ${ROOT}/etc/selinux/${PKG}/src/policy load
> DESTDIR=${ROOT}


I can't reproduce your issue.  I use monolithic policy regularly in the way 
you're using it.

Here's the Makefile variables:

 From Makefile:
   topdir := $(DESTDIR)/etc/selinux
   installdir := $(topdir)/$(strip $(NAME))
   policypath := $(installdir)/policy

 From Rules.monolithic:
   loadpath = $(policypath)/$(notdir $(polver))

$(notdir $(polver)) is "policy.31" and NAME is what you have in build.conf, e.g. 
"refopolicy".


Then the install target for monolithic looks like this (with "echo"s removed):

$(loadpath): $(policy_conf)
         @$(INSTALL) -d -m 0755 $(@D)
         $(verbose) $(CHECKPOLICY) -U $(UNK_PERMS)  $^ -o $@

-- 
Chris PeBenito
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.