Results 1 to 6 of 6

Thread: Problems with Cross-Compiling ARM and Custom ARM chroot

  1. #1

    Lightbulb Problems with Cross-Compiling ARM and Custom ARM chroot (with workarounds)

    1) The "git clone" is failing to locate the repository when trying to aquire the Linaro stuff. Says it does not exist.
    -edit=I got kernel source for another samsung product though not gs3, need to look at drivers, and look into the aircrack-ng patching with proper patch,
    *Note=" Any help with kernel patching would be great, I checked out the source for the kernel that comes with CM-10.1 and it seems I am using bcma driver, make sense? Maybe you can help me?"

    2) During apt-gets some packages are broken or not found

    some output of the Custom chroot procedure

    The following packages have unmet dependencies:
    git : Depends: perl-modules but it is not going to be installed
    Depends: liberror-perl but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    .................................................. .................................................. ....

    Failed to fetch http://http.kali.org/kali/pool/main/....3-5_armhf.deb 404 Not Found
    Failed to fetch http://http.kali.org/kali/pool/main/....7.3-4_all.deb 404 Not Found
    Failed to fetch http://http.kali.org/kali/pool/main/....7.3-4_all.deb 404 Not Found
    E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
    **Sigh**
    Last edited by Mashed-Potatoe; 2013-10-20 at 01:25.

  2. #2

    Lightbulb Solution for chroot enviroment

    Ok solution was simple as py, at least for the Custom ARM chroot step.

    I went back to manual config step to do this.

    add 'deb http://http.us.debian.org/debian stable main contrib non-free' to '/etc/apt/sources.list' ; I know adding other repos to the list is a 'no no', but this is debian and from what I understand 'apt-get' should only source the Debian repo if packages are not found at the Kali repo, simply due to the source being added to the end of the list of repo's.


    I was going to pick out the packages and 'dpkg -i' to intall them individually, and yes as tedious as that may be I guess it would be possible.

    afett adding Debian repo

    root@HIVE-PC-01:/# ls
    bin dev home media opt root sbin srv tmp var
    boot etc lib mnt proc run selinux sys usr
    root@HIVE-PC-01:/# cd /etc/apt
    root@HIVE-PC-01:/etc/apt# ls
    apt.conf.d sources.list trustdb.gpg trusted.gpg.d
    preferences.d sources.list.d trusted.gpg
    root@HIVE-PC-01:/etc/apt# nano sources.list
    root@HIVE-PC-01:/etc/apt# apt-get update
    Get:1 http://http.us.debian.org stable Release.gpg [1672 B]
    Get:2 http://http.us.debian.org stable Release [168 kB]
    Get:3 http://http.us.debian.org stable/main armhf Packages [5693 kB]
    Hit http://http.kali.org kali Release.gpg
    Hit http://security.kali.org kali/updates Release.gpg
    Hit http://http.kali.org kali Release
    Hit http://security.kali.org kali/updates Release
    Hit http://http.kali.org kali/main armhf Packages
    Hit http://security.kali.org kali/updates/main armhf Packages
    Hit http://http.kali.org kali/contrib armhf Packages
    Hit http://security.kali.org kali/updates/contrib armhf Packages
    Hit http://http.kali.org kali/non-free armhf Packages
    Hit http://security.kali.org kali/updates/non-free armhf Packages
    Ign http://http.kali.org kali/contrib Translation-en
    Ign http://http.kali.org kali/main Translation-en
    Ign http://security.kali.org kali/updates/contrib Translation-en
    Ign http://http.kali.org kali/non-free Translation-en
    Ign http://security.kali.org kali/updates/main Translation-en
    Ign http://security.kali.org kali/updates/non-free Translation-en
    Get:4 http://http.us.debian.org stable/contrib armhf Packages [33.1 kB]
    Get:5 http://http.us.debian.org stable/non-free armhf Packages [55.8 kB]
    Get:6 http://http.us.debian.org stable/contrib Translation-en [34.8 kB]
    Get:7 http://http.us.debian.org stable/main Translation-en [3851 kB]
    Get:8 http://http.us.debian.org stable/non-free Translation-en [66.1 kB]
    Fetched 9904 kB in 58s (169 kB/s)
    Reading package lists... Done
    root@HIVE-PC-01:/etc/apt# apt-get upgrade
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following packages will be upgraded:
    tasksel tasksel-data
    2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Need to get 115 kB of archives.
    After this operation, 1024 B disk space will be freed.
    Do you want to continue [Y/n]? y
    Get:1 http://http.us.debian.org/debian/ stable/main tasksel-data all 3.14.1 [20.6 kB]
    Get:2 http://http.us.debian.org/debian/ stable/main tasksel all 3.14.1 [94.8 kB]
    Fetched 115 kB in 1s (64.4 kB/s)
    Preconfiguring packages ...
    (Reading database ... 16941 files and directories currently installed.)
    Preparing to replace tasksel-data 3.14+nmu1+kali2 (using .../tasksel-data_3.14.1_all.deb) ...
    Unpacking replacement tasksel-data ...
    Preparing to replace tasksel 3.14+nmu1+kali2 (using .../tasksel_3.14.1_all.deb) ...
    Unpacking replacement tasksel ...
    Processing triggers for man-db ...
    Setting up tasksel-data (3.14.1) ...
    Setting up tasksel (3.14.1) ...
    root@HIVE-PC-01:/etc/apt# which python
    root@HIVE-PC-01:/etc/apt# apt-get install python
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following extra packages will be installed:
    python-minimal
    Suggested packages:
    python-doc python-tk
    The following NEW packages will be installed:
    python python-minimal
    0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
    Need to get 223 kB of archives.
    After this operation, 839 kB of additional disk space will be used.
    Do you want to continue [Y/n]? y
    Get:1 http://http.us.debian.org/debian/ stable/main python-minimal all 2.7.3-4+deb7u1 [42.8 kB]
    Get:2 http://http.us.debian.org/debian/ stable/main python all 2.7.3-4+deb7u1 [181 kB]
    Fetched 223 kB in 1s (161 kB/s)
    Selecting previously unselected package python-minimal.
    (Reading database ... 16941 files and directories currently installed.)
    Unpacking python-minimal (from .../python-minimal_2.7.3-4+deb7u1_all.deb) ...
    Selecting previously unselected package python.
    Unpacking python (from .../python_2.7.3-4+deb7u1_all.deb) ...
    Processing triggers for man-db ...
    Setting up python-minimal (2.7.3-4+deb7u1) ...
    Setting up python (2.7.3-4+deb7u1) ...
    root@HIVE-PC-01:/etc/apt#
    Just so this doesn't get to be too big I'll just summarize the rest...

    "apt-get install perl perl-modules" ----> success
    "apt-get install git git-core" --------------> success

  3. #3
    One question though, is the 'kali-defaults' package for X11 ? I don't want any gui packages for me because Android uses Java and "activities" and nothing like X so my plan is to only include the cli apps that make up Kali Linux and then people can port whatever gui apps they'd like to run on Android's Dalvik/Java instead of X. I hope that makes sense,

    again..

    Are is the 'kali-defaults' package only required for X?

  4. #4
    *Note=" (This is all on android, I bet on other arm less issuse there are) "
    Postgresql works, but not on port 5432, if I "/etc/init.d/postgresql start -p 34555" it starts clusters and Metasploit no longer complains about not being able to connect to data base, I haaven't ran further but its a start.

    Like This:
    localhost init.d # service postgresql start
    Starting PostgreSQL 8.4 database server: mainThe PostgreSQL server failed to start. Please check the log output: 2013-10-19 21:10:21 UTC LOG: could not create IPv4 socket: Permission denied 2013-10-19 21:10:21 UTC WARNING: could not create listen socket for "localhost" 2013-10-19 21:10:21 UTC FATAL: could not create any TCP/IP sockets ... failed!
    failed!
    localhost init.d # service postgresql start -p 34555
    localhost init.d # service postgresql status
    Running clusters:
    *NFS- (not NEED FOR SPEED)
    nfs-common and nfs-kernel-server do not work, always "statd failed".
    Possible "no nfs support in Android kernel" from other threads.


    To do: (For Kali on Android)
    -Always have postgres start on another port, 5432 seems to already be i use on Android, I am not 100% on this but I think it is the issue
    -Confirm that indeed metasploit can connect to db (follow through man, follow through)
    -logcat with nfs attempts, see what happens, read more about nfs on Android.
    -Install Metasploit as per : https://github.com/rapid7/metasploit...nt-Environment
    *Note="I did not use RVM, I just ran 'apt-get install ruby1.9.2' instead, Make sure your environment is set up for bundle before giving up on 'bundle install'"
    *Note="Never mind, problem with ruby1.9.2 it fetches 1.9.1 instead, now trying rvm as per instructions, hope it works with armv7"
    *Note="Had some difficulties, had to use '--verify-downloads 2', ruby is now compiling on my phone, will get source a check its sum from different location at later time. I think porting most if not all services to run with bionic might be the best option, then maybe use sym-links or update-alternatives to start them from /etc/init.d/; lots of permission issues which may be due to port being used by another process, to fix, use different port during install scripts on Android, should then allow them to start and auto configure, this seems to be where the hiccups are happening during their installation."
    *Note="After RVM compiled and installed ruby1.9.3 without varifying (hope that not just me), 'bundle install' is running smoothly. Should have metasploit-framework installed and a database ready to test by tonight.
    *Note="Ok, I am having some touble with setting up a database, I am running './configure --with-pgport=34555' right now on postgresql source, lets see if this compiles on my phone, if not I will have to cross-compile it some how tomorrow. Also I need to integrate users and auth and the whole shadow file thing into CM's multi-user scenario, they already have the front-end, if I can tweak it to use the same crypto and user programs that Linux is using underneath the hood, then tweak init to start it all up right after boot, maybe I can get it to work together like linux's root, admin, user, guest scheme, that would solve alot of bugs involving user issues, I've stumbled across a few.
    *Note="Time to make soup"
    *Note="Well, I built postgresql-8.4 and postgresql-contib-8.4 and installed them, then I installed postgresql-common, I had trouble with the whole user thing and adding a database, I was able to 'su postgres' then 'initdb -D ./testdb' it created the database but when I wanted to start it up, it started on port 34555 as spicified but the it said permission denied as it normally does. I put it away and went to bed at that point, which leads to my next post and my idea for 'aka-adduser'."
    -Test database.

    *edit=Mind you that I am not running chroot, this is bind mounted to empty directories I make in Androids "/" which is acually ramdisk and therefore the mountpoints I create when testing this out get deleted and I have to make new ones and remount, for /etc, Android's is just a sim link to /system/etc so you can mv the /etc to /etc-a for backup and then mkdir /etc to use as mount point (tried once and no crash or feezes to apps, I was supprised) another more tedious solution to /etc is to copy the contents of ${imagert}/etc to /system/etc ( Normally when I do this on a fresh ROM I only need to overwrite hosts and one other file used in network configuration, sometimes I do sometimes I don't.) Then you just change your $PATH
    Last edited by Mashed-Potatoe; 2013-10-20 at 20:52.

  5. #5
    This is how I set up my Android/Kali enviroment, be aware that directories made in Androids root will only exist in RAM, so just make empty directories and bind mount to them over adb or ssh like this...

    I just copy and paste this, any attempt to script this out has led to issues...though I am a novice programmer at best with Python and mksh & Bash I am half as good with; that being said, this is all done as root, (i.e. "adb root" then "adb shell")...
    STEP 1)
    BACK UP YOUR ROM.
    #SET UP SOME VARIABLES, THESE CAN BE CHANGED TO FIT YOUR NEEDS, BETWEEN THE QUOTES OF COURSE. this also works with other arm distos
    # aswell, I would like to get an arm based bsd rootfs set up sometime to try this out with as well, a lot less licensing issues I hear.
    imloc="/storage/legacy/Download"
    imname="kali.img"
    subset="/data/local/mnt"
    #GET READY TO MERGE GLIBC BASED SYSTEM
    mount -wo remount systemfs /system
    mount -wo remount rootfs /
    if [ ! -d "$subset" ]; then mkdir "$subset"; fi
    #MOUNT THE IMAGE
    busybox mount -wo loop ${imloc}/${imname} ${subset}

    # IF THAT DOES NOT WORK TRY THIS AND THEN TRY THE ABOVE AGAIN, ELSE SKIP NEXT TO MAKE DIRECTORIES
    busybox mknod /dev/block/loop255 b 7 255

    # MAKE DIRECTORIES AS NEEDED AND MOUNT THE FILES
    # DON'T WORRY ABOUT /dev /proc ; /root IS USUALLY EMPTY
    # IF YOUR ROOT DIR ON ANDROID IS NOT EMPTY THEN COPY TO
    # ${subset}/root AND THEN MOUNT ${subset}/root TO /root

    cd ${subset}
    for item in `ls` ; do if [ ! -d "/${item}" ] ; then mkdir /${item} && busybox mount --bind ${subset}/${item} /${item} ; fi ; done
    busybox mount --bind ${subset}/root /root

    *Note="noexec and other defaults get placed on these new folders and mountpoints, maybe try 'busybox mount -wo bind ${subset}/${item} /${item}' in the above for loop, when mounting from an external sd_card (ext4) I had to remount it, I believe this can be fix when building a ROM from source, in the 'android_filesystem_config.h' file, basically everything is dictated by this file and enforced by init as it continues to run in the background."

    *Note="If you have already bumped into the permissions issue a 'mount -wo remount /[dir] /[dir]' will remount the individual directories back in place without the extra 'noexec nosuid, etc' options thus allowing you to execute files within said directories. Use 'mount' without args to varify."

    #/sbin COPY /sbin TO ${subset}/sbin then mount
    busybox cp -ai /sbin/* ${subset}/sbin #ONLY NEED TO DO THIS ONCE
    busybox mount --bind ${subset}/sbin /sbin

    ##DO ONLY ONE OF THE FOLLOWING
    ## 1)
    #busybox cp -ai ${subset}/etc/* /etc/
    ##OR
    ## 2)
    #busybox mv /etc /etc-a
    #mkdir /etc && busybox mount --bind ${subset}/etc /etc

    ##IF YOU RENAME /etc TO /etc-a YOU CAN ALWAYS RENAME IT SHOULD THINGS GO WRONG
    ##IF YOU COPY ${subset}/etc TO /etc ONLY DO THAT ONCE FOR A ROM, REFLASH OR RESTORE A ROM WITHOUT THIS PROCESS TO "UNINSTALL"
    #"THERE'S A STORM IN THIS TEA CUP!"

    #YOU CAN COPY AND PASTE THIS OR USE IT IN "/system/etc/bash/bashrc" SO THAT WHEN ( ON CYANOGENMOD) YOU 'bash' YOUR ENVIRO WILL BE SET
    export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/system/bin:/system/xbin:/usr/games"
    export TERM=linux
    export HOME="/root"
    Any question I can help with, I could use some help getting my kernel patched with aircrack-ng patches, I need monitor mode at least to be working its CyanogenMod 10.1.UNOFFICIAL d2spr SPH-L710 model of Samsung Galaxy S III.

    Another interesting note, I am building Android ROMS on Kali Linux, not Ubuntu, idk I thought it was a neat thing to do.

    *Note="I guess my main priority next to figuring out the reposiory and linaro tools thing, is how to get nfs-common working, If I could do that I could set up my laptop as a server to serve my Android source code directory to my phone, then compile Android, on Android."

    *Note="Maybe using 'export archetecture="armel"' instead of "armhf"?"
    Last edited by Mashed-Potatoe; 2013-10-20 at 01:55.

  6. #6

    "aka-adduser" idea for C program to parse /etc/shadow and or passwd

    I know there are better programmers out there and sometimes they can do what I want to a lot better than I could so I'm just throwing this out there.

    aka-adduser "Android/Kali app - adduser

    Description:

    A program that parses /etc/passwd , /etc/shadow, and or any other relavent files. It will be initiated to add users to a serperate file parsed as an init.*.rc file stored in a persistant location that will be read by init to add users and their id's to memory ( I think thats how it works ). When the user invokes aka-adduser the program will read the apropriat file/s in /etc/, the new file, as well as query the current list of users and id's in memory, to avoid conflicts aka-adduser will not add users or id's already existant. Should all be fine the user can add users and id's that will be added to the new file as well as /etc/passwd and or /etc/shadow, should it need to initiate a crypto program or hashing program for shadow, thats fine. If users and id's can't be added "on the fly" they should at least appear to the system after a reboot. This may be the steping stone to requiring root and user login authentication.

Similar Threads

  1. Replies: 0
    Last Post: 2015-02-20, 14:35
  2. Trouble compiling a custom Network driver
    By mberthold in forum TroubleShooting Archive
    Replies: 0
    Last Post: 2014-08-26, 07:58
  3. Replies: 0
    Last Post: 2013-12-11, 17:11
  4. Raspberry Pi Image (Custom Cross-Compiled Kernel w/IPTables support)
    By Binary Overlord in forum Building Archive
    Replies: 0
    Last Post: 2013-11-04, 22:28
  5. Replies: 0
    Last Post: 2013-07-14, 16:03

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •