Hi all. I just updated my 4 year old linux install to Ubuntu Precise and
the mainline Linux 3.5 kernel*. It works OK (video, wifi, IR, RCA sound,
all using built-in drivers) but I'd like to make some tweaks to
atv-bootloader to make it even better.
* http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.5-quantal/
I've normally used my ATV as a low-power headless server, but now I'm
trying to interface it with my 2006ish plasma tv.
I'm sticking with the built-in Nouveau drivers which have come a long way.
My old TV overscans everything (no setting for 1:1 mode), and the nouveau
driver offers no "underscan" (overscan-compensation) for the HDMI output.
It does offer some compensation on the TV output, but it was auto-detecting
it as a SCART output instead of a component out, which screws up the colors.
Attached is a little patch to the nouveau driver that allows it to
autodetect the TV-out as component. It just twiddles one bit in the NVIDIA
VBios. You can use the linked kernel headers and just rebuild the nouveau
module in a 3.5 source tree from kernel.org without building a whole new
kernel. Paraphrasing how to use the patch:
wget <the headers and i386 kernel package .deb urls>
dpkg -i *.deb
<adjust your boot_linux.sh to kexec /boot/vmlinuz-3.5.0-030500-generic,
reboot your ATV into the new kernel>
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.5.tar.bz2
tar -xjf linux-3.5.tar.bz2
cd linux-3.5
patch -Np1 < appletv_nouveau_component_video.patch
cp /boot/config-3.5.0-030500-generic .config
cp /usr/src/linux-headers-3.5.0-030500-generic/Module.symvers ./
make modules_prepare
make M=drivers/gpu/drm/nouveau
mkdir /lib/modules/3.5.0-030500-generic/updates/
cp
drivers/gpu/drm/nouveau/nouveau.ko /lib/modules/3.5.0-030500-generic/updates/
depmod -a
modprobe nouveau tv_norm=hd720p #use "modinfo nouveau" to see your options
Long-term, I think changes to the VBIOS is something that the
atv-bootloader should do instead of adding a quirk to the linux driver. It
should also be copying the VBIOS to the traditional address as well. I read
on the atv-bootlaoder blog that Scott has hacked the code to do this. I'm
trying to recreate that functionality but am having trouble understanding
how to change the E820 map to reserve the VBIOS & VRAM address spaces
against use by the kernel.
If I could get that VBIOS copied, I'm thinking of then running "vbetool
post" from ramboot-linux ("penbuntu") to initialize the card and then
kexec'ing into the ubuntu kernel in pure text mode (vgacon driver). I think
this would allow one to change resolution of nouveau's console framebuffer
using fbset, currently the console works but the mode cannot be adjusted.
X11 mode setting does currently work using the xrandr command, but it seems
to be based on scaling, the TV's mode does not actually change. Down the
road, POSTing the VBIOS straight from atv-bootlaoder using v86 mode would
be even better, but I'm still getting my feet wet with real-mode stuff.
I'm contemplating porting coreboot if I get a spare ATV on the cheap,
rending these hacks useless :-). The EEPROM can be reflashed with a $30 Bus
Pirate and coreboot has been ported to the Pentium-M, i945, ICH7 combo
before.
If you have any questions on the 3.5 install, fire away. I haven't made a
tutorial yet but I might if enough are interested. I'd also appreciate any
hints on extending the bootloader.
-joey
--
To post to this group, send email to [email protected]
For more options, visit this group at
http://groups.google.com/group/atv-bootloader?hl=en--- linux-3.5/drivers/gpu/drm/nouveau/nouveau_bios.c.orig 2012-07-24 17:33:12.403025705 -0700
+++ linux-3.5/drivers/gpu/drm/nouveau/nouveau_bios.c 2012-07-23 02:22:21.978433206 -0700
@@ -31,6 +31,7 @@
#include <linux/io-mapping.h>
#include <linux/firmware.h>
+#include <linux/dmi.h>
/* these defines are made up */
#define NV_CIO_CRE_44_HEADA 0x0
@@ -6091,6 +6092,29 @@
}
}
+ /* AppleTV 1st gen: on-board GeForce Go 7300 (NV46)
+ *
+ * The framebuffer is initialized by Apple's EFI-based firmware instead of by NVidia VBIOS.
+ * EFI passes a hardcoded DCB-like table to the OSX kernel, so its drivers can do their own probing.
+ * The DCB table that nouveau finds in the VBIOS from PRAMIN is malformed, causing the
+ * component TV-output to be plumbed as a SCART connector. Override that with this quirk.
+ * [drm] nouveau 0000:01:00.0: DCB version 3.0
+ * [drm] nouveau 0000:01:00.0: DCB outp 02: 04021112 00000000
+ * [drm] nouveau 0000:01:00.0: DCB outp 03: 020321f1 0081c01c
+ * [drm] nouveau 0000:01:00.0: DCB conn 00: 0000
+ * [drm] nouveau 0000:01:00.0: DCB conn 01: 1161
+ * [drm] nouveau 0000:01:00.0: DCB conn 02: 0213
+ */
+ if (nv_match_device(dev, 0x01d7, 0x106b, 0x0081)
+ && dmi_match(DMI_PRODUCT_NAME, "AppleTV1,1")
+ && dmi_match(DMI_SYS_VENDOR, "Apple Inc.") ) {
+
+ if (idx == 3) {
+ *conf = *conf | (0x8 << 4); //toggle the 8th from last bit to enable component out
+ NV_TRACEWARN(dev, "DCB outp %02d: AppleTV quirk - enabled TV_COMPONENT output bit\n", idx);
+ }
+ }
+
return true;
}