How to add new folder under boot folder

96boards

#1

hi,
is there someone who knows how to create a new folder under ‘/’ ?
Hikey960 rootfs is read-only, I want to copy one shared c-lib to /lib folder.
but I try to mkdir /lib in out/target/product/hikey960/system, it doesn’t work.


#2

You can have mount partition information with the mount command. / and /system are read-only. You can remount /system to rw at runtime via adb:
$ adb root
$ adb remount

To add your lib at buildtime, You can create your own prebuilt Android ‘module’ with a proper Android Makefile, but I suggest you to modify your device makefile (device/linaro/hikey/hikey960/device-hikey960.mk) and add your copy rule to PRODUCT_COPY_FILES.

e.g.
PRODUCT_COPY_FILES += device/linaro/hikey/mylib.so:system/lib/mylib.so


#3

hi, Loic
thanks, I did following commands:
adb root
adb remount
but boot folder “/” is still read-only mode. I need to add lib folder just under boot folder, /lib/my.lib.
because the sharing lib of object executable file is to /lib folder:

ELF executable, 64-bit LSB arm64, dynamic (/lib/ld-linux-aarch64.so.1), BuildID=90fe6da411d0e449bcd5e4df76b2666e4f79ab97, not stripped


#4

Are you trying to use a glibc linux binary on Android ? your binary points to ld-linux-aarch64.so which is known as the ELF Interpreter. /lib/ld-linux-aarch64.so is typically the glibc linux elf interpreter. Android has it own ELF interpreter (/system/bin/linker64) and libc (bionic).

ELF executables contain path to the ELF interpreter which is used to ‘start’ themself. To keep it simple, you have to (cross-)compile your app for Android target so that your executable use the correct elf-interpreter/libc, is it something you considered?


#5

hi, Loic
do you ever use sg3-utils in the android system? I tried to use “android/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9” to compile it, but compiling failed. then I switched cross-compiler to this one, it passed, and but it came to the result as you said above.
if you have good cross-compile for Android target, can you tell me download link?


#6

You are going to have to modify the source code of what you are trying to compile such that it becomes compatible with bionic.