Porteus-ARM for the Raspberry Pi

Ahau's work on porting Porteus to ARM devices
User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Porteus-ARM for the Raspberry Pi

Post#1 by Ahau » 12 Mar 2013, 20:18

**UPDATE**
As of 3/14/2013, this should still be considered a work in progress. This kernel and userland have been verifed to boot into the GUI (LXDE or XFCE), but can probably use some additional tweaking and firmware --please let me know.

See the notes at the end regarding kernel sources if you want to try to compile your own kernel.

To install on the raspberry pi:

Download the precompiled kernel+initramfs and driver module here:
http://porteus-arm.googlecode.com/files ... -14.tar.gz

And download the Porteus-ARM userland here:
http://porteus-arm.googlecode.com/files ... -11.tar.gz

You'll want to unpack both tarballs and copy "kernel.img" from the kernel tarball onto your RPi boot partition (you can rename it and point 'config.txt' to it, I believe), then copy the 'porteus' folder from the userland tarball into your RPi 'root' partition. You'll want it to be in the top-level directory of that device.

Then, copy the kernel driver and firmware module (e.g. 000-kernel-RasPi-3-14.xzm) from the kernel tarball into the /porteus/base folder on your root partition. I am distributing the '000-*' modules along with the kernel, as it contains the drivers and firmware that need to match the kernel for each board.

Note, you may also need additional firmware updates, as described in this guide: http://elinux.org/RPi_Kernel_Compilation

and available here: https://github.com/raspberrypi/firmware

However, until I get one of my own, I'm not sure where all the firmware needs to go. If you need firmware in your 'opt' folder, you'll want to put it in /porteus/rootcopy/opt/, so that it's copied into /opt in your live filesystem.


Thanks!



Kernel Notes:
To generate the kernel, I downloaded Ponce's RPi kernel sources from here: http://ponce.cc/slackware/slackwarearm- ... 1ponce.tgz

I added the aufs patch for kernel 3.2 and reconfigured the kernel as follows:

-kernel compression = LZMA
-Default hostname = porteus
-kernel .config support=M
-pointed initramfs files to a folder on my system with the source files for the Porteus-ARM initramfs (this builds the initramfs into the kernel image so they form a single file)
-allow xz compressed initramfs
-change initramfs embedded to xz compressed
-removed DEVTMPFS_MOUNT
-modifed cmdline: remove ro, rootfstype, rootwait and root=/dev/*, added 'excheat ' with trailing space just in case.
-changed fuse to [*]
-changed squashfs to [*], added "additional option for memory-constrained", Number of frangments cached to 3
-changed loopback device support to [*]
-added aufs, similar to default porteus AUFS configs, with addition of aufs_export, since ponce has added exportfs as a module in his kernel
-changed XFS to [*] (this is so exportfs is compiled directly in rather than as a module, otherwise the build fails due to aufs being compiled in)
UPDATE
3/14/2013:
changed cmdline config to CMDLINE_EXTEND=y
3/14:
added additional XZ decompression support (x86 primarily). This should finally get the system to boot into a true aufs live filesystem

My patched kernel sources can be downloaded here (my .config file is in place and backed up as 3-12-config-- you may need to update it manually with my subsequent changes outlined above until I upload a new source tarball with the updated config):
http://porteus-arm.googlecode.com/files ... hed.tar.gz
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
Hugh Johnson
White ninja
White ninja
Posts: 13
Joined: 04 Jan 2011, 14:21
Location: San Diego, CA

Re: Porteus-ARM for the Raspberry Pi

Post#2 by Hugh Johnson » 13 Mar 2013, 17:59

It got all the way to "Live system is now ready - starting Porteus" but then it stopped at:
http://ttmclients.com/rasp/photo.JPG

I'm playing with it a bit more now, will let you know if I find anything.

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: Porteus-ARM for the Raspberry Pi

Post#3 by Ahau » 13 Mar 2013, 18:27

Thanks, Hugh -- that's actually a little further than I thought it might get on the first try :D

googling doesn't turn up an awful lot of information, but the closest I could find is a patch in glibc:

Code: Select all

++/* Run any architecture-specific checks that might be needed for the
++   current architecture. */
++static int
++arch_specific_checks(int fd, const char *name, ElfW(Ehdr) *ehdr)
++{
++#ifdef __arm__
++    return arm_specific_checks(fd, name, ehdr);
++#endif
++
++  return 0;
++}
++
++
+ /* Open a file and verify it is an ELF file for this architecture.  We
+    ignore only ELF files for other architectures.  Non-ELF files and
+    ELF files with different header information cause fatal errors since
+@@ -1745,6 +1951,7 @@
+ 
+       /* Check .note.ABI-tag if present.  */
+       for (ph = phdr; ph < &phdr[ehdr->e_phnum]; ++ph)
++      {
+       if (ph->p_type == PT_NOTE && ph->p_filesz >= 32 && ph->p_align >= 4)
+         {
+           ElfW(Addr) size = ph->p_filesz;
+@@ -1793,6 +2000,21 @@
+           break;
+         }
+     }
++      if (-1 != fd)
++      {
++        int error = arch_specific_checks(fd, name, ehdr);
++        if (EINVAL == error)
++          {
++            goto close_and_out;
++          }
++        if (0 != error)
++          {
++            errstring = N_("Unable to run arch-specific checks\n");
++            goto call_lose;
++          }
++      }
++
++    }
+ 
+   return fd;
+ }

found that here: http://www.mail-archive.com/debian-glib ... 47001.html

Which makes me think I might have something compiled as armv7 -- but I didn't rebuild glibc or any of its dependencies, so it should all be armv5 (I did recompile busybox, but I compiled it for armv5te and you're already running busybox inside the initrd).

Please add the "debug" cheatcode to /porteus/excheat, which will give you a shell several times (hit ctrl-D to advance to the next stage). When you see "changing root directory" and get a shell, then try running ldd on /bin/busybox, /lib/libc.so*, /union/sbin/init, and /union/lib/libc.so*. On my end, I'll need to compile an armv5 or armv6 kernel with aufs support so I can test this in qemu.

Thanks again!
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
Hugh Johnson
White ninja
White ninja
Posts: 13
Joined: 04 Jan 2011, 14:21
Location: San Diego, CA

Re: Porteus-ARM for the Raspberry Pi

Post#4 by Hugh Johnson » 13 Mar 2013, 19:12

Perhaps I did it wrong but adding the debug cheat code doesn't seem to do anything at all. In fact no cheat codes seem to work, I tried a couple just to see.

I did copy my /lib folder to /porteus/lib/ and got further along, it even tried to start X but failed there, and wouldn't give me a virtual terminal.

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: Porteus-ARM for the Raspberry Pi

Post#5 by Ahau » 13 Mar 2013, 20:39

yeah, the debug cheatcode doesn't seem to work on my end either. I had an armv6 kernel that was booting up to "starting udev" yesterday and today when I tried it again with debug, it skipped debug but then booted into xfce. I'll keep looking on my end.

When you say you copied /lib to /porteus/lib, do you mean you copied another OS's lib files into /porteus/rootcopy/lib? I just want to be clear on exactly what files you placed where, so I know what got it past that message. If you just put files inside /porteus/lib on your SD card (rather than rootcopy or building a module) then they shouldn't have any effect at all.
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: Porteus-ARM for the Raspberry Pi

Post#6 by Ahau » 13 Mar 2013, 21:27

Regarding the lack of a virtual terminal -- I've commented out all the serial ports in /etc/inittab, nothing I'm using seems to need them (they're commented out in Porteus as well) -- It looks like the Raspberry Pi uses it's serial port to connect to the console--so it might be worth trying to add a line for /dev/ttyAMA0 back to /etc/inittab. I wasn't getting a VT on my tablet, either until I added some device nodes inside the initramfs, /dev/console, /dev/null and /dev/zero IIRC. For some reason, they need to be in place prior to mounting devtmpfs.

EDIT: not positive, but I think the line in /etc/inittab needs to look like this:

s0:12345:respawn:/sbin/agetty 115200 -L ttyAMA0 vt100
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
Hugh Johnson
White ninja
White ninja
Posts: 13
Joined: 04 Jan 2011, 14:21
Location: San Diego, CA

Re: Porteus-ARM for the Raspberry Pi

Post#7 by Hugh Johnson » 13 Mar 2013, 21:32

Ahau wrote: When you say you copied /lib to /porteus/lib, do you mean you copied another OS's lib files into /porteus/rootcopy/lib?
Yes that's exactly what I mean, sorry should have been more clear. I copied the stock raspian or whatever /lib into the /porteus/rootcopy/ folder and it got past that message but got hung up on starting X.

User avatar
Hugh Johnson
White ninja
White ninja
Posts: 13
Joined: 04 Jan 2011, 14:21
Location: San Diego, CA

Re: Porteus-ARM for the Raspberry Pi

Post#8 by Hugh Johnson » 13 Mar 2013, 21:47

Ok I got debug working, by adding it to the cmdline.txt on the boot partition.

What should I be looking for?

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: Porteus-ARM for the Raspberry Pi

Post#9 by Ahau » 13 Mar 2013, 22:17

ahh, good, you can manage cheatcodes without excheat :)

I would also add the 'lxde' cheatcode, because it sounds like it won't get in there from excheat. if you manage to get to the gui, lxde will probably run more smoothly than xfce.

next, I would add "changes=/porteus" so that you'll start saving changes onto your sdcard. Then uncomment and modify the "s0:" line in /etc/inittab and put the modified version at /porteus/rootcopy/etc/inittab. You can get a copy of /etc/inittab out of the module (001-core-3-11.xzm) by either copying the module into an x86 version of porteus and running 'mloop 001-core-3-11.xzm' and pulling it from /mnt/loop/etc/inittab, by unsquashing the module in some other linux, or by booting on the pi with debug and after you've mounted modules but before it chroots to the live filesystem you can copy it from /union/etc/inittab to /mnt/mmcblk?p?, then pull the sdcard and plug it into another computer. I apologize if it's tough task for you. I'm stuck in windows atm
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: Porteus-ARM for the Raspberry Pi

Post#10 by Ahau » 13 Mar 2013, 22:26

After you add "changes=", you'll be able to pull the sdcard, put it in a working system, and copy the whole /var/log folder out of /porteus/changes/var, and send it to me :)

Thank you so much for taking the time to help out!
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: Porteus-ARM for the Raspberry Pi

Post#11 by Ahau » 13 Mar 2013, 22:39

Ah-hah! I had the kernel configured such that it replaced the kernel cmdline with the bootloader args instead of appending them. That's why excheat was broken, and may partially explain the virtual terminal trouble. Recompiling now.

EDIT: here it is: http://porteus-arm.googlecode.com/files ... -13.tar.gz

uploaded from a bus's wifi, hopefully there's no corruption!
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
Hugh Johnson
White ninja
White ninja
Posts: 13
Joined: 04 Jan 2011, 14:21
Location: San Diego, CA

Re: Porteus-ARM for the Raspberry Pi

Post#12 by Hugh Johnson » 14 Mar 2013, 18:46

I'm posting this from Porteus running on the Raspberry Pi!! It's pretty slow, but the Pi is slow in general.

Great work Ahau!!!

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: Porteus-ARM for the Raspberry Pi

Post#13 by Ahau » 14 Mar 2013, 20:27

Great, thanks Hugh!

Ok, while I still don't have a Pi of my own to play with, the kernel I just posted today at http://porteus-arm.googlecode.com/files ... -14.tar.gz

Is now working out of the box to boot a Raspberry Pi into the GUI with network support!

If anyone with a Pi would like to install it and take a look at what other configuration/firmware, etc would be good to add, please do so, and I can work on building a Pi-specific module that will include the various settings and firmware needed to optimize your Porteus-ARM experience :)


Another big thanks to Hugh, he's been really helpful in testing to get us this far!
Please take a look at our online documentation, here. Suggestions are welcome!

User avatar
Hugh Johnson
White ninja
White ninja
Posts: 13
Joined: 04 Jan 2011, 14:21
Location: San Diego, CA

Re: Porteus-ARM for the Raspberry Pi

Post#14 by Hugh Johnson » 14 Mar 2013, 20:36

Ahau wrote:Another big thanks to Hugh, he's been really helpful in testing to get us this far!
It was all you man, all I did was plug it in and try a few things. Now lets get it working on a more powerful system. :good:

qbicdesign
White ninja
White ninja
Posts: 12
Joined: 24 Mar 2013, 20:40
Distribution: Ubuntu
Location: Estonia

Re: Porteus-ARM for the Raspberry Pi

Post#15 by qbicdesign » 19 Apr 2013, 12:17

Hugh Johnson wrote:I'm posting this from Porteus running on the Raspberry Pi!! It's pretty slow, but the Pi is slow in general.

Great work Ahau!!!
I must admit to most of the content of this thread being totally over my head, buts its exciting stuff anyway. I just bought a Raspberry Pi Model B, with the intention of running Raspbmc on it. But the nice thing is that all you need to run something else is another SD card. Porteus is on my playlist ;)

Just out of interest, what version of the Raspberry Pi are you using? Model A or B?

Post Reply