How to build Wii U Gentoo:


I recently realized that Gentoo portage will break if not updated for more then a week. Here is a guide to build your own image with the updates needed. This is done using a x86_64 laptop running Kubuntu 22.04.

  1. Setting up a drive: Using a tool like gnome-disk-utility, gparted, or KDE partition manager. You can create a external USB drive formatted with a MBR partition table and a ext4 filesystem for the whole drive. I also recommend naming it “wiiu” so it will help when setting up fstab latter in the guide.

  2. Using a command line (you will need to be root for most of the guide from now on) you can find your drive you created using the command “lsblk” and and mount it using “mount /dev/ /mnt”.
    You may have to mount somewhere else if something is already mounted them and replace /mnt with that new path though this guide

  3. Go navigate to your drive by using “cd /mnt”. Now you can go to the Gentoo website and download a ppc (not ppc64 or ppc64el or completely different ISA) stage3 to the drive using wget.
    I did systemd since that is what modern Linux systems use and what I’m familiar with. If you prefer a UNIX / older Linux init system you can also go with openrc. There will be missing parts of the guide though in that case.

  4. When the stage 3 is downloaded, extracted as root by “tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner” on that drive. You can also at that point remove the .tar.xz file if no longer wanted.

  5. To get the Wii u Linux kernel. You can extract them from one of the old disk images of Gentoo here, or get an updated one from here.
    The vmlinux file goes into /mnt/boot and the contents of “/modules/lib/modules/4.19.*” goes into the “/mnt/lib/modules/*” folder.

  6. You will now need to edit the make.conf file by using this command “nano /mnt/etc/portage/make.conf” and make these changes:
    for “COMMON_FLAGS=” add “-mcpu=powerpc -mtune=powerpc”, Also add line ACCEPT_LICENSE="*" at the end of the file. Can save with nano by using Ctrl+X.

  7. You will need to add your DNS mirrors by “cp --dereference /etc/resolv.conf /mnt/etc/”

  8. Edit /mnt/etc/fstab and add this line (assuming you named the ext4 partition wiiu”
    LABEL=WiiUGentoo / ext4 noatime 0 1
    Save then close.

  9. Add a hostname. can use command “nano /mnt/etc/hostname” add a name (such as WiiGentoo) and save. Also run “nano /mnt/etc/hosts” and add “127.0.1.1 <my hostname>” on the second line and save.

  10. You will need the qemu system emulator for user space (can get by using “apt install qemu-user-static”) and chroot into the Wii U Gentoo Drive.
    Since your are likely using a Intel/AMD x86 computer or a ARM computer and not an IBM PowerPC one. I don’t know how to fully mount a drive for chroot without needing to reboot the computer to successfully unmount it.
    So it might be a better guide out here for this:
    
    A)Copy the static target ISA binary that provides emulation (in this case PowerPC 32bit BE):
    cp /usr/bin/qemu-ppc-static /mnt/usr/bin
    B) set up chroot: mount --types proc /proc /mnt/proc && mount --rbind /sys /mnt/sys && mount --make-rslave /mnt/sys && mount --rbind /dev /mnt/dev && mount --make-rslave /mnt/dev && mount --bind /run /mnt/run && mount --make-slave /mnt/run
    
    C) Start chroot:
    chroot /mnt qemu-ppc-static /bin/bash
    here you will set up a password for root. can just use the command “passwd” to set password. Gentoo wants a very strong password. can use anything common or simple even when its for something not sensitive.
    
    D) Set locales by using “nano /etc/locale.gen” and adding
    “en_US ISO-8859-1
    en_US.UTF-8 UTF-8”
    to the file and save/close. Run “locale-gen” to generate locales and then “eselect locale list” + “ eselect locale set ” to set locale.  Reload bash by “env-update && source /etc/profile && export PS1="(chroot) ${PS1}"”
    

  11. Can search your timezone by: “ls /usr/share/zoneinfo” then input it by “ln -sf ../usr/share/zoneinfo/Asia/Tokyo /etc/localtime” replace Asia/Tokyo with your Continent/City.

  12. Might want to enable time sync by “systemctl enable systemd-timesyncd.service”

  13. Enable the ssh service by “systemctl enable sshd”

  14. Set up systemd for first time use by
    
        a) systemd-machine-id-setup
        b) systemd-firstboot –prompt
        c) systemctl preset-all –preset-mode=enable-only
    
    

  15. You can now exit chroot and unmount. You might need to fully reboot your pc in order to work.

  16. The base drive should now be able to use on a Wii U and login. You will need a fw.img on the root of your SD/SDHC card in the Wii U SDHC card slot to boot into Wii U Linux. You can also only access the internet using a Wii Lan Adapter (No Wi-Fi).

  17. When at the login screen, Login as root with your password. This will follow a setup using systemd and only set up what is necessary. More details can be followed here https://wiki.gentoo.org/wiki/Handbook:PPC64/Installation/Base . Make sure you can get internet.

  18. You can start to build the wanted software. This can take a very long time on the Wii U CPU (days even for just cli apps). By running these commands in order:
    
        a) “emerge-webrsync"
        b) “eselect profile list” (this will show what type of gentoo install you will have. I do not recommended having a desktop, the Wii U CPU is way too slow and will probably take weeks to compile).
        c) “eselect profile set ” d) “emerge --ask --verbose --update --deep --newuse @world” .
    

  19. After a very long while. You will likely want the packages of bash completion, sudo, and dhcpd by: “emerge --ask app-shells/bash-completion app-admin/sudo net-misc/dhcpcd”

  20. Can create a new user by:
    
    A) “useradd -m -G users,wheel,audio -s /bin/bash mii”
    B) “passwd mii”
    C) “nano /etc/sudoers” and add “mii    ALL=(ALL:ALL) ALL”
    *This is using the name mii as a username example.
    

Source | Date: Dec 14th 2023

Back