Running Linux on a PowerBook 180

demik

Well-known member
Hello everyone !

Introduction
This is more of a note. I wanted a Linux install on my lab PowerBook and had some success after a few tries so here is how it was done.
That thing even runs custom modern Linux kernel (6.1.22), which is the latest LTS kernel available as of now !

The issue with this PowerBook series, is that the PMU isn't really supported (no keyboard/ADB/Power), so you have to resort to either to a serial installation or bootstrap from another system. Had a few issues with install ramdisks as well (too little memory), hence why I did the bootstrap method

Due to the low memory ceiling on a PowerBook 180, I choose to install a Debian "Potato" 2.2. It's kinda old, but was released in 2002, so early Mac OS X era.

Requirements
This tutorial will require some sort of modern SD-Card based SCSI disk.
The setup used was:
- PowerBook 180
- System 7.5.5
- ZuluSCSI from @rabbitholecomputing
- RAM Module from @Siliconinsider
- 8-10 MB of RAM should work

A dual disk setup is are recommended. One for each OS.
Install System 7.1 or 7.5 on your first disk.
For Linux, a 500-600MB should be fine. I choose to emulate an old Quantum PD1800S (1.80 GB / 3517856 512-byte blocks)

Partition your second disk using "Apple HD SC Setup" 7.5.3 as follow :
- Macintosh partition, size ± 100MB
- A/UX root partition, size ± 300MB or more
- A/UX swap partition, size 28MB
- Other A/UX Misc partitions if needed (for /home, etc)

As seen under Linux
Code:
powerbook:~# mac-fdisk -l /dev/sdc
Disk /dev/sdc
        #  type name          length   base    ( size )  system
/dev/sdc1   map Apple             63 @ 1       ( 31.5k)  Partition map
/dev/sdc2  Dr43 Macintosh         32 @ 64      ( 16.0k)  Driver 4.3
/dev/sdc3   HFS MacOS         204800 @ 96      (100.0M)  HFS
/dev/sdc4  unix Root file sy 2097520 @ 204896  (  1.0G)  Linux native
/dev/sdc5  unix Swap           57344 @ 2302416 ( 28.0M)  Linux swap
/dev/sdc6  unix Random A/UX  1158088 @ 2359760 (565.5M)  Linux native
/dev/sdc7  Free Extra              8 @ 3517848 (  4.0k)  Free space

Block size=512, Number of Blocks=3517856

The drive is named "sdc" because it's the third SCSI Disk on this system

Install Penguin-19 on the HFS partition, along with linux kernels. Drive listing for reference:
  • Penguin-19
  • linux
  • vmlinux-4.14.309-mac-backport+
  • vmlinux-4.14.309-mac-backport+.gz
  • vmlinux-4.4.302-dart
  • vmlinux-4.4.302-dart.gz
  • vmlinux-6.1.22-dart
  • vmlinux-6.1.22-dart.gz
  • vmlinuz-2.2.25-mac
  • vmlinuz-2.6.8-mac
Bootstraping
For this step, you need to use your disk image with a 68k emulator running Linux (Aranym or QEMU), or use another 68k Linux install
I'm using Aranym, the powerbook linux disk image is hdb below. You will need debootstrap

• Create file systems and swap
Code:
aranym:~# mkfs.ext2 /dev/hdb4
aranym:~# mkfs.ext2 /dev/hdb6
aranym:~# mkswap -v1 /dev/hdb5

• mount the root file system
Code:
aranym:~# mount /dev/hdb4 /mnt

• Bootstrap using debootstrap the operating system
Code:
aranym:~# debootstrap --no-check-gpg potato /mnt http://archive.debian.org/debian

That's about it. You should have a basic system installed now. It needs some configuration

• Create devices files
Code:
aranym:~# chroot /mnt
aranym:~# cd /dev
aranym:~# MAKEDEV generic-m68k
aranym:~# exit

• Mount special devices, chroot again into your install and configure a few things
Code:
aranym:~# mount -o bind /dev /mnt/dev
aranym:~# mount -o bind /proc /mnt/proc
aranym:~# chroot /mnt

• configure fstab.
You need to configure fstab according to your system. here is mine for reference :
Code:
powerbook:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>                       <dump>  <pass>
/dev/sdc4       /               ext2    defaults,errors=continue        0       0
/dev/sdc5       none            swap    sw                              0       0
/dev/sdc6       /home           ext2    defaults                                2
proc            /proc           proc    defaults                        0       0
/dev/fd0        /floppy         auto    defaults,user,noauto            0       0
/dev/cdrom      /cdrom          iso9660 defaults,ro,user,noauto         0       0

Setup hostname (files /etc/hostname and /etc/hosts)
Code:
powerbook:~# echo "powerbook" > /etc/hostname
powerbook:~# echo "127.0.0.1 powerbook localhost" /etc/hosts

Now it's a good time to add additional packages as well
Code:
powerbook:~# apt-get install sudo file minicom zsh ppp  macutils mac-fdisk hfsutils nano

Edit your inittab file, add a serial console
Code:
T0:23:respawn:/sbin/getty -L ttyS0 57600 vt100

ttyS0 is the modem port, ttyS1 the printer port. Using the modem port is recommended. The hardware will go as high as 57600, use 9600 as a safe value.

Tweaking
A few tweaks are needed. Before rebooting, you may want to do the following changes

• securetty
Add ttyS0 and ttyS1 at the end of /etc/securetty. This will allow you to log as root using a serial console

Booting Linux
To boot Linux, you need to boot MacOS without virtual memory or similar (no RAM Doubler, etc).
Your PowerBook will also need to be in 32-bit mode. Force32 by @cheesestraws may help here

Launch Penguin, go to settings, select kernel, set up serial ports and put the the kernel command line. I'm using something like :
Code:
root=/dev/sdc4 elevator=noop

But you may want to add console=ttyS0,57600 if you want the boot serial console.

After a few moment, you should have the Linux prompt. Connect using your serial port (I had success using ClarisWorks and another Mac, or a modern Mac with an USB to RS232 cable and a RS232 to RS422 cable (Lindy 30249 from Amazon)

Penguin documentation is here http://www.mac.linux-m68k.org/docs/penguin.php

A few outputs and a photo
Code:
zulubook:~# uname -a
Linux zulubook 6.1.22-dart #1 Fri Mar 31 23:07:21 CEST 2023 m68k unknown
zulubook:~# cat /proc/hardware
Model:          Macintosh PowerBook 180
System Memory:  14336K
zulubook:~# cat /proc/cpuinfo
CPU:            68030
MMU:            68030
FPU:            68882
Clocking:       31.5MHz
BogoMips:       7.88
Calibration:    39424 loops
zulubook:~# free -m
             total       used       free     shared    buffers     cached
Mem:             9          9          0          0          2          3
-/+ buffers/cache:          3          6
Swap:           27          0         27

Full dmesg
Code:
Linux version 6.1.22-dart (demik@mint) (m68k-linux-gnu-gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #1 Fri Mar 31 23:07:21 CEST 2023
Saving 402 bytes of bootinfo
Detected Macintosh model: 33
 Penguin bootinfo data:
 Video: addr 0x60040000 row 0x140 depth 4 dimensions 640 x 400
 Videological 0xf0040000 phys. 0x60040000, SCC at 0x50f04000
 Boottime: 0x8b978450 GMTBias: 0x0
 Machine ID: 33 CPUid: 0x1 memory size: 0xe
Apple Macintosh PowerBook 180
Zone ranges:
  DMA      [mem 0x0000000000000000-0x0000000dffffffff]
  Normal   empty
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x0000000000000000-0x0000000000dfffff]
Initmem setup node 0 [mem 0x0000000000000000-0x0000000000dfffff]
pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
pcpu-alloc: [0] 0
Built 1 zonelists, mobility grouping off.  Total pages: 3552
Kernel command line: root=/dev/sdc4 elevator=noop
Kernel parameter elevator= does not have any effect anymore.
Please use sysfs to set IO scheduler for individual devices.
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
Sorting __ex_table...
mem auto-init: stack:off, heap alloc:off, heap free:off
Memory: 9644K/14336K available (3094K kernel code, 247K rwdata, 1004K rodata, 124K init, 93K bss, 4692K reserved, 0K cma-reserved)
NR_IRQS: 72
clocksource: via1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 2439823894983 ns
Console: colour dummy device 80x25
printk: console [tty0] enabled
Calibrating delay loop... 7.88 BogoMIPS (lpj=39424)
pid_max: default: 4096 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
devtmpfs: initialized
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 16 (order: -5, 192 bytes, linear)
NET: Registered PF_NETLINK/PF_ROUTE protocol family
DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations
DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
NuBus: Scanning NuBus slots.
SCSI subsystem initialized
clocksource: Switched to clocksource via1
NET: Registered PF_INET protocol family
IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
tcp_listen_portaddr_hash hash table entries: 1024 (order: 0, 4096 bytes, linear)
Table-perturb hash table entries: 16 (order: -6, 64 bytes, linear)
TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
TCP: Hash tables configured (established 1024 bind 1024)
UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
NET: Registered PF_UNIX/PF_LOCAL protocol family
workingset: timestamp_bits=30 max_order=12 bucket_order=0
crc32: CRC_LE_BITS = 32, CRC_BE BITS = 32
crc32: self tests passed, processed 225944 bytes in 7711653 nsec
crc32c: CRC_LE_BITS = 32
crc32c: self tests passed, processed 112972 bytes in 3790083 nsec
crc32_combine: 8373 self tests passed
crc32c_combine: 8373 self tests passed
macfb: framebuffer at 0x60040000, mapped to 0x(ptrval), size 125k
macfb: mode is 640x400x4, linelength=320
Console: switching to colour frame buffer device 106x36
fb0: GSC frame buffer device
scc.0: ttyS0 at MMIO 0x50f04002 (irq = 4, base_baud = 230400) is a Z85c30 ESCC - Serial port
scc.1: ttyS1 at MMIO 0x50f04000 (irq = 4, base_baud = 230400) is a Z85c30 ESCC - Serial port
Non-volatile memory driver v1.3
brd: module loaded
loop: module loaded
Warning: no ADB interface detected
scsi host0: Macintosh NCR5380 SCSI, irq 19, io_port 0x0, base 0x50010000, can_queue 16, cmd_per_lun 2, sg_tablesize 1, this_id 7, flags { }
scsi 0:0:0:0: Direct-Access     CDC      ZuluSCSI HDD     1.1  PQ: 0 ANSI: 2 CCS
scsi 0:0:1:0: Direct-Access     SEAGATE  ST11200N         8334 PQ: 0 ANSI: 2 CCS
scsi 0:0:2:0: Direct-Access     QUANTUM  PD1800S          3161 PQ: 0 ANSI: 2 CCS
scsi 0:0:3:0: CD-ROM            MATSHITA CD-ROM CR-8005A  4.0i PQ: 0 ANSI: 2 CCS
scsi 0:0:4:0: Direct-Access     IOMEGA   BETA230          1.1  PQ: 0 ANSI: 2 CCS
sr 0:0:3:0: [sr0] scsi-1 drive
cdrom: Uniform CD-ROM driver Revision: 3.20
sd 0:0:0:0: [sda] 1024064 512-byte logical blocks: (524 MB/500 MiB)
sd 0:0:1:0: [sdb] 2059140 512-byte logical blocks: (1.05 GB/1005 MiB)
sd 0:0:2:0: [sdc] 3517856 512-byte logical blocks: (1.80 GB/1.68 GiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 68 00 00 08
sd 0:0:1:0: [sdb] Write Protect is off
sd 0:0:1:0: [sdb] Mode Sense: 68 00 00 08
sd 0:0:2:0: [sdc] Write Protect is off
sd 0:0:2:0: [sdc] Mode Sense: 68 00 00 08
sd 0:0:4:0: [sdd] 471040 512-byte logical blocks: (241 MB/230 MiB)
sd 0:0:0:0: [sda] Cache data unavailable
sd 0:0:0:0: [sda] Assuming drive cache: write through
sd 0:0:1:0: [sdb] Cache data unavailable
sd 0:0:1:0: [sdb] Assuming drive cache: write through
sd 0:0:2:0: [sdc] Cache data unavailable
sd 0:0:2:0: [sdc] Assuming drive cache: write through
sd 0:0:4:0: [sdd] Write Protect is off
sd 0:0:4:0: [sdd] Mode Sense: 68 00 00 08
sd 0:0:4:0: [sdd] Cache data unavailable
sd 0:0:4:0: [sdd] Assuming drive cache: write through
sr 0:0:3:0: Attached scsi CD-ROM sr0
 sdb: [mac] sdb1 sdb2 sdb3 sdb4
 sda: [mac] sda1 sda2 sda3
 sdc: [mac] sdc1 sdc2 sdc3 sdc4 sdc5 sdc6 sdc7
sd 0:0:1:0: [sdb] Attached SCSI disk
 sdd: [mac] sdd1 sdd2 sdd3 sdd4
sd 0:0:0:0: [sda] Attached SCSI disk
sd 0:0:2:0: [sdc] Attached SCSI disk
sd 0:0:4:0: [sdd] Attached SCSI removable disk
PPP generic driver version 2.4.2
PPP BSD Compression module registered
PPP Deflate Compression module registered
NET: Registered PF_PPPOX protocol family
SLIP: version 0.8.4-NET3.019-NEWTTY (dynamic channels, max=256).
CSLIP: code copyright 1989 Regents of the University of California.
SLIP linefill/keepalive option.
via_read_time: failed to read a stable value; got 0x07f9a9ea then 0x07f9a9f4
rtc-generic rtc-generic: registered as rtc0
via_read_time: failed to read a stable value; got 0x07f9f06b then 0x07f9f075
rtc-generic rtc-generic: setting system clock to 1970-01-01T00:00:00 UTC (0)
NET: Registered PF_PACKET protocol family
VFS: Mounted root (ext2 filesystem) readonly on device 8:36.
devtmpfs: mounted
Freeing unused kernel image (initmem) memory: 124K
This architecture does not have kernel memory protection.
Run /sbin/init as init process
  with arguments:
    /sbin/init
  with environment:
    HOME=/
    TERM=linux
process '/sbin/init' started with executable stack
random: crng init done
Adding 28668k swap on /dev/sdc5.  Priority:-2 extents:1 across:28668k

linuxlogo.jpeg


Bottom line
I build a custom kernel for this (6.1.22-dart). You can also use the kernel build by Finn Thain here
The 6.1.22 is running very well on that hardware, given it's about 30 years newer. 4.14 is fine as well, 4.4 is slower for some reason and I cannot recommend older kernels as a log of bugs were fixed in recent releases.

If someone need that kernel or config file, just message me.
 
Last edited:

AndiS

Well-known member
This is pretty awesome. Debian Potato was the first Linux I installed (While I was happily running MacOS 9 and X). I installed it on a Performa 475 back around potato's release and took my first steps into this new World

Nowadays I use Linux exclusively and Macs are only a Nostiagia thing. But with Linux on M2 even this might change again ;-)
 

cbmuser

New member
Debian is also still providing updated installation images for m68k machines:


Downside is you will need sufficient amount of RAM for the current kernel configurations.

We're planning a small footprint memory kernel configuration in the near future though.

Adrian
 

lauland

New member
I'm assuming the Aranym/qemu mkfs step is needed due to the kernel using endian-swapped filesystems (for speed), correct?

I've had Debian on a Performa 630 (with full '040 swapped for lc version) for years, so could build the filesystem there.

Would love to have linux on my 540, but, of course, no fpu...
 

demik

Well-known member
Not really, it was because of two tho things :
- not enough RAM for the installer
- no ADB working.

As far as I know, ext2 is always written in little-endian. I used aranym because running m68k binaries was easier, you could probably have gone with any other old Linux host for that
 

lauland

New member
Ha! Showing my age. I actually contributed early fixes to the 1.x kernel for m68k, way back when it was new (on my Amiga). The first versions used a byte swapped filesystem for speed (I think?). I never checked that they'd switched to little endian (like everyone else).

Such a bummer that ADB doesn't work on (some) powerbooks. Wonder why it's been difficult...you wouldn't think the chips would be THAT different, and, although never officially documented, people could look at the working *BSD code to see how to do it.

It's possible it's just because there's so few m68k linux devs out there, and interest in the '030 powerbooks isn't high since they're slow, and memory is limited. If that's the case, it might be something like nobody's taken the time to figure out the correct interrupts or io ports. Not promising anything, but, once I get it actually running on my 180 with a serial console, it's something I can look into...I can build test kernels on my quadra.

I was trying to use the installer on the internal drive and running into all the problems you had...your awesome notes should help me get it going!
 
Top