Difference between revisions of "Xbox Linux Tips and Tricks"
VannevarKush (talk | contribs) (→Using USB serial devices) |
VannevarKush (talk | contribs) (→Using USB serial devices) |
||
Line 65: | Line 65: | ||
Here are my notes on doing this, which should probably be translated into actual config options: | Here are my notes on doing this, which should probably be translated into actual config options: | ||
− | Device Drivers -> USB Support | + | <code> |
− | + | Device Drivers -> USB Support | |
− | Enable serial, Kernel | + | |
− | + | Enable serial, Kernel | |
− | Device Drivers -> Character Devices -> Serial Drivers: | + | |
− | 8250/16550 Compatible serial support | + | Device Drivers -> Character Devices -> Serial Drivers: |
− | Support 8250_core.* kernel options (DEPRECATED) - default | + | 8250/16550 Compatible serial support |
− | Console on 8250/16550 and compatible serial port | + | Support 8250_core.* kernel options (DEPRECATED) - default |
− | 8250/16550 PCI device support #is this only for xbox7887's board? | + | Console on 8250/16550 and compatible serial port |
− | 1 port to register at runtime | + | 8250/16550 PCI device support #is this only for xbox7887's board? |
+ | 1 port to register at runtime</code> | ||
===Unpacking and Repacking an initramfs/initrd=== | ===Unpacking and Repacking an initramfs/initrd=== | ||
(todo) | (todo) |
Revision as of 00:09, 3 July 2022
Contents
128MB RAM Upgrade
Yep, it helps here too. Any modern Linux distro that isn't built for lightweight hardware is probably going to assume there is a lot more memory available than the Xbox has. The more memory and the more non-lightweight services in use, the more swapping is going to happen. With 64MB of RAM a lot of swapping is going to take place during any memory-intensive operation, slowing Linux to a crawl. So the 128MB of RAM can give Linux some more breathing room. More minimal distros may be able to run fine with a (very) lightweight desktop with 64MB. The vanilla Gentoo LiveCD command line environment worked fine until compiling. But even operations like extracting files take forever and could be done faster with less disk access with more RAM.
hdb as Swap
Swapping to the same drive as data is being read from is far from ideal. If instead of a DVD drive, a hard drive is connected hdb, it can be used exclusively (or primarily) for swap. An unlocked stock Xbox hard drive could be used for this (back it up first!) but better performance will be obtained with an SSD. Small SSDs are not very expensive, and if it's just used for swapping, it can be easily replaced if it dies. (and do you really plan to use it for swap all day every day? It would only incur wear on the storage while running Xbox Linux. Does Linux have any sort of write levelling support for swap?)
USB Stick as Swap
When booting from a liveCD, if you you don't want to alter data on hda but swap is needed to increase available memory, a USB stick can be mounted as swap. This can be added early in the startup script if needed, in the initrd. This is very slow but can work for bootstrapping things to the point of being able to create swap on a hard drive.
Hard Drive on hdb as a Bootable CD
This was tested with a Gentoo minimal install CD. A partition was created on hdb using a PC, and formatted with vfat. The partition was set as the cd root in the boot options in linuxboot.cfg (it didn't need to change if the hard drive was fomratted as a single partition. If it needs to change, e.g. to /dev/hdb1 instead of /dev/hdb, the linuxboot.cfg, kernel, and initrd from the CD can be copied to the appropriate locations your hard drive, modified, and launched from there if you want to modify them without burning a new CD.)
This may not work for all live CDs. It didn't work with historical GentooX. If it doesn't work, modification of the startup script is probably required to mount from hdb more generically instead of doing something CD or ISO oriented.
The hard drive can be formatted with multiple partitions, one for the CD files, and swap can also be set up there, so as to have swap available without needing to modify hda or use a USB stick.
Using the Extra 2GB on a 10GB FATX Hard Drive
Not all stock Xbox hard drives are 8GB, some are 10GB. Look up your model number if you're not sure. If you have a spare 10GB stock hard drive sitting around, back it up. Then small native Linux builds can be installed to the 2GB at the end of the drive (remember to have swap), and that area of the drive can also be used for experimentation. Or, install a (small) historical Xbox Linux build like X-DSL to that hard drive as a native install, which should handle the partitioning automatically. (Note that attempting a native install typically wipes out anything after drive E, and also is not compatible with XBPartitioner formatting. It will wipe out any XBPartitioner information, and a format with XBPartitioner after that will break Linux. It is fine though to wipe out the XBPartitioner information by installing native Linux, if you intend to never use XBPartitioner again on that drive)
Using xbox7887's Serial USB Adapter (on the LPC bus)
xbox7887 has created an open source SuperIO board, which connects to the LPC bus on the Xbox (more commonly known as the debug port; the place where you put a modchip.) SuperIO provides various legacy I/O technologies on a single chip, and was used on computer motherboards to provide PS/2, serial, parallel, floppy, and other interfaces. The LPC bus is a PCI device that can have various peripherals connected to it.
SuperIO was used in original Xbox dev kits (the clear ones, not the green ones.) It provided a means of doing Xbox kernel debugging over a serial connection provided by the SuperIO chip via the LPC. This is what these boards are typically used for.
Because LPC is a standard PC technology that is supported by Linux, devices on the LPC bus can be accessed from within Linux. Although xbox7887's board only provides access to one serial port, it would be theoretically possible to build out a board that supported parallel ports, floppy drives, etc... (although floppy drive support has been dropped from Linux)
An important note is that there may be very few Xbox bioses that support this board, at least if the Xbox BIOS is booted first. (not tested with Cromwell flashed to TSOP/modchip). A bios that is known to work is X2 4981.67_256k. Other BIOSes may work but there was some confusion during the testing, so this part could be wrong.
Here are the kernel config options that should needed to support this board on Xbox (not sure what's going on with formatting here.) (should these be merged into the default xbox config options? they might need to be re-tested first)
CONFIG_SERIAL_EARLYCON=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_DEPRECATED_OPTIONS=y # CONFIG_SERIAL_8250_16550A_VARIANTS is not set # CONFIG_SERIAL_8250_FINTEK is not set CONFIG_SERIAL_8250_CONSOLE=y # CONFIG_SERIAL_8250_PCI is not set CONFIG_SERIAL_8250_NR_UARTS=2 CONFIG_SERIAL_8250_RUNTIME_UARTS=2 CONFIG_SERIAL_8250_EXTENDED=y # CONFIG_SERIAL_8250_MANY_PORTS is not set # CONFIG_SERIAL_8250_SHARE_IRQ is not set CONFIG_SERIAL_8250_DETECT_IRQ=y # CONFIG_SERIAL_8250_RSA is not set # CONFIG_SERIAL_8250_DW is not set # CONFIG_SERIAL_8250_RT288X is not set # CONFIG_SERIAL_8250_LPSS is not set # CONFIG_SERIAL_8250_MID is not set CONFIG_SERIAL_CORE=y CONFIG_SERIAL_CORE_CONSOLE=y
Note that this board can be used for debugging the Xbox kernel over serial, if the proper kernel config options are set for that.
Also note that serial over USB is a perfectly workable option if you don't have one of these boards on hand :)
Using USB serial devices
[Needs kernel config options, which once determined should probably be considered for merging into the xbox defconfig]
===Using Serial (USB or xbox7887's SuperIO board) for Kernel Debugging Kernel debugging was accomplished successfully using gdb, over both USB serial and xbox7887's board.
Since SSH can't connect early enough to debug the kernel on startup, a serial connection can be used as soon as it's available. Both the LPC and USB controllers are PCI devices, so they will become active at PCI init.
Here are my notes on doing this, which should probably be translated into actual config options:
Device Drivers -> USB Support Enable serial, Kernel Device Drivers -> Character Devices -> Serial Drivers: 8250/16550 Compatible serial support Support 8250_core.* kernel options (DEPRECATED) - default Console on 8250/16550 and compatible serial port 8250/16550 PCI device support #is this only for xbox7887's board? 1 port to register at runtime
Unpacking and Repacking an initramfs/initrd
(todo)