LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Slack on a Mac? (https://www.linuxquestions.org/questions/slackware-14/slack-on-a-mac-496688/)

spaceballs 10-29-2006 02:51 PM

Slack on a Mac?
 
I tried to search for answers to this question, and without success. The new MacBooks are intel based...like slackware is. What would it take to install Slack on one of these? I know that Yellow Dog linux was meant for this and Slackintosh was, but these were for the PowerPC platform.

Has anyone tried this? How successful?

pdw_hu 10-29-2006 03:03 PM

<OFF> You mazochists :D </OFF>

gnashley 10-30-2006 02:25 AM

Some work has been done on getting ix86-Linux to boot on the new mac hardware. But YellowDog is for the Motorola arch. I couldn't get YellowDog or Ubuntu for mac to install on my iMac. Then I found Slackintosh and installed 10.2. Right away recompiled the kernel to use 2.4 series and compiled some extra sources that I use to make a desktop with.
You can find the ppc bins here:
http://distro.ibiblio.org/pub/linux/...kages/PowerPC/

jong357 10-30-2006 06:29 PM

Yea, but thats PPC not Mactel. You can get Slackware on the new intel chips from what I hear. Ubuntu has a Mactel live Cd that you can use. I read where some guy did that, extracted pkgtools on the liveCD system and then did installpkg -root to another partition from a dowloaded slackware directory on his HFS+ partition, starting at "a" then "ap" and so on. He said it worked after fiddling with fstab and a few other configs. Of course, you'll need to chroot and patch/build the 2.6 kernel with the relevant mactel patch set before it will boot. LOTS of other stuff needs to be tweaked in order to get the extras working but I've read many success stories in general with Linux and Mactel. Hit google, there's lots of stuff out there.

I just blew everything I had on a new MacBook Pro. It's in transit right now. I'll post back here if you want and tell you how to go about it. Can most certainly be done. The Tricky part is getting a tri boot with Windows, OSX and Slackware. That's my aim.;)

Also, Fedora is in the process of porting to the new Macs. I've been getting conflicting reports with concern to the boot loader. supposedly elilo for EFI systems is what your supposed to use but I hear lilo and now grub will work as well. You can also go the bootcamp route. XOM? rEFIt? Whew, just how do you get it to boot? I still have lots of reading to do and so do you.

http://www.mactel-linux.org/wiki/Main_Page

It'll all get better over the next half year or so. Mainly it's the lack of vanilla kernel support and the EFI boot arch.

uselpa 10-31-2006 03:11 AM

Quote:

Originally Posted by jong357
I'll post back here if you want and tell you how to go about it.

Yes, please do. I've thought about getting a Macbook, but I'll probably wait for Mac OS X 10.5. And although my aim would be to run it mainly with MacOSX, a dual boot with Slackware is interesting.

jong357 10-31-2006 10:33 AM

I spent hours last night reading more about this. Actually, that link I gave will turn into MANY more links if you follow them all. It looks to be alot easier than I first anticipated. I still need to do more research but it seems that:

BootCamp is only used for making a driver CD that you plop into your drive after you hit the Windows Desktop. It's also a frontend for DiskUtil so you can partition your HDD... You may still have to "officially" install it tho. Not sure. Most people were just talking about using a terminal as in "diskutil list".

The main thing is to use either XOM or rEFIt. Those are your graphical bootloaders. I think you'll still need either elilo or lilo/grub. rEFIt may not actually boot a vmlinuz but instead try to chainload lilo to boot your linux partition. If you just want a dual boot system with OSX and Linux, you can use XOM. For a tri-boot system, use rEFIt. Here is a screen shot of rEFIt after you turn on your computer.
http://refit.sourceforge.net/screen.html

Pretty nice looking and sticks with the Mac look. If you don't use one of the above, then you have to hold down the OPTION key after boot to get Apple's "built in" boot menu, otherwise, it boot's OSX by default. No good.

I'm not so sure what those Mactel patches are used for now. Read a couple places where you can use a regular gentoo 2006 minimal CD to boot into. That would tell me the Vanilla kernel can recognize the new Macs just fine. Maybe those patches are for making the backlit keyboard work and extras like that.

The BIG deal is that, if you intend on installing Windows, we have to take into account GPI AND MBR implementation. GPI does'nt allow extended partitions AND MBR only allows for 4 primary partitions. That means on an intel Mac with intent to run windows, we only have a max of 4 partitions and Apple is already using one for the GPI boot. That leaves the 2nd one for OSX, the 3rd one for Windows and the last one for Linux. Can't have a /boot or /home or even a seperate swap partition. You have to use a /swap file.

This makes it especially problematic as I was going to rebuild my DIY system but I have no free partitions left. I'll have to build it on my Slackware host in a seperate directory or something and then tarball it up, boot with a LiveCD and untar it on my freshly formated Slackware partition.

Sorry, just talking to myself I guess. I won't really know the particulars until I get my laptop in a couple days. This is the link that really helped me out the most:

http://wiki.onmac.net/index.php/Trip...t_via_BootCamp

Think I'm going to use 15gb OSX, 15gb Linux and the other 90gb FAT32 Windows. I'm making a custom Boot CD with fat32format.exe on it so I can get such a large FAT32 partition. This way, OSX and Linux will be able to read/write to Windows. C: drive will be a storage area for all 3 OS'es along with having plenty of space to install games. ;) That's the idea anyway.

jong357 11-03-2006 05:25 PM

slackware mac book pro macbook how tri-boot

This was done on a Mac Book Pro 15.4 widescreen 2.16Gz Dual Core 2 Duo. There are mac-mini and imac how-to's out there but alot of the stuff seems specific to those models.

Well, I have a tri-boot on my macbook pro now. Slackware 11.0, OSX and Windows... Wasn't overly bad. The instructions on the link above is what I followed. I added the part about BartPE to the wiki but it doesn't work. Windows will choke when you try to boot it with just a black screen so I redid windows on an NTFS partition. Seems the later part about making sure windows formats the partition is correct and who ever put in the part about fat32format is in error.

The Slackware DVD chokes with no keyboard just like it does on some regular x86 boxes. Wish he'd fix that. So I used a gentoo minimal 2006.1 livecd only I hacked it to have the entire slackware/ directory on the root of the CD. There is only one drive on the macbook pro and gentoo will not relinquish it seeing as how we are running off of it. I suppose you could put it on your NTFS or HFSPLUS partition. That's assuming the gentoo cd has support for them in the kernel. I would imagine it does.

I'm recalling this from memory but it should still be spot on.

1. Boot into the Gentoo LiveCD.

2. mkdir linux (we start out in /root)

3. mkreiserfs /dev/sda3 (can reboot if you want)

4. mount /dev/sda3 linux

5. mkdir pkgtool

6. cd pkgtool

7. tar xzf /mnt/cdrom/slackware/a/pkgtools-*.tgz

8. cd ../linux

9. export PATH=$PATH:/root/pkgtool/sbin

10. dd if=/dev/zero of=/mnt/linux/swap bs=1024 count=$VALUE
Here is $VALUE:
512MB = 524288
1Gb = 1048576
1.5GB = 1572864
2.0GB = 2097152

11. mkswap /mnt/linux/swap

12. installpkg -root . /mnt/cdrom/slackware/a/*.tgz

13. installpkg -root . /mnt/cdrom/slackware/ap/*.tgz
and so on and so forth until you install all the package sets that you want. NOTE: bind-* in series n/ choked on me. It just hung there with the install script so I did a ctrl+c and
"cp -R /mnt/cdrom/slackware/n /root"
"rm -rf /root/n/bind-*"
"installpkg -root . /root/n/*.tgz"

14. installpkg -root . /mnt/cdrom/slackware/testing/linux-2.6.18/kernel-source-*.tgz

15. cd ../

16. chroot linux/ /bin/bash

17. pkgtool (trim it out to your desired install and make sure you remove all 2.4 kernel stuff except the headers)

18. cd /usr/src/linux-2.6.18

19. cp /mnt/cdrom/config-2.6.17-MBP .config
get this from mactel SVN:
http://svn.sourceforge.net/viewvc/ma...atches-2.6.17/
also notice:
http://svn.sourceforge.net/viewvc/ma...atches-2.6.18/

20. make oldconfig
If you used the 2.6.17 config, you'll have some answers to dish out. Maybe you should use the 2.6.18 config instead, unless you know what the new options are.

21. make menuconfig
Add reiserfs support as built in. Look around while your here but be carefull.

22. make bzImage modules modules_install

23. cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.18

24. cp System.map /boot/System.map-2.6.18

25. cp .config /boot/config-2.6.18

26. cd /boot

27. ln -sf vmlinuz-2.6.18 vmlinuz

28. ln -sf System.map-2.6.18 System.map

29. vi /etc/lilo.conf
Code:

boot=/dev/sda3                           
timeout=5             
default=Linux
image=/boot/vmlinuz
## Uncomment the next line if your MacBook locks up
## during boot with an APIC-related error message
## or if you see strange keyboard problems (double-chars).
#append="noapic acpi=force irqpoll"
## If using elilo to boot, enable the FB_MAC kernel option
## and use the below append option:
#append="video=imacfb:i17"
## If using refit/lilo to boot, then use this instead:
vga=791
label= Linux               
read-only                     
root=/dev/sda3

30. vi /etc/fstab
Code:

/dev/sda2      /mnt/osx        hfsplus      rw,force        0 0
/dev/sda3      /                reiserfs    defaults        1 1
/dev/sda4      /mnt/windows    ntfs        ro              0 0
/swap          none            swap        sw              0 0
/dev/hda        /mnt/cdrom      iso9660,udf  noauto,ro,owner 0 0
proc            /proc            proc        defaults        0 0
sysfs          /sys            sysfs        defaults        0 0
devpts          /dev/pts        devpts      gid=4.mode=620  0 0
shm            /dev/shm        tmpfs        defaults        0 0

31. mkdir /mnt/{osx,windows}

32. pwconv

33. grpconv

34. passwd

35. pkgtool (run some setup scripts if you wish. Stuff like gpm and whatnot)

36. mount proc /proc -t proc

37. /sbin/lilo

38. exit

39. reboot

Now boot into MacOSX and do the part about cp'ing the elilo/efi folder to the root of your OSX partition.

Now you should be triple booting. I'm having a hell of a time with getting the synaptics touchpad going and madwifi... It should be a pre-n Atheros 5008 series which isn't supported yet acording to madwifi's compat list. SVN/CVS is my next stop.

Oh... Build evdev as a module and not built in otherwise you get no /dev/input/event* nodes. There are a few other gotchas and most of them revolve around the damn kernel .config. /proc/bus/input/devices lists "apple touchpad" crap so synaptics is choking on me when I try to startx with my xorg.conf. Getting really frustrated between synaptics and my non-existent ath0...

I used Xorg -configure for my initial xorg.conf. The mouse was whacky and only covered the right side of the screen. I switched the protocol to IMPS/2 and startx works. usbmouse module siezes control of the touchpad so we have no right click. One of the reasons why I'm working on synaptics. Supposedly xmodmap can be used to remap the keys to have a right click and middle click button but the only examples I've found are for a german keyboard.

It's all still quite the mess on the Linux front. I fully expect to still be screwing with it a week or 2 from now. I'll do a more detailed walk-thru once I figure everything out... I haven't even gotten around to messing with ATI's drivers tho I hear they work. I'm still stuck at a console because I have no right click (fluxbox rendered useless)... :-) At an ugly-huge-font console at that! Frustrating. So much work to do it's not even funny.

jong357 11-05-2006 11:08 AM

UPDATE - This is included in my pommed build script

Got a right click now.... :D

Find out your key codes. Don't use "showkey" as they are wrong. Use "xev" instead. Download xkbset from:
http://www.math.missouri.edu/~stephen/software/

The prefix in Makefile is already set to /usr/X11R6 so just do a make and then make install. Or make a slak-pak if you wish. I never use middle click and only right click so this is what I did.
Code:

xmodmap -e 'keycode 116 = Pointer_Button3'
xkbset m

That gives me a right click on the right apple key. Have that start up with your xsession some how. I use Gnome so I'll probably just add the above lines to a new file in /usr/bin and then add the new script command to my startup session list.

The touchpad is still really senstive for "fine tuned" work. It jumps too much when you want to move it just a hair. All this is temporary I suppose until I can figure out synaptics.

Next thing on my TODO list is to ditch the 25' CAT5 cable going thru my living room and dining room. ;)

Code:

#!/bin/sh

CWD=`pwd`
TMP=/tmp
PKGNAME=xkbset
PKG=$TMP/package-$PKGNAME
VERSION=0.5
PKGVER=${VERSION}
ARCH=i486
BUILD=1
CFLAGS="-march=i486 -mtune=i686 -pipe -O2"

rm -rf $PKG
mkdir -p $PKG/{install,usr/X11R6/{bin,man/man1}}

cd $TMP
echo
echo "$PKGNAME-$VERSION source is now extracting..."
rm -rf $PKGNAME-$VERSION
tar xzf $CWD/$PKGNAME-$VERSION.tar.gz
cd $PKGNAME-$VERSION
chown -R root.root .
make
make install DESTDIR=$PKG

# Compress and strip
gzip -9 $PKG/usr/X11R6/man/man?/*.?
( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null )

# Make the package description:
cat << EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.

      |-----handy-ruler---------------------------------------------------------|
xkbset: xkbset (XKB modifier)
xkbset:
xkbset: This is a program to help manage many of the XKB features of X window.
xkbset: This includes such features as MouseKeys, AccessX, StickyKeys,
xkbset: BounceKeys, and SlowKeys. It includes a gui program to help with
xkbset: MouseKeys acceleration management.
xkbset:
xkbset:
xkbset:
xkbset:
xkbset:
EOF

# Build the package:
cd $PKG
makepkg -l y -c n $TMP/$PKGNAME-$PKGVER-$ARCH-$BUILD.tgz


jong357 11-05-2006 11:11 AM

Oh, and the ATI drivers work just fine, for the most part anyway. glxgears only reports in the 200's tho... But atleast I DO have hardware accel now.. I'll fine tune that stuff later.

UPDATE 12-02-06
I upgraded to the latest ATI drivers and now I'm getting in the 3,600 range for glxgears and in the 700's for fgl_glxgears. They must have just fixed something in the latest drivers. Don't know. The version I'm using that works is:

ati-driver-installer-8.31.5-x86.x86_64.run

UPDATE 01-11-07

If your using Bootcamp/Windows you'll probably want to ditch apple's ATI drivers and use these instead:

http://www.omegadrivers.net/ati/win2k_xp.php

Not only do they seem to work better but you can OC your card with a utility they install.

jong357 11-06-2006 11:28 AM

Finally got the synaptics drivers to work. Apple shipped a new revision of touchpads with the latest Core 2 Duo Notebooks. Atleast they did on the 15".... It was staring me in the face the whole time too. Check the output of /proc/bus/input/devices and look for the product number on the entry that coresponds to the 'mouse handler'.... Mine listed "Product=021a" but if you check /usr/src/linux-2.6.18.2/drivers/usb/input/appletouch.c it lists
Code:

#define GEYSER3_JIS_PRODUCT_ID  0x0219
Change the 0x0219 to 0x021A, recompile your kernel, reboot and now you have the synaptics driver being registered. Also, if you used the usbhid.patch from mactel's SVN 2.6.18 directory, change that as well.

The 2 finger tap for right-click is pretty nice. ;) I also left my xmodmap settings in place so I can still use the right apple key...

Here is my xorg.conf so far. The touchpad's "jumpyness" is gone now that synaptics is being used. You can get the pointer on small things alot better. The only issue I'm having now with it is, if you VERY lightly put your finger on the touchpad and then try to move the pointer, nothing happens. I've never used the synaptics driver before but I'm hoping that can be fixed with one of the options in xorg.conf. It's fairly pronouced so NEEDS to be adjusted.

EDIT 01-13-2007 - This is my final xorg.conf
Code:

Section "ServerLayout"
        Identifier    "X.org Configured"
        Screen      0  "Screen0" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Mouse1"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
        RgbPath      "/usr/X11R6/lib/X11/rgb"
        ModulePath  "/usr/X11R6/lib/modules"
        FontPath    "/usr/X11R6/lib/X11/fonts/misc/"
        FontPath    "/usr/X11R6/lib/X11/fonts/TTF/"
        FontPath    "/usr/X11R6/lib/X11/fonts/Type1/"
        FontPath    "/usr/X11R6/lib/X11/fonts/CID/"
        FontPath    "/usr/X11R6/lib/X11/fonts/75dpi/"
        FontPath    "/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection

Section "Module"
        Load  "glx"
        Load  "extmod"
        Load  "xtrap"
        Load  "record"
        Load  "dbe"
        Load  "dri"
        Load  "freetype"
        Load  "type1"
        Load  "synaptics"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
        Option      "CoreKeyboard"
        Option      "XkbRules" "xorg"
        Option      "XkbModel" "pc104"
        Option      "XkbLayout" "us"
EndSection

Section "InputDevice"
# Synaptics Touchpad:
        Identifier        "Mouse0"
        Driver                "synaptics"
        Option                "CorePointer"
        Option                "Device"        "/dev/input/mouse1"
        Option                "Protocol"        "auto-dev"
        Option                "LeftEdge"        "0"
        Option                "RightEdge"        "1216"
        Option                "TopEdge"        "0"
        Option                "BottomEdge"        "380"
        Option                "FingerLow"        "0"
        Option                "FingerHigh"        "10"
        Option                "MaxTapTime"        "180"
        Option                "MaxTapMove"        "220"
        Option                "MaxDoubleTapTime"        "180"
        Option                "VertScrollDelta"        "20"
        Option                "HorizScrollDelta"        "50"
        Option                "MinSpeed"        "0.79"
        Option                "MaxSpeed"        "0.88"
        Option                "AccelFactor"        "0.0015"
        Option                "SHMConfig"        "on"
        Option                "TapButton2"        "3"
        Option                "TapButton3"        "2"
EndSection

Section "InputDevice"
# USB Mouse:
        Identifier        "Mouse1"
        Driver                "mouse"
        Option                "Protocol" "IMPS/2"
        Option                "Device" "/dev/input/mice"
        Option                "SendCoreEvents" "true"
        Option                "Emulate3Buttons"
        Option                "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
        Identifier  "Monitor0"
#        HorizSync    30.0 - 111.0
#        VertRefresh  50.0 - 160.0
        Option      "DPMS"
EndSection

Section "Device"
        Identifier  "ATI Technologies Inc M56P [Radeon Mobility X1600]"
        Driver      "fglrx"
        Option            "DesktopSetup" "single"
        Option      "backingstore" "true"
        Option      "RenderAccel" "true"
        BusID      "PCI:1:0:0"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device    "ATI Technologies Inc M56P [Radeon Mobility X1600]"
        Monitor    "Monitor0"
        DefaultDepth    24
        SubSection "Display"
                Viewport  0 0
                Depth    24
        EndSubSection
EndSection

Section "DRI"
        Mode        0666
EndSection


pwc101 11-06-2006 11:40 AM

@jong357
You should make this into a howto. If I had the money to buy a Mac, I'd give it a go :)

edit: Would it be appropriate in the wiki? Maybe an article about it...?

jong357 11-06-2006 12:47 PM

Quote:

Originally Posted by pwc101
You should make this into a howto.

Isn't that what this is? :p The wiki might be a good place for it but expierence here shows that people tend not to check it and ask on the forums anyway. I spent alot of time adding audio conversion scripts to the wiki a year or two ago and people still post "How do I convert a .wav to mp3?" We'll see. Google should catch this on it's next crawl.. That'll help tremendously.

They are pretty pricey, but man.... You can run Unix, Linux, OSX, Windows and Solaris on this thing. I see no need for any other platform now that Apple went with intel. I feel bad for spending so much time in Linux tho. I've hardly used OSX at all.

As for the touchpad options, do a "man synaptics" and that clears a few things up. Pretty confusing at first but keep reading. My problem with 'touches' not being registered were due to the FingerLow and FingerHigh options. Decrease them and it's better. I put FingerLow on 0 and it still doesn't register an event if I'm soft on the touchpad. Guess I'll have to live with it. I also adjusted ALL *Edge options to encompass the entire touchpad. I don't use RightEdge or BottomEdge scrolling so might as well have the entire touchpad used. Do a "synclient -m 1" to see the cordinates of any given 'touch' event.

Next stop. Wireless. :D

Code:

#!/bin/sh
#
# http://web.telia.com/~u89404340/touchpad/

CWD=`pwd`
TMP=/tmp
PKGNAME=synaptics
PKG=$TMP/package-$PKGNAME
VERSION=0.14.6
PKGVER=${VERSION}
ARCH=i486
BUILD=1

rm -rf $PKG
mkdir -p $PKG/install

cd $TMP
echo
echo "$PKGNAME-$VERSION source is now extracting..."
rm -rf $PKGNAME-$VERSION
tar xjf $CWD/$PKGNAME-$VERSION.tar.bz2
cd $PKGNAME-$VERSION
chown -R root.root .
sed -i 's@/usr/local@/usr/X11R6@' Makefile
make
make install DESTDIR=$PKG

# Compress and strip
gzip -9 $PKG/usr/X11R6/man/man?/*.?
( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null )

# Make the package description:
cat << EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.

        |-----handy-ruler-----------------------------------------------------|
synaptics: synaptics (touchpad driver)
synaptics:
synaptics: This is a driver for the Synaptics TouchPad for XOrg/XFree86 4.x.
synaptics: A Synaptics touchpad by default operates in compatibility mode by
synaptics: emulating a standard mouse. However, by using a dedicated driver,
synaptics: more advanced features of the touchpad becomes available.
synaptics:
synaptics:
synaptics:
synaptics:
synaptics:
EOF

# Build the package:
cd $PKG
makepkg -l y -c n $TMP/$PKGNAME-$PKGVER-$ARCH-$BUILD.tgz


jong357 11-06-2006 02:35 PM

Ooooooo. Neat!

http://www.boichat.ch/nicolas/macbook-tools/

This allows you to control the LCD backlight and the Keyboard backlight... ;)

Mapping those two along with the eject key to the appropriate keys is what I'm tinkering with now.

jong357 11-06-2006 07:41 PM

O.K... More stuff done. I have the LCD brightness up/down keys working, Keyboard Backlight off/on/halfway keys working and I have the eject key working... :p Here is a build script. I got a little carried away with it. I put the option to build xkbset as well along with autoconfiguring everything for you (if you use gnome). Read it for more info. The only thing I need to add to the script is handling the volume up/down/mute keys... ;)
Code:

#!/bin/sh
#
# Let's incorporate macbook-tools and xbindkeys into the same package.
# You can also add XKBSET and automatic right-click/right-apple-key support (gnome)
#
# http://www.boichat.ch/nicolas/macbook-tools/
# http://hocwp.free.fr/xbindkeys/xbindkeys.html
# http://www.math.missouri.edu/~stephen/software/

CWD=`pwd`
TMP=/tmp
PKGNAME=macbook-tools
PKG=$TMP/package-$PKGNAME
MACBOOKTOOLS=0.1.1
XBINDKEYS=1.7.3
XKBSET=0.5
PKGVER=${MACBOOKTOOLS}
ARCH=i486
BUILD=1
# Make sure XKBSET is correct in the script below:
# I don't think you can sed a variable...
MAC_PREFIX=/usr
CFLAGS="-march=i486 -mtune=i686 -pipe -O2"
# This part is rather unorthodox so we'll use it as an option.
# Not a big fan of multiple packages and manual configuration. :-)
# Scroll down some to see what it does.
INSTALLXKBSET=yes
HOMEDIR=/root

rm -rf $PKG
mkdir -p $PKG/{install,$MAC_PREFIX/{bin,doc/macbook-tools-$MACBOOKTOOLS}}

cd $TMP
echo
echo "macbook-tools-$MACBOOKTOOLS source is now extracting..."
rm -rf macbook-tools-$MACBOOKTOOLS
tar xjf $CWD/macbook-tools-$MACBOOKTOOLS.tar.bz2
cd macbook-tools-$MACBOOKTOOLS
chown -R root.root .
make
install -m 755 -o root -g root applesmc  $PKG/$MAC_PREFIX/bin
install -m 755 -o root -g root backlight $PKG/$MAC_PREFIX/bin

cd $TMP
echo
echo "xbindkeys-$XBINDKEYS source is now extracting..."
rm -rf xbindkeys-$XBINDKEYS
tar xzf $CWD/xbindkeys-$XBINDKEYS.tar.gz
cd xbindkeys-$XBINDKEYS
chown -R root.root .
# It's crapping out on guile. We don't need it anyway.
./configure --prefix=$MAC_PREFIX \
    --disable-guile
make
make install DESTDIR=$PKG

# Add a wrapper script for eject:
cat << EOF > $PKG/$MAC_PREFIX/bin/maceject
#!/bin/sh

if mount | grep /dev/hda 2>/dev/null 1>/dev/null ;then
  umount /dev/hda
fi
eject /dev/hda
EOF
chmod 755 $PKG/$MAC_PREFIX/bin/maceject

# Add a wrapper script for mount:
#!/bin/sh
cat << EOF > $PKG/$MAC_PREFIX/bin/macmount
#!/bin/sh

if ! mount | grep /dev/hda 2>/dev/null 1>/dev/null ;then
  mount /dev/hda /mnt/cdrom
fi
EOF
chmod 755 $PKG/$MAC_PREFIX/bin/macmount

# Throw a ~/.xbindkeysrc and README in /usr/doc
# We could also put .xbindkeysrc in $PKG/etc/skel...
cat << EOF > $PKG/$MAC_PREFIX/doc/macbook-tools-$MACBOOKTOOLS/.xbindkeysrc
###########################
# xbindkeys configuration #
###########################
#
# If you edit this file, do not forget to uncomment any lines
# that you change.
# The pound(#) symbol may be used anywhere for comments.
#
# To specify a key, you can use 'xbindkeys --key' or
# 'xbindkeys --multikey' and put one of the two lines in this file.
#
# The format of a command line is:
#    "command to start"
#      associated key
#
#
# A list of keys is in /usr/include/X11/keysym.h and in
# /usr/include/X11/keysymdef.h
# The XK_ is not needed.
#
# List of modifier:
#  Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock),
#  Mod3 (CapsLock), Mod4, Mod5 (Scroll).
#

# The release modifier is not a standard X modifier, but you can
# use it if you want to catch release events instead of press events

# By defaults, xbindkeys does not pay attention with the modifiers
# NumLock, CapsLock and ScrollLock.
# Uncomment the lines above if you want to pay attention to them.

#keystate_numlock = enable
#keystate_capslock = enable
#keystate_scrolllock= enable

# Run "xbindkeys --multikey" for the keycode of multiple key presses
# Run "xbindkeys --key" for the keycode of a single key press

#################
# Mac Book Pro: #
#################

# [fn]+[F1] Lower LCD backlight by a factor of 10
"backlight -10"
  m:0x0 + c:67

# [fn]+[F2] Raise LCD backlight by a factor of 10
"backlight +10"
  m:0x0 + c:68

# [fn]+[F8] Turn Keyboard backlight OFF
"applesmc 0"
  m:0x0 + c:74

# [fn]+[F9] Turn Keyboard backlight ON HALFWAY
"applesmc 127"
  m:0x0 + c:75

# [fn]+[F10] Turn Keyboard backlight ON all the way
"applesmc 255"
  m:0x0 + c:76

# Top right eject key ( next to [F12] )
"maceject"
  m:0x0 + c:204

# Might as well have a mount key too for us non-hal users [F12]
"macmount"
  m:0x0 + c:96

##################################
# End of xbindkeys configuration #
##################################
EOF

cat << EOF > $PKG/$MAC_PREFIX/doc/macbook-tools-$MACBOOKTOOLS/README
The sample .xbindkeysrc in this directory is for Macintosh
computers. It was specifically made for a MacBook Pro. To
use it, copy it to your home directory and then have "xbindkeys"
start up with your xsession.

With Gnome use:
Desktop --> Preferences --> Sessions --> Startup Programs

If you opted to use the INSTALLXKBSET variable in the build script
then you shouldn't have to do any configuring. It will just
work the next time you start your X server (if running Gnome). Not
only will LCD Backlight, Keyboard Backlight and the eject key work,
but your right apple key will function as a right click too.
EOF

# I'm lazy. And prefer monolithic packages. If they have ANYTHING
# to do with each other then why not clump them all together?
# You should see my Python build script.... :-)
if [ "$INSTALLXKBSET" = "yes" ]; then
  mkdir -p $PKG/$MAC_PREFIX/{bin,man/man1}
  cd $TMP
  echo
  echo "xkbset-$XKBSET source is now extracting..."
  rm -rf xkbset-$XKBSET
  tar xzf $CWD/xkbset-$XKBSET.tar.gz
  cd xkbset-$XKBSET
  chown -R root.root .
  if [ "$MAC_PREFIX" = "/usr" ]; then
      sed -i 's@usr/X11R6@usr@' Makefile
  fi
  make
  make install DESTDIR=$PKG

  # Wrapper script:
  cat << EOF > $PKG/$MAC_PREFIX/bin/right-click
#!/bin/sh

xmodmap -e 'keycode 116 = Pointer_Button3'
xkbset m
EOF
  chmod 755 $PKG/$MAC_PREFIX/bin/right-click

  # Throw the xbindkeys config in your home directory:
  mkdir -p $PKG/$HOMEDIR/.config/autostart
  cp $PKG/$MAC_PREFIX/doc/macbook-tools-$MACBOOKTOOLS/.xbindkeysrc $PKG/$HOMEDIR
  # Now add both startup programs to Gnome:
  cat << EOF > $PKG/$HOMEDIR/.config/autostart/xbindkeys.desktop
[Desktop Entry]
Name=xbindkeys
Encoding=UTF-8
Version=1.0
Exec=$MAC_PREFIX/bin/xbindkeys
X-GNOME-Autostart-enabled=true
EOF
  cat << EOF > $PKG/$HOMEDIR/.config/autostart/right-click.desktop
[Desktop Entry]
Name=right-click
Encoding=UTF-8
Version=1.0
Exec=$MAC_PREFIX/bin/right-click
X-GNOME-Autostart-enabled=true
EOF
fi

# Compress and strip
gzip -9 $PKG/$MAC_PREFIX/man/man?/*.?
( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null )

# Make the package description:
cat << EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.

            |-----handy-ruler-------------------------------------------------|
macbook-tools: macbook-tools (MacBook Tools)
macbook-tools:
macbook-tools: Utilities for Apple MacBook and MacBook Pro. It contains the
macbook-tools: backlight tool for screen backlight handling and the applesmc
macbook-tools: tool for keyboard backlight, light and motion sensors. This
macbook-tools: package also contains 'xbindkeys' to use the above mentioned
macbook-tools: utilities from their respective function keys on the keyboard.
macbook-tools:
macbook-tools: Read $MAC_PREFIX/doc/macbook-tools-$MACBOOKTOOLS/README for more info.
macbook-tools:
macbook-tools:
EOF

# Build the package:
cd $PKG
makepkg -l y -c n $TMP/$PKGNAME-$PKGVER-$ARCH-$BUILD.tgz

EDIT 11-27-06

Here is a crazy new macbook-tools build script. It now also has 'coretemp', 'hddtemp' and 'cpufreq' which is a wrapper script I wrote to overcome some problems I was having with adjusting the speed of the 2nd processor. Jump to the second page to read more about that.
Code:

#!/bin/sh
#
# Let's incorporate macbook-tools and xbindkeys into the same package.
# You can also add XKBSET and automatic right-click/right-apple-key support (gnome).
# This also comes with 'coretemp', 'hddtemp' and a wrapper script for
# cpufreq-selector called 'cpufreq'...
#
# http://www.boichat.ch/nicolas/macbook-tools/
# http://hocwp.free.fr/xbindkeys/xbindkeys.html
# http://www.math.missouri.edu/~stephen/software/
# http://svn.sourceforge.net/viewvc/mactel-linux/trunk/tools/temperature/
# http://www.guzu.net/linux/hddtemp.php

CWD=`pwd`
TMP=/tmp
PKGNAME=macbook-tools
PKG=$TMP/package-$PKGNAME
MACBOOKTOOLS=0.1.1
XBINDKEYS=1.7.3
XKBSET=0.5
HDDTEMP=0.3-beta15
PKGVER=${MACBOOKTOOLS}
ARCH=i486
BUILD=1
# Make sure XKBSET is correct in the script below:
# I don't think you can sed a variable...
X11_PREFIX=/usr/X11R6
CFLAGS="-march=i486 -mtune=i686 -pipe -O2"
# This part is rather unorthodox so we'll use it as an option.
# Not a big fan of multiple packages and manual configuration. :-)
# Scroll down some to see what it does. HOMEDIR is also used for
# the cpufreq part. Make sure it's set to your home dir.
INSTALLXKBSET=yes
HOMEDIR=/root
# Select the CPU frequency governer you wish to use. Available options are:
# performance, powersave, ondemand, conservative and userspace.
GOVERNER=ondemand

rm -rf $PKG
mkdir -p $PKG/{install,usr/{bin,doc/macbook-tools-$MACBOOKTOOLS}}

cd $TMP
echo
echo "macbook-tools-$MACBOOKTOOLS source is now extracting..."
rm -rf macbook-tools-$MACBOOKTOOLS
tar xjf $CWD/macbook-tools-$MACBOOKTOOLS.tar.bz2
cd macbook-tools-$MACBOOKTOOLS
chown -R root.root .
make
install -m 755 -o root -g root applesmc  $PKG/usr/bin
install -m 755 -o root -g root backlight $PKG/usr/bin

cd $TMP
echo
echo "Building coretemp..."
gcc -o coretemp $CWD/coretemp.c
strip coretemp
install -m 755 -o root -g root coretemp $PKG/usr/bin
rm -rf coretemp

cd $TMP
echo
echo "hddtemp-$HDDTEMP source is now extracting..."
rm -rf hddtemp-$HDDTEMP
tar xjf $CWD/hddtemp-$HDDTEMP.tar.bz2
cd hddtemp-$HDDTEMP
chown -R root.root .
./configure --prefix=/usr
make
make install DESTDIR=$PKG
if [ ! -f $PKG/usr/share/misc/hddtemp.db ]; then
  mkdir -p $PKG/usr/share/misc
  if [ ! -f $CWD/hddtemp.db ]; then
      ( cd $PKG/usr/share/misc
        wget http://www.guzu.net/linux/hddtemp.db )
  else
      install -m 644 -g root -o root $CWD/hddtemp.db $PKG/usr/share/misc
  fi
fi

cd $TMP
echo
echo "xbindkeys-$XBINDKEYS source is now extracting..."
rm -rf xbindkeys-$XBINDKEYS
tar xzf $CWD/xbindkeys-$XBINDKEYS.tar.gz
cd xbindkeys-$XBINDKEYS
chown -R root.root .
# It's crapping out on guile. We don't need it anyway.
./configure --prefix=$X11_PREFIX \
    --disable-guile
make
make install DESTDIR=$PKG

# Add a wrapper script for eject:
cat << EOF > $PKG/usr/bin/maceject
#!/bin/sh

if mount | grep /dev/hda 2>/dev/null 1>/dev/null ;then
  umount /dev/hda
fi
eject /dev/hda
EOF
chmod 755 $PKG/usr/bin/maceject

# Add a wrapper script for mount:
cat << EOF > $PKG/usr/bin/macmount
#!/bin/sh

if ! mount | grep /dev/hda 2>/dev/null 1>/dev/null ;then
  mount /dev/hda /mnt/cdrom
fi
EOF
chmod 755 $PKG/usr/bin/macmount

# Throw a ~/.xbindkeysrc and README in /usr/doc
# We could also put .xbindkeysrc in $PKG/etc/skel...
cat << EOF > $PKG/usr/doc/macbook-tools-$MACBOOKTOOLS/.xbindkeysrc
###########################
# xbindkeys configuration #
###########################
#
# If you edit this file, do not forget to uncomment any lines
# that you change.
# The pound(#) symbol may be used anywhere for comments.
#
# To specify a key, you can use 'xbindkeys --key' or
# 'xbindkeys --multikey' and put one of the two lines in this file.
#
# The format of a command line is:
#    "command to start"
#      associated key
#
#
# A list of keys is in $X11_PREFIX/include/X11/keysym.h and in
# $X11_PREFIX/include/X11/keysymdef.h
# The XK_ is not needed.
#
# List of modifier:
#  Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock),
#  Mod3 (CapsLock), Mod4, Mod5 (Scroll).
#

# The release modifier is not a standard X modifier, but you can
# use it if you want to catch release events instead of press events

# By defaults, xbindkeys does not pay attention with the modifiers
# NumLock, CapsLock and ScrollLock.
# Uncomment the lines above if you want to pay attention to them.

#keystate_numlock = enable
#keystate_capslock = enable
#keystate_scrolllock= enable

# Run "xbindkeys --multikey" for the keycode of multiple key presses
# Run "xbindkeys --key" for the keycode of a single key press

#################
# Mac Book Pro: #
#################

# [fn]+[F1] Lower LCD backlight by a factor of 10
"backlight -10"
  m:0x0 + c:67

# [fn]+[F2] Raise LCD backlight by a factor of 10
"backlight +10"
  m:0x0 + c:68

# [fn]+[F8] Turn Keyboard backlight OFF
"applesmc 0"
  m:0x0 + c:74

# [fn]+[F9] Turn Keyboard backlight ON HALFWAY
"applesmc 127"
  m:0x0 + c:75

# [fn]+[F10] Turn Keyboard backlight ON all the way
"applesmc 255"
  m:0x0 + c:76

# Top right eject key ( next to [F12] )
"maceject"
  m:0x0 + c:204

# Might as well have a mount key too for us non-hal users [F12]
"macmount"
  m:0x0 + c:96

##################################
# End of xbindkeys configuration #
##################################
EOF

cat << EOF > $PKG/usr/doc/macbook-tools-$MACBOOKTOOLS/README
The sample .xbindkeysrc in this directory is for Macintosh
computers. It was specifically made for a MacBook Pro. To
use it, copy it to your home directory and then have "xbindkeys"
start up with your xsession.

With Gnome use:
Desktop --> Preferences --> Sessions --> Startup Programs

If you opted to use the INSTALLXKBSET variable in the build script
then you shouldn't have to do any configuring. It will just
work the next time you start your X server (if running Gnome). Not
only will LCD Backlight, Keyboard Backlight and the eject key work,
but your right apple key will function as a right click too.
EOF

# Wrapper script for cpufreq-selector and GNOME autostart:
cat << EOF > $PKG/usr/bin/cpufreq
#!/bin/sh
#
# This is a wrapper script for 'cpufreq-selector'.
# The second processor doesn't respond to user calls via
# applets or directly thru cpufreq-selector. It's a hack
# to set both procs with the same governer at once.

CLONE="cp /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor"

# Load all the modules:
if ! lsmod | grep speedstep_centrino 2>/dev/null 1>/dev/null ;then
  modprobe speedstep_centrino > /dev/null 2>&1
  modprobe cpufreq_conservative > /dev/null 2>&1
  modprobe cpufreq_ondemand > /dev/null 2>&1
  modprobe cpufreq_powersave > /dev/null 2>&1
  modprobe cpufreq_userspace > /dev/null 2>&1
  modprobe cpufreq_stats > /dev/null 2>&1
  modprobe freq_table > /dev/null 2>&1
fi

case "@1" in
        performance)

        cpufreq-selector -c 0 -g performance
        @CLONE
        ;;

        powersave)

        cpufreq-selector -c 0 -g powersave
        @CLONE
        ;;

        ondemand)

        cpufreq-selector -c 0 -g ondemand
        @CLONE
        ;;

        conservative)

        cpufreq-selector -c 0 -g conservative
        @CLONE
        ;;

        userspace)

        cpufreq-selector -c 0 -g userspace
        @CLONE
        ;;

        *)
        echo "Usage: @0 {performance|powersave|ondemand|conservative|userspace}"
        exit 1
        ;;
esac
EOF
sed -i 's/@/$/' $PKG/usr/bin/cpufreq
chmod 755 $PKG/usr/bin/cpufreq
mkdir -p $PKG/$HOMEDIR/.config/autostart
cat << EOF > $PKG/$HOMEDIR/.config/autostart/cpufreq.desktop
[Desktop Entry]
Name=cpufreq
Encoding=UTF-8
Version=1.0
Exec=/usr/bin/cpufreq $GOVERNER
X-GNOME-Autostart-enabled=true
EOF

# I'm lazy. And prefer monolithic packages. If they have ANYTHING
# to do with each other then why not clump them all together?
# You should see my Python build script.... :-)
if [ "$INSTALLXKBSET" = "yes" ]; then
  mkdir -p $PKG/$X11_PREFIX/{bin,man/man1}
  cd $TMP
  echo
  echo "xkbset-$XKBSET source is now extracting..."
  rm -rf xkbset-$XKBSET
  tar xzf $CWD/xkbset-$XKBSET.tar.gz
  cd xkbset-$XKBSET
  chown -R root.root .
  if [ "$X11_PREFIX" = "/usr" ]; then
      sed -i 's@usr/X11R6@usr@' Makefile
  fi
  make
  make install DESTDIR=$PKG

  # Wrapper script:
  cat << EOF > $PKG/usr/bin/right-click
#!/bin/sh

xmodmap -e 'keycode 116 = Pointer_Button3'
xkbset m
EOF
  chmod 755 $PKG/usr/bin/right-click

  # Throw the xbindkeys config in your home directory:
  mkdir -p $PKG/$HOMEDIR/.config/autostart
  cp $PKG/usr/doc/macbook-tools-$MACBOOKTOOLS/.xbindkeysrc $PKG/$HOMEDIR
  # Now add both startup programs to Gnome:
  cat << EOF > $PKG/$HOMEDIR/.config/autostart/xbindkeys.desktop
[Desktop Entry]
Name=xbindkeys
Encoding=UTF-8
Version=1.0
Exec=$X11_PREFIX/bin/xbindkeys
X-GNOME-Autostart-enabled=true
EOF
  cat << EOF > $PKG/$HOMEDIR/.config/autostart/right-click.desktop
[Desktop Entry]
Name=right-click
Encoding=UTF-8
Version=1.0
Exec=/usr/bin/right-click
X-GNOME-Autostart-enabled=true
EOF
fi

# Compress and strip
gzip -9 $PKG/$X11_PREFIX/man/man?/*.?
gzip -9 $PKG/usr/man/man?/*.?
( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null )

# Make the package description:
cat << EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.

            |-----handy-ruler-------------------------------------------------|
macbook-tools: macbook-tools (MacBook Tools)
macbook-tools:
macbook-tools: Utilities for Apple MacBook and MacBook Pro. It contains:
macbook-tools:
macbook-tools: backlight - Screen backlight handling
macbook-tools: applesmc  - Keyboard backlight, light and motion sensors
macbook-tools: xbindkeys - Maps the above utilities to their respective keys.
macbook-tools: coretemp  - CPU temperature
macbook-tools: hddtemp  - Hard drive temperature
macbook-tools: cpufreq  - Wrapper script for cpufreq-selector
macbook-tools:
EOF

# Build the package:
cd $PKG
makepkg -l y -c n $TMP/$PKGNAME-$PKGVER-$ARCH-$BUILD.tgz

Here is a listing of $CWD incase your confused about all the crap... ;)
Code:

root@darkstar:~/Desktop/macbook-tools-0.1.1# ls -la *
-rw-r--r-- 1 root root  2332 2006-11-26 10:18 coretemp.c
-rw-r--r-- 1 root root 256372 2006-11-26 11:22 hddtemp-0.3-beta15.tar.bz2
-rw-r--r-- 1 root root  20608 2006-11-26 16:48 hddtemp.db
-rw-r--r-- 1 root root  4137 2006-11-06 10:21 macbook-tools-0.1.1.tar.bz2
-rw-r--r-- 1 root root  10287 2006-11-27 19:11 macbook-tools.build
-rw-r--r-- 1 root root 110561 2006-11-06 11:51 xbindkeys-1.7.3.tar.gz
-rw-r--r-- 1 root root  13933 2006-11-06 14:34 xkbset-0.5.tar.gz

EDIT 12-24-06

The mbpeventd package is MUCH better at handling this stuff. Jump ahead to see the post concerning that.

jong357 11-07-2006 12:02 AM

Figured out how to get a higher res on the frame buffer along with the 2 penguins up top. The Gentoo LiveCD Spalsh worked so I booted that up and looked at it's dmesg to see what it was using.

Get into the Graphics section of your kernel config and disable

Intel-based Macintosh Framebuffer Support

and just use the regular old vesa FB by specifying vga=791 in lilo.conf.

UPDATE 11-27-06

append="video=imacfb:i17"

is used for elilo. If your using refit/lilo then use vga=791


All times are GMT -5. The time now is 06:47 PM.