# iBook G4 - 9.0 release



## gudismonsta (Nov 10, 2012)

Hi All,

Inspired by a recent re-read of Absolute FreeBSD by M.Lucas, and Taz's post on a lean desktop setup, i decided to re-purpose an old PPC iBook G4.
I downloaded and installed with EASE the latest FreeBSD 9.0 Release for PPC. - Much easier then the older version. no stuffing about with booting options. It just worked.

But, i'm here with a few issues 

*1. CPU speed:*
The attached dmesg below indicates half my cpu capacity. Building source/ports is slow, but it might just be the old hardware 
How do i know what cpu speed im running at ?
If i am at halfspeed, how can i fix this ?


*2. Wireless trouble*
Currently using wired connection.
Following the handbook and a number of posts and guides, ive think ive done things right.
the apple wireless card is meant to be supported by the BWI driver, but i also added the BWN just in case 
the dmesg shows the .ko files both missing dependencies

After a reboot an ipfconfig shows 3 interfaces:
fwe0 - ethernet over firewire
gem0 - ethernet (currently used)
lo0 - loopback

if i load it manually trying the BWN:

```
# kldload /boot/kernel/if_bwn.ko
```
appears to work and i get an additional interface BWN0
however logs indicate otherwise : /var/log/messages

```
Nov 10 17:37:24 freebook kernel: bwn-open_v4_ucode5: could not load firmware image, error 2
Nov 10 17:37:24 freebook kernel: bwn0: the fw file(bwn-open_v4_ucode5) not found
```

BWI has same errors:

```
Nov 10 16:27:22 freebook kernel: bwi0: request firmware bwi_v3_ucode failed
Nov 10 16:27:22 freebook kernel: bwi0: bwi_init_statechg: error 12 on MAC init
```
Nov 10 16:51:33 freebook kernel: KLD file if_bwi.ko is missing dependencies


Is the "bwi_v3_ucode" the missing dependancy. if so, how is that loaded ?



*3. mouse right click*
XOrg + OpenBox
i got the builtin trackpad working. like most apples this model does not have a right click. with osx i had to combine the option button (i think).
How can i enable a similar feature
Current work around is to use old MS usb laser mouse.


*4. battery monitoring*
ACPI / APM - seems to have none of these.. is this a ppc thing ? all ref seem to indicate it should be there.
sysutils/hwstats - installed, seems to require the above
error - hwstat: /dev/acpi: No such file or directory
Any thoguhts ?


===========================

If i can get things working in the CLI, then i wont be dependent on fancy WM stuff 

Thanks in advance..
viva BSD


===


SPECS and FILES:

14" iBook G4 - 1GHz PowerPC G4 - 768Mb Ram - 40Gb HDD
Optional Airport Extreme Wireless B/G Card installed.
All HW working - OSX 10.5.8 has been running no issues.
OSX system reported cpu as 1.07 ghz (known feature)
OSX wireless working on both wep and wpa to linksys and apple routers.

hw link:
http://www.everymac.com/systems/apple/ibook/specs/ibook_g4_1.0_14_2.html
http://lowendmac.com/ibooks/14in-ibook-g4-1.2-ghz.html




```
> uname -a
FreeBSD freebook 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Wed Jan  4 08:17:39 UTC 2012     marcel@xserve.lan.xcllnt.net:/usr/obj/usr/src/sys/GENERIC  powerpc
```


```
> cat /boot/loader.conf
# apple wireless card
#if_bwi_load="YES"
#wlan_load="YES"
#wlan_wep_load="YES"
#wlan_ccmp_load="YES"
#wlan_tkip_load="YES"
if_bwi_load="YES"
if_bwn_load="YES"
```


```
> cat /etc/rc.conf
hostname="freebook"
ifconfig_gem0="DHCP"
sshd_enable="YES"
moused_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
moused_port="/dev/ams0"
wlans_bwi0="wlan0"
ifconfig_wlan0="ssid localnet WPA DHCP"
```



```
> dmesg | head -n 15
Copyright (c) 1992-2012 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 9.0-RELEASE #0: Wed Jan  4 08:17:39 UTC 2012
    marcel@xserve.lan.xcllnt.net:/usr/obj/usr/src/sys/GENERIC powerpc
KLD file if_bwi.ko is missing dependencies
KLD file if_bwn.ko is missing dependencies
cpu0: Motorola PowerPC 7447A revision 1.1, 535.13 MHz
cpu0: Features 9c000000<PPC32,ALTIVEC,FPU,MMU>
cpu0: HID0 8450c0bc<EMCP,TBEN,NAP,DPM,ICE,DCE,SGE,BTIC,LRSTK,FOLD,BHT>
real memory  = 790134784 (753 MB)
avail memory = 759328768 (724 MB)
kbd0 at kbdmux0
nexus0: <Open Firmware Nexus device>
```


----------



## wblock@ (Nov 10, 2012)

Don't load both bwi(4) and bwn(4) if you only need one.  Read both man pages and you'll see that the firmware is provided in ports.


----------



## initpy (Nov 11, 2012)

> If i am at halfspeed, how can i fix this ?



According to Nathan Whitehorn [1], ibooks boot at half speed, you can fix that with 
	
	



```
sysctl dev.cpu.0.freq=1000
```

And you can make this change permanent by adding it to /etc/sysctl.conf

Also, this page might help: https://sites.google.com/site/tingox/ibook_g4_freebsd

[1]: http://lists.freebsd.org/pipermail/freebsd-ppc/2012-July/005770.html


----------



## gudismonsta (Nov 11, 2012)

Thanks Warren,
i also found a few of your posts.

Sorry for the long posts, but i don't believe in too much detail. 

11/NOV: - A few updates.

cat of /boot/loader.conf
# apple wireless card
#if_bwi_load="YES"
#wlan_load="YES"
#wlan_wep_load="YES"
#wlan_ccmp_load="YES"
#wlan_tkip_load="YES"
if_bwi_load="YES"
#if_bwn_load="YES"
if_bwi_v3_ucode_load="YES"


Manual load of driver 
	
	



```
# kldload /boot/kernel/if_bwi.ko
```
 returns a prompt after a moment.
If I look into the logs /var/log/messages seems to indicates that bwi is the right driver but cant load.

/var/log/messages

```
Nov 11 08:33:36 freebook kernel: bwi0: <Broadcom BCM4306 802.11b/g Wireless Lan> mem 0x80084000-0x80085fff irq 52 at device 18.0 on pci1
Nov 11 08:33:36 freebook kernel: bwi0: BBP: id 0x4306, rev 0x3, pkg 0
Nov 11 08:33:36 freebook kernel: bwi0: MAC: rev 5
Nov 11 08:33:36 freebook kernel: bwi0: PHY: type 2, rev 2, ver 2
Nov 11 08:33:36 freebook kernel: bwi0: RF: manu 0x17f, type 0x2050, rev 2
Nov 11 08:33:36 freebook kernel: bwi0: invalid antenna gain in sprom
Nov 11 08:33:36 freebook kernel: ohci3: <OHCI (generic) USB controller> mem 0x80086000-0x80086fff at device 24.0 on pci1
Nov 11 08:33:36 freebook kernel: ohci3: Could not map memory
Nov 11 08:33:36 freebook kernel: device_attach: ohci3 attach returned 6
Nov 11 08:33:36 freebook kernel: ohci4: <OHCI (generic) USB controller> mem 0x80087000-0x80087fff at device 25.0 on pci1
Nov 11 08:33:36 freebook kernel: ohci4: Could not map memory
Nov 11 08:33:36 freebook kernel: device_attach: ohci4 attach returned 6
Nov 11 08:33:36 freebook kernel: wlan0: Ethernet address: 00:11:24:96:ef:5a
Nov 11 08:33:37 freebook kernel: bwi_v3_ucode: could not load firmware image, error 2
Nov 11 08:33:37 freebook kernel: bwi0: request firmware bwi_v3_ucode failed
Nov 11 08:33:37 freebook kernel: bwi0: bwi_init_statechg: error 12 on MAC init
Nov 11 08:33:37 freebook kernel: bwi_v3_ucode: could not load firmware image, error 2
Nov 11 08:33:37 freebook kernel: bwi0: request firmware bwi_v3_ucode failed
Nov 11 08:33:37 freebook kernel: bwi0: bwi_init_statechg: error 12 on MAC init
Nov 11 08:33:37 freebook wpa_supplicant[1656]: Failed to initiate AP scan.
Nov 11 08:33:52 freebook last message repeated 15 times
```

if i load the if_bwn.ko driver instead, the output is sad

```
Nov 11 08:33:52 freebook kernel: ohci3: <OHCI (generic) USB controller> mem 0x80086000-0x80086fff at device 24.0 on pci1
Nov 11 08:33:52 freebook kernel: ohci3: Could not map memory
Nov 11 08:33:52 freebook kernel: device_attach: ohci3 attach returned 6
Nov 11 08:33:52 freebook kernel: ohci4: <OHCI (generic) USB controller> mem 0x80087000-0x80087fff at device 25.0 on pci1
Nov 11 08:33:52 freebook kernel: ohci4: Could not map memory
Nov 11 08:33:52 freebook kernel: device_attach: ohci4 attach returned 6
Nov 11 08:33:53 freebook wpa_supplicant[1656]: Failed to initiate AP scan.
Nov 11 08:34:24 freebook last message repeated 31 times
```

the output of ifconfig show that only the bwi0 interface has been added.

SO if my /boot/loader.conf has these entries, what have i missed ??

```
if_bwi_load="YES"
if_bwi_v3_ucode_load="YES"
```


i stumbled across a post suggesting installing a port with no real details.
i quick find resulted in /usr/ports/net/bwi-firmware-kmod

+ made a Correction to /boot/loader.conf
deleted the "if"  = *if_*bwi_v3_ucode_load="YES"

```
if_bwi_load="YES"
bwi_v3_ucode_load="YES"
```

installed the Port and Rebooted.  no go. damn.


checked dmesg, still saying = KLD file if_bwi.ko is missing dependencies


But against all odds, some success:
A Manual load of the above = kldload /boot/kernel/if_bwi.ko and It Works.

/var/logs/messages

```
Nov 11 11:07:00 freebook kernel: bwi0: <Broadcom BCM4306 802.11b/g Wireless Lan> mem 0x80084000-0x80085fff irq 52 at device 18.0 on pci1
Nov 11 11:07:00 freebook kernel: bwi0: BBP: id 0x4306, rev 0x3, pkg 0
Nov 11 11:07:00 freebook kernel: bwi0: MAC: rev 5
Nov 11 11:07:00 freebook kernel: bwi0: PHY: type 2, rev 2, ver 2
Nov 11 11:07:00 freebook kernel: bwi0: RF: manu 0x17f, type 0x2050, rev 2
Nov 11 11:07:00 freebook kernel: bwi0: invalid antenna gain in sprom
Nov 11 11:07:00 freebook kernel: ohci3: <OHCI (generic) USB controller> mem 0x80086000-0x80086fff at device 24.0 on pci1
Nov 11 11:07:00 freebook kernel: ohci3: Could not map memory
Nov 11 11:07:00 freebook kernel: device_attach: ohci3 attach returned 6
Nov 11 11:07:00 freebook kernel: ohci4: <OHCI (generic) USB controller> mem 0x80087000-0x80087fff at device 25.0 on pci1
Nov 11 11:07:00 freebook kernel: ohci4: Could not map memory
Nov 11 11:07:00 freebook kernel: device_attach: ohci4 attach returned 6
Nov 11 11:07:01 freebook kernel: wlan0: Ethernet address: 00:11:24:96:ef:5a
Nov 11 11:07:01 freebook kernel: bwi0: firmware rev 0x0127, patch level 0x000e
Nov 11 11:07:02 freebook kernel: bwi0: firmware rev 0x0127, patch level 0x000e
Nov 11 11:07:04 freebook wpa_supplicant[1685]: Trying to associate with 90:84:0d:dc:c8:71 (SSID='localnet' freq=2462 MHz)
Nov 11 11:07:04 freebook wpa_supplicant[1685]: Associated with 90:84:0d:dc:c8:71
Nov 11 11:07:04 freebook kernel: wlan0: link state changed to UP
Nov 11 11:07:04 freebook wpa_supplicant[1685]: WPA: Key negotiation completed with 90:84:0d:dc:c8:71 [PTK=CCMP GTK=CCMP]
Nov 11 11:07:04 freebook wpa_supplicant[1685]: CTRL-EVENT-CONNECTED - Connection to 90:84:0d:dc:c8:71 completed (auth) [id=0 id_str=]
Nov 11 11:07:05 freebook kernel: bwi0: need multicast update callback
Nov 11 11:07:07 freebook last message repeated 2 times
Nov 11 11:07:07 freebook dhclient: New IP Address (wlan0): 192.168.1.219
Nov 11 11:07:07 freebook dhclient: New Subnet Mask (wlan0): 255.255.255.0
Nov 11 11:07:07 freebook dhclient: New Broadcast Address (wlan0): 192.168.1.255
Nov 11 11:07:07 freebook dhclient: New Routers (wlan0): 192.168.1.1
```

ifocnfig output
	
	



```
bwi0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
        ether 00:11:24:96:ef:5a
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
        status: associated
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:11:24:96:ef:5a
        inet 192.168.1.219 netmask 0xffffff00 broadcast 192.168.1.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: IEEE 802.11 Wireless Ethernet OFDM/36Mbps mode 11g
        status: associated
        ssid localnet channel 11 (2462 MHz 11g) bssid 90:84:0d:dc:c8:71
        country US authmode WPA2/802.11i privacy ON deftxkey UNDEF
        AES-CCM 3:128-bit txpower 0 bmiss 7 scanvalid 450 bgscan
        bgscanintvl 300 bgscanidle 250 roam:rssi 7 roam:rate 5 protmode CTS
        roaming MANUAL
```


Testing from my win7 pc is successful, I am able to ping, telnet to p22 and ssh to iBookG4.

So that leaves me to work out HOW to get it right from BOOT !!!
Do the loader.conf entries need to be in reverse order ?

+ the other 3 issues.
+ firefox port crashes ..lol..

thanks in advance for your comments.


----------



## gudismonsta (Nov 11, 2012)

Thanks initpy
ill take a look.

although a quick try of that cmd unfortunately failed.

freebook# sysctl dev.cpu.0.freq=1000
dev.cpu.0.freq: 533
sysctl: dev.cpu.0.freq: Invalid argument


----------



## gudismonsta (Nov 11, 2012)

```
freebook# sysctl dev.cpu.0.freq_levels
dev.cpu.0.freq_levels: 1066/-1 533/-1

freebook# sysctl dev.cpu.0.freq=1066
dev.cpu.0.freq: 533 -> 1066

freebook# sysctl dev.cpu.0.freq
dev.cpu.0.freq: 533
```

Appears to work, but it doesn't
thanks for the hint though


----------



## wblock@ (Nov 11, 2012)

Entries in /boot/loader.conf are not order-sensitive.  Beyond that, I can't suggest much.


----------



## gudismonsta (Nov 11, 2012)

update:
*1. cpu speed - FIXED*
This is not an issue. I already had enabled POWERD in /etc/rc.conf
As it turns out, its been operating in variable mode all along.
I installed the x11 system monitor /usr/ports/sysutils/conky, which is showing 533mhz at idle and 1066mhz during activity.
powerd seems to override manual sysctrl settings

*2. Wireless - WORKAROUND*
Not working from boot.
Manual kldload of /boot/kernel/if_bwi.ko magically fixes it.
the rest of my wireless files are correctly configured.
Would like to know why this is, but it works 

*3. MAC mouse buttons*
no progress here, though I did stumble on a slackware tip which may work

```
that adding this:
dev.mac_hid.mouse_button_emulation = 1
dev.mac_hid.mouse_button2_keycode = 125
dev.mac_hid.mouse_button3_keycode = 96
to your /etc/sysctl.conf file would do the trick. These will map your middle mouse button to the right apple key and the right mouse button to the enter key right next to the right apple key.
```

*4. Battery status*
NO update yet
ARM + ACPI appear not to be present. - not sure if adding them will be fatal 

Thanks for your help so far...
Overall 9.0 on PPC is solid.


----------



## kpedersen (Nov 11, 2012)

gudismonsta said:
			
		

> *2. Wireless - WORKAROUND*
> Not working from boot.
> Manual kldload of /boot/kernel/if_bwi.ko magically fixes it.
> the rest of my wireless files are correctly configured.
> Would like to know why this is, but it works



I have the same chipset on one of my thinkpads and had the same issue (and workaround).

I think it is because the driver loads before the filesystem is mounted and so cannot load the firmware.


----------



## andreast (Nov 11, 2012)

Regarding loader.conf which does not properly load the wireless driver, this is a bug in the ppc loader which does not resolve dependencies.
If you want to load modules which do have dependencies like the wireless drivers, add all the needed modules to the loader.conf and it will work.

I fixed this is the 9.1 branch. it will not be part of the upcoming 9.1 release unless you patch it yourself.

Here the commit: http://svnweb.freebsd.org/base?view=revision&revision=241036


----------



## Crivens (Nov 20, 2012)

gudismonsta said:
			
		

> *4. Battery status*
> NO update yet
> ARM + ACPI appear not to be present. - not sure if adding them will be fatal
> 
> ...



Nice to hear that. This makes me check if somewhere a PPC macbook may be up for grabs as I really like the PPC much more than the x86 excuse for a decent instruction set.

The ACPI stuff is only available on x86/64 or Itanium. Nowhere else AFAIR, so you should not be able to get this to work on a PPC machine.


----------

