About selinux's problem ,Invalid policyvers specified: 26,how to solve sepolicy error,when build the android source 4.4.2?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

About selinux's problem ,Invalid policyvers specified: 26,how to solve sepolicy error,when build the android source 4.4.2?

Jump to solution
2,958 Views
威王
Contributor II

./build/core/combo/include/arch/linux-x86/AndroidConfig.h:337:5: warning: "__GLIBC__" is not defined [-Wundef]
./build/core/combo/include/arch/linux-x86/AndroidConfig.h:337:23: warning: "__GLIBC__" is not defined [-Wundef]
host StaticLib: libsepol (out/host/linux-x86/obj/STATIC_LIBRARIES/libsepol_intermediates/libsepol.a)
Export includes file: external/checkpolicy/Android.mk -- out/host/linux-x86/obj/EXECUTABLES/checkpolicy_intermediates/export_includes
host Executable: checkpolicy (out/host/linux-x86/obj/EXECUTABLES/checkpolicy_intermediates/checkpolicy)
Install: out/host/linux-x86/bin/checkpolicy
Invalid policyvers specified: 26
usage:  out/host/linux-x86/bin/checkpolicy [-b] [-d] [-U handle_unknown (allow,deny,reject)] [-M][-c policyvers (15-29)] [-o output_file] [-t target_platform

(selinux,xen)][input_file]
make: *** [out/target/product/sabresd_6dq/obj/ETC/sepolicy_intermediates/sepolicy] Error 1

Can you help it out how to fix this issue?

Labels (4)
1 Solution
1,243 Views
威王
Contributor II


正确答案:

方案一:重装系统可解决上述问题,本人已验证过。

方案二:   在源码目录进行内容查找,在external/checkpolicy//checkpolicy.c文件中,打开该文件,在main函数的switch 语句的case ‘c’代码块中找到了错误提示行。

代码修改如下:在long int n = strtol(optarg, NULL, 10);后面再加上errno = 0;

重新编译源码,顺利通过,模拟器运行正常,上网也ok。

参考网址:http://blog.csdn.net/pinghegood/article/details/41787497

View solution in original post

0 Kudos
5 Replies
1,244 Views
威王
Contributor II


正确答案:

方案一:重装系统可解决上述问题,本人已验证过。

方案二:   在源码目录进行内容查找,在external/checkpolicy//checkpolicy.c文件中,打开该文件,在main函数的switch 语句的case ‘c’代码块中找到了错误提示行。

代码修改如下:在long int n = strtol(optarg, NULL, 10);后面再加上errno = 0;

重新编译源码,顺利通过,模拟器运行正常,上网也ok。

参考网址:http://blog.csdn.net/pinghegood/article/details/41787497

0 Kudos
1,243 Views
jimmychan
NXP TechSupport
NXP TechSupport
1,243 Views
nick1
Contributor I

I encounter the same problem, have you fixed it yet?

0 Kudos
1,242 Views
威王
Contributor II

*******************************************开始********************************************************

the correct install steps:

1、install ubuntukylin-14.04.1-desktop-amd64.iso

2、install jdk1.6.0_45.bin

3、install packages:

sudo apt-get update

sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0

sudo apt-get install bison g++-multilib git gperf libxml2-utils

sudo apt-get install curl flex gperf u-boot-tools

$ sudo apt-get install uuid uuid-dev zlib1g-dev liblz-dev liblzo2-2 liblzo2-dev

$ sudo add-apt-repository ppa:git-core/ppa

$ sudo apt-get update

$ sudo apt-get install git-core curl subversion  u-boot-tools

4、complete successfully!!!!!!!

note:执行完第1步骤后最好不要更新系统软件,有可能会出现我编译时出现的问题。以上我遇到的问题可能是更新系统软件造成的,无法修复,后来我在断网的情况下安装ubuntukylin-14.04.1-desktop-amd64.iso后,再联网安装第2、3步骤后,编译Android4.4成功。以上步骤完成后,checkpolicy命令应该可以正常使用,为保险起见可以先测试下checkpolicy命令是否可用(可以拷贝编译生成的checkpolicy,或者安装checkpolicy工具,我是拷贝编译生成的checkpolicy进行测试的),步骤如下:

1、cp ~/works/myandroid4.4-fsl/fsl-Android4.4.2-V1.0/out/host/linux-x86/bin/checkpolicy ~/tools/

note:~/works/myandroid4.4-fsl/fsl-Android4.4.2-V1.0/:我的Android4.4源码路径, ~/tools/:我创建的文件夹

2、cp ~/works/myandroid4.4-fsl/fsl-Android4.4.2-V1.0/out/target/product/sabresd_6dq/obj/ETC/sepolicy_intermediates/policy.conf ~/tools/

note:sabresd_6dq为我的编译平台

3、打开终端,输入命令:

wangwei@wangwei-vm:~$ cd tools/

wangwei@wangwei-vm:~/tools$ ls

checkpolicy  policy.conf

wangwei@wangwei-vm:~/tools$ ./checkpolicy -M -c 26 -o sepolicy policy.conf

./checkpolicy:  loading policy configuration from policy.conf

./checkpolicy:  policy configuration loaded

./checkpolicy:  writing binary representation (version 26) to sepolicy

wangwei@wangwei-vm:~/tools$ ls

checkpolicy  policy.conf  sepolicy

wangwei@wangwei-vm:~/tools$

note:可以发现tools文件夹下多了sepolicy文件,说明checkpolicy命令可用,之后再编译Android4.4就不会出现如下问题:

Invalid policyvers specified: 26

usage:  out/host/linux-x86/bin/checkpolicy [-b] [-d] [-U handle_unknown (allow,deny,reject)] [-M][-c policyvers (15-29)] [-o output_file] [-t target_platform

(selinux,xen)][input_file]
make: *** [out/target/product/sabresd_6dq/obj/ETC/sepolicy_intermediates/sepolicy] Error 1

*******************************************结束********************************************************

     以上编译android4..4没问题,但编译Android4.2还会出现缺少库的问题,以下方法可解决:

the correct install steps:

1、install ubuntukylin-14.04.1-desktop-amd64.iso

2、install jdk1.6.0_45.bin

3、install packages:

sudo apt-get update

sudo apt-get install libc6-dev-i386 zlib1g-dev g++-multilib lib32z1-dev lib32ncurses5-dev libxml2-utils uuid-dev

sudo apt-get install dpkg-dev

sudo apt-get install git gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386

sudo apt-get install uuid uuid-dev zlib1g-dev liblz-dev liblzo2-2 liblzo2-dev

sudo apt-get install git-core curl subversion

sudo apt-get install u-boot-tools

sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so

sudo apt-get install liblzo2-dev:i386 uuid-dev:i386

sudo apt-get install libswitch-perl

4、同样,为保险起见可测试下checkpolicy是否可用

0 Kudos
1,242 Views
威王
Contributor II

i found the android source 4.4.2 had no preblom,the isue dues to the ubuntu's environment,  lack one or more libraries; i built the source 4.4 in fsl's built ubuntu environment ,it successd.but it is a pity that  i do not know what libraries lack;