Gentoo on Integricloud

Integricloud gave me access to their infrastructure to track some issues on ppc64 and ppc64le.

Since some of the issues are related to the compilers, I obviously installed Gentoo on it and in the process I started to fix some issues with catalyst to get a working install media, but that’s for another blogpost.

Today I’m just giving a walk-through on how to get a ppc64le (and ppc64 soon) VM up and running.

Preparation

Read this and get your install media available to your instance.

Install Media

I’m using the Gentoo installcd I’m currently refining.

Booting

You have to append console=hvc0 to your boot command, the boot process might figure it out for you on newer install medias (I still have to send patches to update livecd-tools)

Network configuration

You have to manually setup the network.
You can use ifconfig and route or ip as you like, refer to your instance setup for the parameters.

ifconfig enp0s0 ${ip}/16
route add -net default gw ${gw}
echo "nameserver 8.8.8.8" > /etc/resolv.conf
ip a add ${ip}/16 dev enp0s0
ip l set enp0s0 up
ip r add default via ${gw}
echo "nameserver 8.8.8.8" > /etc/resolv.conf

Disk Setup

OpenFirmware seems to like gpt much better:

parted /dev/sda mklabel gpt

You may use fdisk to create:
– a PowerPC PrEP boot partition of 8M
– root partition with the remaining space

Device     Start      End  Sectors Size Type
/dev/sda1   2048    18431    16384   8M PowerPC PReP boot
/dev/sda2  18432 33554654 33536223  16G Linux filesystem

I’m using btrfs and zstd-compress /usr/portage and /usr/src/.

mkfs.btrfs /dev/sda2

Initial setup

It is pretty much the usual.

mount /dev/sda2 /mnt/gentoo
cd /mnt/gentoo
wget https://dev.gentoo.org/~mattst88/ppc-stages/stage3-ppc64le-20180810.tar.xz
tar -xpf stage3-ppc64le-20180810.tar.xz
mount -o bind /dev dev
mount -t devpts devpts dev/pts
mount -t proc proc proc
mount -t sysfs sys sys
cp /etc/resolv.conf etc
chroot .

You just have to emerge grub and gentoo-sources, I diverge from the defconfig by making btrfs builtin.

My /etc/portage/make.conf:

CFLAGS="-O3 -mcpu=power9 -pipe"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable beforee
 changing.
CHOST="powerpc64le-unknown-linux-gnu"

# NOTE: This stage was built with the bindist Use flag enabled
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"

USE="ibm altivec vsx"

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C
ACCEPT_KEYWORDS=~ppc64

MAKEOPTS="-j4 -l6"
EMERGE_DEFAULT_OPTS="--jobs 10 --load-average 6 "

My minimal set of packages I need before booting:

emerge grub gentoo-sources vim btrfs-progs openssh

NOTE: You want to emerge again openssh and make sure bindist is not in your USE.

Kernel & Bootloader

cd /usr/src/linux
make defconfig
make menuconfig # I want btrfs builtin so I can avoid a initrd
make -j 10 all && make install && make modules_install
grub-install /dev/sda1
grub-mkconfig -o /boot/grub/grub.cfg

NOTE: make sure you pass /dev/sda1 otherwise grub will happily assume OpenFirmware knows about btrfs and just point it to your directory.
That’s not the case unfortunately.

Networking

I’m using netifrc and I’m using the eth0-naming-convention.

touch /etc/udev/rules.d/80-net-name-slot.rules
ln -sf /etc/init.d/net.{lo,eth0}
echo -e "config_eth0=\"${ip}/16\"\nroutes_eth0="default via ${gw}\"\ndns_servers_eth0=\"8.8.8.8\"" > /etc/conf.d/net

Password and SSH

Even if the mticlient is quite nice, you would rather use ssh as much as you could.

passwd 
rc-update add sshd default

Finishing touches

Right now sysvinit does not add the hvc0 console as it should due to a profile quirk, for now check /etc/inittab and in case add:

echo 'hvc0:2345:respawn:/sbin/agetty -L 9600 hvc0' >> /etc/inittab

Add your user and add your ssh key and you are ready to use your new system!

Alive again

During August I was supposed to prepare something new for the LScube project.
I was supposed to do a bit more for the Summer of Code (Sorry Keiji and Seraphim) and the FFmpeg project (libswscale isn’t yet in shape I know).

Sadly I spent about a month with a bad pneumonia and just now I’m starting to catch up really. (I hoped to stay better before but, as my 2 miss on council meetings shown, wasn’t ok yet)

Diego is doing a wonderful job rationalizing LScube suite, Ale almost finished his Flux (started as a way to show me that C++ isn’t the problem, just people misusing it), Michael decided to make libswscale the default in FFmpeg forcing more people taking care about it.

What now?

Well first I’ll try to not miss new council meetings (and I’ll ask Chrissy and Diego to back me up when happens I cannot be there).

I have some pending stuff about libswscale that will end up having a better structure to provide arch specific optimizations, once they hit I’ll try to do again a witch hunt over ffmpeg using applications to provide the new libavcodec in portage.

Hopefully the next feng (and friends) release will hit portage and the stale fenice and libnemesi will be replaced accordingly ^^;

There is plenty of new stuff on the CELL land to be tried and provided (like mars)

I’ll try to take some time to merge the openmoko patches to the new (and gcc-4 building) qemu so I won’t have to provide an qemu-openmoko to help people interested in getting Gentoo on the freerunner (openrc could help a bit the boot time possibly and bitbake is a bit annoying from time to time)

Last but not least Syoyo is getting his blazing fast renderer Lucille to be usable even by common people.

Lots is happening (with and without me) =)

What news?

Lately I started to test some stuff, after hammering openrc inside bsd jails I started to use it on my laptop, the ps3 and the new phenom I bought recently. So far I hadn’t anything to complain but just minor glitches that got promptly addressed by Roy. With the help of the other testers and developer you’ll get baselayout 2 soon and in a pretty good shape.

Feng and felix got quite an overhaul and hopefully I’ll release them once I cleaned up the code:
– felix had lots of experimental stuff added and you may not want it nor look at it right now.
– feng is getting the eventloop reshaped so that you can understand what’s doing w/out losing your sanity.

I’m still waiting for more SoC applications (in particular people willing to learn CELL seems fewer than we’d like) you have this week left to apply!

gcc-4.3 landing and other random stuff

gcc-4.3 seems to be released and I already started building it (right now spu-elf target being built while the powerpc64-unknown-linux-gnu quickpkg is being uploaded to the devspace for the people needing it). I got my alubook back and seems working fine, many thanks to
http://www.pixel.it/ for being that quick in fixing it. Now I’m waiting for the battery replacement and I should be more or less back on business.

The stuff I’m doing at LScube is shaping up nicely and I hope to have the next feng release, sporting the lighttpd and other major changes, out soon (It’s nice to have shared configuration across services ^^;). Soon I’ll update the efika setup and I’ll ask you to hammer it again ^^

ide-pmac lost interrupt, dma status: 8080

Looks like the tibook I’m using while the alubook is hopefully being repaired is dying. I’m not exactly sure if the problem is due the disk or the controller, surely that is even more unexpected…

The alubook will be hopefully back in shape in a while (I won’t believe till I have it back!)… Meanwhile I’m still thinking about what to get as workstation since this experience made me look for a workstation AND a newer laptop. I’m open to suggestions, right now I’m looking at a
phenom gear for the workstation and a laptop from enface.it

This http://www.enface.it/ita/octave150w.php looks nice for that pricetag, pity the lcd resolution is lower than the one I’m using right now (and it’s a tibook! an older than 5 years laptop!). I like durable system, possibly with a decent batter life and that aren’t too bulky… Anything you could suggest?

Sigh, I have no reason to overspend for an Apple since it now it doesn’t provide an interesting powerpc and building my own laptop out of a powerpc current design could be a too costly exercise…

For a week or more I’ll be less than present and active =/

Some random updates

First of all I’m eventually snapshotting a newer ffmpeg, I’ll need some help to get it play nice with all the other applications. The new ffmpeg has lots of improvements but it changes its api slightly so every application should update accordingly, time has passed so I hope upstream caught up with the change.

Once it will be unmasked I’ll hopefully put the next release of feng in portage, currently I’m studying lighttpd internals in order to

  • Have feng using the same lighttpd syntax for configuration
  • Improve its behavior as server

So far I started importing lighttpd datatypes and lemon based parser directly in a separate branch and reshaping a bit feng in order to make it more rational. First thing learnt from lighttpd: keep everything in instance variables.

In the other news my alubook got its fan broken (and the tibook is in the same sorry shape), if you know where to find replacement parts for it please tell me (bonus if they aren’t that pricey).

Alive, hopefully

You may wonder what I’m doing since has been a long time since the latest blog item, well I was busy trying to do too many thing, searching, traveling and so on.

Here a summary:

– I eventually released feng as you can see on http://live.polito.it
That involved getting the website up, writing lots of documentation (that hopefully someone will read), hacking the code to be in the right shape and making the whole bundle bearable for people with less understanding of autotools and dependencies… I hope the first release isn’t that ugly and I thank dario and alessandro for their help =)

– The ffmpeg bug tracker is taking shape eventually, hacking roundup isn’t the simplest thing in the world
mostly because examples and alternate templates aren’t available; the documentation saves the day most of the times anyway. you may see it on https://roundup.mplayerhq.hu/roundup/ffmpeg/

– On the cell side I started hacking a bit the build system in order to have it working for me (using gentoo, standard paths and stock gcc toolchain) and for the ones that are using the IBM sdk/fedora (bogus paths, shortened prefixes) I hope the people in charge of deciding what would be the standard for writing and running spu code would provide a sane default. Hopefully one I’ll have more time I’ll start writing something on my own, so far I’m just testing pathes and contributions by others ^^;

– the vorbis and theora rfc are proceedings and currently feng and gst are interoperable, I hope to complete the standardization and move to something else, it’s taking too much!

– my altivec work on cairo is still on hold, I hope to get enough time to push an update (since the ibm/sony mathlib has an implementation of vector integer division I could rip it and add some more vector ops in pixman).

– the SoC with ffmpeg has already started, so far I’m receiving some good feedbacks from my student and I’m trying to find the time to reread the dirac spec in order to follow him better.

That’s more or less all, the keyword of the whole document is TIME, lately the lscube involvement took a bit too much mostly because you cannot manage the time well if you have your plans spoiled every by unexpected priorities appearing out of the blue.

Misc updates again

I spent much of my time trying to get the whole LScube project more alive, so far it’s just a slow start:

I moved the development to git ( https://live.polito.it/gitweb ) and now I’m trying to update the website to a newer drupal and with more documentation. Since the forums are just a spam magnet I guess I’ll nuke them, if you want to contact us just use irc or email =P

I put the efika in use to stress test the streaming server, you can watch

rtsp://130.192.86.166/tc.mov

or

rtsp://130.192.86.166/ed.mov

(both streams are h264+mp3, not many clients could handle that… Yet)

Hopefully a Feng release will appear soon.

That’s for the streaming stuff.

Now, I have a ps3 working and eventually managed to configure and install it, I already found something itchy: git’s ppcsha1+64ul == KaBOOM, I hope it’s just due my test with bleeding edge compilers but I’m afraid not. So far I’m quite impressed by the ps3, just a pity I’m slow in doing something nice there…

More will follow

lu

something new, well not so much

Just a quick update :

– got the ps3 running and well, I must say that its quite cool
– got swamped in many other things and so I’m slowly configuring my network to get the ps3 on, in the process I managed to brick my first access point (a belkin that now I’ll have to hack a bit to recover if possibile…)
– the lscube tasks are proceding nicely, currently we eventually ironed out some bugs due mp3 and the compositing layer, for the ones not following: I’m working on a new streaming server called Feng, currently it streams h264 and mp3 and let you either just point an url to a container and automagically provide a sdp or, more interesting, let you define a special editlist so you can just provide a simple textfile with the files and the start and stop time and have aggregated streams on the fly, pretty interesting if we manage to complete it and then make it usable =)
– I still have to fix B frames support in h264 and then move on improving those framers or eventually implement vorbis and theora, the gst crew beat me at it but I’d like to be at least a close second ^^;
– I hope to cleanup the roundup setup and the site restyle for lscube soonish once the previous task got addressed since I’d like to get more people involved and the current framework still has some rough edges…

– I’ll start probably hacking on the bfin due a course I’m attending, I cannot say I really like the arch since is a bit irregular, still much nicer than x86 (expect ffmpeg patches about it soon^^)

– last but not least I have my laptop eventually back!

that said I guess you may know why I’m not much reactive on bugs (I promise I’ll try at least the blender ebuild and to provide updates to ffmpeg and mplayer ones during the week end) and I less than lively…

PS: Cocoa programming isn’t that nice…