How to rebuild the kernel to add a driver?

Help with using MiniMyth's build system

Moderator: Pablo

Post Reply
Grant_Edwards
Member
Posts: 19
Joined: Wed Mar 04, 2009 11:12 pm

How to rebuild the kernel to add a driver?

Post by Grant_Edwards »

MiniMyth is working on my shiny new Mac mini, except for one
minor problem: there is no driver for the Intel 82801GBM/GHM
(ICH7 Family) SATA AHCI Controller. That's not a fatal problem
since MiniMyth isn't using the hard drive for anything.

However, I'd like to spin it down to save on power/heat/noise,
and I can't do that when the SATA controller isn't supported.
AFAICT, the AHCI driver is reported to work with the Intel
controller. According to the kernel config file in /proc, the
ahci driver was built as a module, but it doesn't seem to be
included anywhere in the rootfs.

Are the "extra" modules that aren't in the downloaded rootfs
available somewhere?

Is it possible to rebuild the kernel in order to enable a new
driver without going through the entire system build process?

--
Grant
Pablo
Site Admin
Posts: 4182
Joined: Tue Dec 14, 2004 2:13 am
Location: La Jolla
Contact:

Post by Pablo »

The AHCI driver is built. However, it has not been included in the default image because the only drives that people tend to include in MiniMyth frontends are DVD drives.

If you are building MiniMyth from source, then you can add

Code: Select all

mm_USER_LIB_LIST += modules/*/kernel/drivers/ata/ahci.ko
to your $HOME/.minimyth/minimyth.conf.mk file. In addition, I will add it to the next test build.

If you have a chance, could you answer some questions so that I can improve MiniMyth. In getting MiniMyth working on the Mac Mini, did you need to customize anything (e.g., boot line parameters, configuration files other than minimyth.conf, etc)? Also, what is the output of

Code: Select all

lspci -mn
MiniMyth running on an Acer ApireRevo 3610 and a Zotac ZBOX-ID80-U. Find out more at my MythTV page.
Grant_Edwards
Member
Posts: 19
Joined: Wed Mar 04, 2009 11:12 pm

Post by Grant_Edwards »

Pablo wrote:The AHCI driver is built. However, it has not been included in
the default image because the only drives that people tend to
include in MiniMyth frontends are DVD drives.
That's understandable -- though the last time I put a DVD drive
into a box, it was SATA (the cabling is a lot easier to deal
with).
If you are building MiniMyth from source, then you can add

Code: Select all

mm_USER_LIB_LIST +=modules/*/kernel/drivers/ata/ahci.ko
to your $HOME/.minimyth/minimyth.conf.mk file. In addition, I will add
it to the next test build.
I'll have a go at building minimyth. I was hoping I could just
recompile the kernel with the AHCI driver included and not have to
touch the rootfs.
If you have a chance, could you answer some questions so that I
can improve MiniMyth. In getting MiniMyth working on the Mac
Mini, did you need to customize anything (e.g., boot line
parameters, configuration files other than minimyth.conf, etc)?
I haven't done anything except play with a few options on the
kernel command line. The grub.cfg entry currently looks like
this:

Code: Select all

menuentry "MiniMyth" {
  search --set /grub/kernel
  linux /grub/kernel ro video=vesafb loglevel=7 agp=off acpi=force root=/dev/ram0 ramdisk_size=96000 gpt MM_DEBUG=yes
  initrd /grub/rootfs
}
The "video=vesafb" is required to get any console output.

Framebuffer graphics don't work with or without the
"video=vesafb" line.

I don't think it makes any difference whether "acpi=force" is
there or not -- it was suggested by a posting I found about
booting linux on Intel Mac platforms, but I can't tell any
difference.

AFAICT, the agp=off doesn't matter either, but I'm not done
testing things yet. Before I spend much more time on it I need
to move the box so it doesn't have to tunnel through two DSL
connections and a VPN server to reach a backend.

I think the "gpt" option is supposed to enable support for
Apple-style partition tables in something, but I doubt the
MiniMyth kernel has that feature enabled. [At this point it's
moot due to the lack of the AHCI driver.]
Also, what is the output of

Code: Select all

lspci -mn

Code: Select all

root@mmyth:~ # lspci
00:00.0 Host bridge: Intel Corporation Mobile 945GM/PM/GMS, 943/940GML and 945GT Express Memory Controller Hub (rev 03)
00:02.0 VGA compatible controller: Intel Corporation Mobile 945GM/GMS, 943/940GML Express Integrated Graphics Controller (rev 03)
00:02.1 Display controller: Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller (rev 03)
00:07.0 Performance counters: Intel Corporation Device 27a3 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller (rev 02)
00:1c.0 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation 82801G (ICH7 Family) PCI Express Port 2 (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 (rev 02)
00:1d.3 USB Controller: Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e2)
00:1f.0 ISA bridge: Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge (rev 02)
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 02)
00:1f.2 SATA controller: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA AHCI Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801G (ICH7 Family) SMBus Controller (rev 02)
01:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8053 PCI-E Gigabit Ethernet Controller (rev 22)
02:00.0 Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01)
03:03.0 FireWire (IEEE 1394): Agere Systems FW323 (rev 61)

root@mmyth:~ # lspci -mn
00:00.0 "0600" "8086" "27a0" -r03 "8086" "7270"
00:02.0 "0300" "8086" "27a2" -r03 "8086" "7270"
00:02.1 "0380" "8086" "27a6" -r03 "8086" "7270"
00:07.0 "1101" "8086" "27a3" -r03 "" ""
00:1b.0 "0403" "8086" "27d8" -r02 "8384" "7680"
00:1c.0 "0604" "8086" "27d0" -r02 "" ""
00:1c.1 "0604" "8086" "27d2" -r02 "" ""
00:1d.0 "0c03" "8086" "27c8" -r02 "8086" "7270"
00:1d.1 "0c03" "8086" "27c9" -r02 "8086" "7270"
00:1d.2 "0c03" "8086" "27ca" -r02 "8086" "7270"
00:1d.3 "0c03" "8086" "27cb" -r02 "8086" "7270"
00:1d.7 "0c03" "8086" "27cc" -r02 -p20 "8086" "7270"
00:1e.0 "0604" "8086" "2448" -re2 -p01 "" ""
00:1f.0 "0601" "8086" "27b9" -r02 "8086" "7270"
00:1f.1 "0101" "8086" "27df" -r02 -p8f "8086" "7270"
00:1f.2 "0106" "8086" "27c5" -r02 -p01 "8086" "7270"
00:1f.3 "0c05" "8086" "27da" -r02 "8086" "7270"
01:00.0 "0200" "11ab" "4362" -r22 "11ab" "5321"
02:00.0 "0200" "168c" "001c" -r01 "106b" "0086"
03:03.0 "0c00" "11c1" "5811" -r61 -p10 "11c1" "5811"
root@mmyth:~ # 
As I mentioned before, X works fine and the frontend runs. The
sound driver appears to be happy, but I haven't had a chance to
play any media files yet.

The one thing I haven't looked at yet is the built-in IR
receiver. I know it _can_ work under Linux, but I don't know
what's involved. To avoid mounting restrictions, I might just
use an external USB-connected IR receiver that I've got.

I did just discover that if you put the grub bootloader in the
HFS+ partition instead of the FAT32 partition, you can avoid
the 30 second delay before grub starts.

It would be nice to figure out why the framebuffer graphics
don't work, but that's not a big deal.

--
Grant
Grant_Edwards
Member
Posts: 19
Joined: Wed Mar 04, 2009 11:12 pm

Post by Grant_Edwards »

I've successfully qbuilt gar-minimyth-0.20.2-64 except for
mythstream -- there was a library missing:

Code: Select all

make[1]: `../../myth-0.21/mythnews/cookies/main.d/install' is up to date.
make[1]: `../../myth-0.21/mythphone/cookies/main.d/install' is up to date.
 ==> Building myth-0.21/mythstream as a dependency
make[2]: Entering directory `/home/grante/minimyth/build/gar-minimyth-0.20.2-64/script/myth-0.21/mythstream'
[===== NOW BUILDING:	mythstream-v0.18_1	=====]
	[fetch] complete for mythstream.
	[checksum] complete for mythstream.
	[extract] complete for mythstream.
	[patch] complete for mythstream.
	[configure] complete for mythstream.
 ==> Running make in work/main.d/mythstream-0.18_1
make[3]: Entering directory `/home/grante/minimyth/build/gar-minimyth-0.20.2-64/script/myth-0.21/mythstream/work/main.d/mythstream-0.18_1'
cd mythstream && make -f Makefile
make[4]: Entering directory `/home/grante/minimyth/build/gar-minimyth-0.20.2-64/script/myth-0.21/mythstream/work/main.d/mythstream-0.18_1/mythstream'
rm -f libmythstream.so
g++ -Wl,-rpath,/home/grante/minimyth/build/gar-minimyth-0.20.2-64/images/main/usr/lib/qt3/lib -shared -o libmythstream.so main.o mythstream.o qhttp.o storage.o storagehandlers.o streamstorage.o streamconfig.o storageconfig.o configelements.o itemtree.o streambrowser.o streamstatus.o x11win.o playerencap.o harvester.o fft.o recorder.o speechproc.o moc_mythstream.o moc_qhttp.o moc_storage.o moc_storagehandlers.o moc_streamconfig.o moc_storageconfig.o moc_configelements.o moc_streambrowser.o moc_streamstatus.o moc_harvester.o moc_fft.o moc_recorder.o moc_speechproc.o  -L/home/grante/minimyth/build/gar-minimyth-0.20.2-64/images/main/usr/lib/qt3/lib -lfftw3f -lqt-mt -lpthread 
/home/grante/minimyth/build/gar-minimyth-0.20.2-64/images/build/usr/lib/gcc/i486-pc-linux-gnu/4.3.0/../../../../i486-pc-linux-gnu/bin/ld: cannot find -lfftw3f
collect2: ld returned 1 exit status
make[4]: *** [libmythstream.so] Error 1
make[4]: Leaving directory `/home/grante/minimyth/build/gar-minimyth-0.20.2-64/script/myth-0.21/mythstream/work/main.d/mythstream-0.18_1/mythstream'
make[3]: *** [sub-mythstream] Error 2
make[3]: Leaving directory `/home/grante/minimyth/build/gar-minimyth-0.20.2-64/script/myth-0.21/mythstream/work/main.d/mythstream-0.18_1'
make[2]: *** [build-work/main.d/mythstream-0.18_1/Makefile] Error 2
make[2]: Leaving directory `/home/grante/minimyth/build/gar-minimyth-0.20.2-64/script/myth-0.21/mythstream'
make[1]: *** [../../myth-0.21/mythstream/cookies/main.d/install] Error 2
make[1]: Leaving directory `/home/grante/minimyth/build/gar-minimyth-0.20.2-64/script/meta/minimyth'
make: *** [imgdep-main] Error 2
After disabling mythstream in
gar-minimyth-0.20.2-64/script/minimyth.conf.mk, the build
completed. I don't use mythstream, but I thought somebody
might be interesting in the failure.

The plan is to tweak the kernel config in
gar-minimyth-0.20.2-64/script/kernel-2.6.26/linux/work/main.d/linux-2.6.26.8/.config
and rebuild the kernel to include a few more things in the
kernel image:
  • AHCI SATA support
  • GPT partition table support
  • (maybe) Intel framebuffer driver
Eventually I might look into what it would take to use a
bluetooth keyboard and the built-in IR receiver, but those are
quite a ways down the list.
Post Reply