Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I would assume most all of you know why I am asking this, but for those who don't, Loop Device Support of a Kernel on an Android device is utilized to mount a Linux Distro IMG file (Ubuntu or Debian, & a couple others) to run the linux img in a Chrooted environment to run side by side next to your Android System.

So there is tons of information on what Loop Device Support is (if you need a good explanation see Wikipedia's article.), and why you need it, but there is a great lack of explaination as to how you find out if your device supports it. The most information relating to it is that "most roms support it"...

So down to the issue, how would one discover if my device currently supports it? Is there some script I can look at or something in the kernel I can view to find out if my device supports it?

share|improve this question
    
You could just try mounting a loop device. The programming part is off-topic here though -- try Stack Overflow. –  Matthew Read Jul 6 '12 at 21:52
    
Okay thanks for fixing that. Id still like to know how to find what gives it the support –  insomnia Jul 6 '12 at 21:56
    
@insomnia: Like any non-trivial feature, a lot of things are required to make loopback device works, CONFIG_BLK_DEV_LOOP is just one of them, the mount program also has support the appropriate mount options, recognize the IMG format, and find the correct driver to translate the disk image format to a block device. In short, the only reliable way to check for support is to actually trying to mount it. –  Lie Ryan Jul 7 '12 at 3:29
add comment

4 Answers

up vote 3 down vote accepted

You can verify by checking /proc/config.gz and search through it looking for the configure option - CONFIG_BLK_DEV_LOOP=y.

To do that you need to do it this way:

cp /proc/config.gz /sdcard/kernel_config.gz

and

adb pull /sdcard/kernel_config.gz

Unzip the kernel_config.gz and open it up in a notepad or text editor and search it.

If its either # CONFIG_BLK_DEV_LOOP is not set or CONFIG_BLK_DEV_LOOP=n all bets are off.

share|improve this answer
    
Thanks a bunch! Too bad I dont know what Matt edited. probably something that would of been useful to me. Rediculous how anal the whole entire stack exchange network is.. Who cares if its still on the topic, its useful information that many may find useful, but no, makes it so people have to search. And in fact that information that has been removed has probably never been posted anywhere else on the net. But it cant stay because you cant discuss Android Development on an Android Site.. Weird I just don't get it.. But thank you so much t0mm13b, exactly what I was looking for! –  insomnia Jul 11 '12 at 4:31
    
@insomnia: You can see exactly what was edited by clicking on the timestamp. He fixed the formatting on one piece of text. There was no information removed from this post. –  eldarerathis Aug 10 '12 at 20:25
    
@eldarerathis yeah I noticed. My bad. I was new at that point. But he also deleted a relevant comment which is what made me say it in the first place. But yeah sorry about that. –  insomnia Aug 12 '12 at 0:42
    
On Cyanogenmod 10.1, I don't have /proc/config.gz file. What to do? –  enedil Feb 21 at 12:56
    
@enedil: Build your own kernel am afraid... no can do, some elect to include the config, others don't. –  t0mm13b Feb 21 at 17:49
show 1 more comment

Here is a shell function to check for loop support without creating a loop device. It should even work as non-root.

function check_loop_support {
    local tmp

    # assuming that losetup -f works ... to be checked somewhere else
    tmp=$(losetup -f 2>/dev/null)
    if test -b "$tmp"; then
        return 0
    fi

    # So far we haven't found any loop support. Let's check whether we
    # could load the module and assume that it would work.
    modprobe --quiet --dry-run loop &>/dev/null
    return $?
}

Note there exist losetup versions with different behavior of -f. Sometimes they would automatically load loop module if needed and possible. And some versions would even directly return 1 if no loop support available. Others just print "/dev/loop0" although there is no such device. The function above tries to be safe for all known cases.

Note that you may still need to load the loop module to have usable loop devices available. If you are root you could also run a real "modprobe loop" before losetup to be sure.

share|improve this answer
add comment

You can use the following command at the terminal:

export

and Search for:

LOOP_MOUNTPOINT

If there is a LOOP_MOUNPOINT, probably you can mount loop devices.

UPDATED

HOW TO TEST?

Download a freedos image (http://www.freedos.org/) 40MB ISO.

Make a loop device association:

losetup /dev/block/loop4 fd11src.iso 

Mount a iso device

mkdir freedos_img
mount -t iso9660 -o ro /dev/block/loop4 freedos_img

And there is this the mounted iso at freedos_img

share|improve this answer
    
And if I find it, what? does it signify I have support for loop devices? –  enedil Feb 21 at 13:01
    
You can easily find out without searching for LOOP_MOUNTPOINT. Just type this export | grep LOOP in Terminal Emulator. This will show the instances of LOOP_MOUNTPOINT. –  k1chy Feb 22 at 3:28
add comment

Just came across this. I was having the same issue. You could just do zcat /proc/config.gz | grep CONFIG_BLK_DEV_LOOP from a terminal emulator. If you get a y, you are good to go.

share|improve this answer
    
Definitely the best answer. –  aggregate1166877 Jul 5 '13 at 9:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.