Welcome to the new Linux Foundation Forum!

Using debootstrap for install X86 -> ARM

Hi all!

At work they gave me the following task (and i need some help from you guys!):

At work we have a normal PC running Ubuntu 9.10 (32-bit), which works good.

We also have a LaCie Ethernet Disk Mini v2, which runs embedded Linux (RedHat), but is so trimmed down, you can't use the disk we would like to use it.

The task is this: On the X86 machine, make a bootable image for the ARM architecture and write it to a harddisk (which fits the LaCie offc.) so it can boot off it.

Now i have done some investigation, but don't know how to combine it all:

- I can use debootstrap to create a minimal Debian system, but there comes the problem, you can't chroot into a foreign created system (i.e. X86 cannot chroot into ARM system).

- I can use QEMU, which can emulate a ARM processor, but can i use the image that QEMU uses as a normal image for a harddisk, so it would boot off it (when using dd to write it to a real harddisk)?

- Current kernels support the LaCie hardware (Marvell chipset)

- I know how to use tools such as dd, so if the image is generated i can write it to disk and have the LaCie boot from it.

The LaCie box has the following:

1 ARM9 ARMv5TEJ (266 MHz) CPU with 64 Mb RAM, Gigabit network controller and 1 usb host port, internal there is a sata port obviously.

The only thing i want at the moment is to have the LaCie boot Debian and i can SSH into it, from there the rest is easy as pie.

Is someone willing to help me accomplish this task? It would seriously mean and help alot!

If all goes well and if i get all things up and running i would like to make a Howto of it and place that here, maybe it will be of some use !

Comments

  • gomergomer Posts: 158
    Is this what you want to do? http://wiki.debian.org/EmDebian/CrossDebootstrap

    Otherwise, you may want to consider a smaller distro, like Angstrom (http://www.angstrom-distribution.org/) or you'll have to compile a cross compiling tool chain and build your own packages and distribution essentially using something akin to OpenEmbeded.
  • Thanks for your reply!

    It looks very useful, but i have a question about it:

    The device does not have a screen or keyboard to attach to it, but i've read the EmDebian howto and it's focussed on the fact that the device should boot from NFS, which i think the LaCie box does not support, or am i getting something wrong?

    I've set up the first stage of debootstrap, which leaves me with a folder with basic Debian installed, i need to copy it over and do a chroot, but i can't chroot on the LaCie box, since it has not that utility, so there i am stuck again :(.

    The howto speaks of QEMU, however, nowhere in the tutorial it is being used.

    Should i create a ARM VM in QEMU and then run the processes again?
  • gomergomer Posts: 158
    That is exactly how I would approach this. I would build the entire thing on the x86 machine first, using QEMU to run and test the ARM code. Once you have successfully created a working installation, then I would go ahead and copy it over to the lacie. Unfortunately, I've never used a LaCie, but I have done something similar in the past with other headless hardware.
  • gomergomer Posts: 158
    Ok, I read up a bit mroe about the device you have. I think you're not facing a trivial task :(
    I foudn this article where someone essentially had to remove the disk from the unit and mount it in their pc to be bale to make modifications: http://jim.studt.net/edmini/index.html
    If you are OK with voiding the warranty, this is the way to go, since there doesn't seem to be a serial port on the boar (again I don't have one of my own to examine). So, essentially, do the debbootstrap thing, and start to build an image on youe x86 w/ apps for ARM. you should be able to get away w/ not having to cross compile everything, since Debian support arm, and has binary packages. Once you have *most* of it working, you'll need to create a disk image and copy your new system into that disk image. The image will essentially just be a file holding a partition. If you don't know how to do this, let me know, and I'll explain. Then, you will need to use that disk image as a disk for QEMU if you want to test it first. The only thing I'm fuzzon on is the boot loader. You want to examine the first 512 bytes of the disk that shipped with the device to see if you can determine what boot loader it uses. If it's grub, you should be able to install it into your created disk image using QEMU. If it's not, well, things can get a little more tricky.

    good luck, and keep me posted. I'm curious.
  • gomergomer Posts: 158
    one more thing. In the ubuntu repository, there is the following package that might be of help you, too:

    qemu-arm-static - - static qemu-arm binary that enables to use arm chroots
  • Hi,

    Thanks for the info and support so far :)!

    I already voided my warranty, as i got it from my work, which bought it 2 years ago, so no warranty left :).
    I modified in such ways that i have SSH access on the box and i have made a 1:1 copy of the entire distribution to a old S-ATA disk, so if install fails i always can roll back.

    I found some info as well, the bootloader is U-Boot and the partition scheme default is this:
    SDA1 -> EXT3 with BOOT flag, about 3Gb
    SDA2 -> SWAP (512 Mb)
    SDA3 -> EXT3 that holds the userfiles (the space you see as available)
    SDA4 -> Extended partition (90 Mb)
    SDA5 -> Unformatted (16 Mb)
    SDA6 -> Unformatted (8 Mb)
    SDA7 -> EXT3, that holds the boot kernel (if this partition is not available it won't boot at all)

    My guess is that there is some link in uboot to boot from the 1st partition, which automatically links to the 7th partition in order to boot and then switch back to the 1st partition to load config files etc.

    Is it possible to copy the debootstrapped system to the LaCie and then in fstab let it mount to it on /proc instead of the LaCie system proc? Should kernels be the same or won't that matter in this part?

    I also found out that there is a RS232 / JTAG interface soldered onto the main board, which can be hooked up with a Nokia DKU5 USB cable LOL! With that cable linked you can command U-Boot!

    I've shot 3 photo's of the main board, for reference, the board says ED MINI V2, altho, the V2 has a USB B connector for connection with a PC, and mine does not have any (which only the V1 had), strange? Maybe it's a refurb?
    Another strange thing is that the V2 uses XFS by default (according to LaCie) and mine uses EXT3 (also the V1 specifications...).
    Strangely the only thing that does seem to be true is the CPU, the ARM9, which was a PPC on V1. Also V1 had 32 Mb RAM and mine has 64 Mb.
    http://langerak.ath.cx/downloads/lacie (for photo's)

    Ok, another edit:
    I've managed to do a debootstrap for the ARM arch. Tarred the stuff, scp'ed it to the LaCie (with the LaCie software running). Untarred it, copied chroot to /usr/sbin and now i am able to chroot into the minimal Debian system :D. I ran debootstraps secpnd stage and got it minimally working :). Only the supplied rm executable was faulty, copied that from the LaCie system into the debian chroot and now i can install lot's of software offcourse.

    By the way, you said it would be trivial, is it manageable to install Linux on it? I like to learn alot from this process and really try to get this to work, but do you think it'll ever work the way i want it?
  • Well, 1 week later and still haven't got any progress in this...

    Maybe this won't work after all? Some ppl say that they did manage to install Debian on it and some say it's not possible due to the kernel being flashed into ROM.

    As said before, i am now able to chroot within the LaCie linux, so chrooting into Ubuntu is what i can do.

    Since this is working, now i need a way to install a kernel into it and modify it so that U-Boot can boot off it. Or even better. Make an image which i can put on the harddisk (dd or partimage), put the disk back in the LaCie and let it boot.

    Any suggestions or tips? Still want to make this work! :D
  • langerak wrote:
    Since this is working, now i need a way to install a kernel into it and modify it so that U-Boot can boot off it. Or even better. Make an image which i can put on the harddisk (dd or partimage), put the disk back in the LaCie and let it boot.

    Any suggestions or tips? Still want to make this work! :D

    Hi, I am trying to do the same thing, use QEMU to run an ARM kernel under a i686 system.
    I found these links:
    [ul][li]
    http://balau82.wordpress.com/2010/04/12/booting-linux-with-u-boot-on-qemu-arm/[/li][li]
    http://arstechnica.com/civis/viewtopic.php?f=16&t=1110090[/li][/ul]

    Still have not gotten it to work. Please, let me know if you can?
Sign In or Register to comment.