It has taken a very long time but it's finally here!
Here's v0.31Beta update to XBlast OS:
https://bitbucket.org/psyko_chewbacca/lpcmod_os/downloads/XBlast_OS_v0.31beta.zip
BIOS bin file and XBE version are present in this package.
Please read the "readme.txt" file before using XBlast OS.
Changelog:
EDIT: Big thanks to wienerschnitzel who provided the new icons and backdrop!
For those who are wondering why it took so much time here's why:
TL;DR : I had to reverse engineer a lot of code from SmartXX OS and gradually test everything I integrated into XBlast OS.
Longer explanation:
To avoid having a separate BIOS file for 1.6b Xbox consoles, I initially extracted a part of the initialization sequence(X-codes) from flashBIOS 3.0.3-1 which supposedly was universally compatible across all Xbox revision in a single BIOS file. The problem is that there is a know issue with this code that sometimes caused trouble on 1.6a consoles. Initially, I didn't encounter such issue but it became an increasingly recurrent problem as OS development progressed.
Since the initialization part of the boot process of the Xbox is rather obscure and obviously not very documented, I had very little choice but to try and mimic the init code of other BIOSes that had 100% boot success on all consoles.
I first tried to extract X-codes from Evox M8+ and inject them into XBlast OS (Evox M8+ BIOS will boot on all console) and use more conservative memory timing values (because the main difference between 1.6 M8+ and non-1.6 are memory timings. That's why you should never use a non-1.6 version on a 1.6(b) console and vice-versa.). It partly worked but I then had issues with 1.0 consoles. From an OFF state, I would press the power button, the 1.0 Xbox would power ON for half a second, power cycle and finally reboot into XBlast OS. Really weird stuff I deemed unacceptable behavior for XBlast OS! The M8+ approach was scrapped mainly because of this but also because X-Codes in it looked like a real mess. X-Codes section in M8+ is at least twice as big compared to any other BIOS and there are so many unconditionnal goto statements that could have been avoided by having proper code construction... Really poorly done by the Evox BIOS team...
At the time, I also suspected that there was some sort of x86 assembly init code in M8+ past X-Codes execution that was complementary to it but I did not want to get into this at the time. The issue with 1.0 consoles according to a comment left in cromwell sources is that 1.0 PIC have more strict timeout value to init console than other revisions. If a certain part of the initialization isn't done in a certain amount of time, the PIC will forcefully reset the console. The fact that XBlast OS succesfully boot on such reboot is probably due to the fact that RAM content will be retained across reboot because capacitors on the motherboard will power the RAM for a short period of time even if the console is powered OFF. On the second reboot, the init code is executed much faster because some calculated values from last power ON are already present and thus reduce the init time enough to not trigger the PIC timeout. Ironically, it's kind of like replicating the principle of the Reset Glitch Hack on the Xbox 360!
I then turned myself to a better suited alternative: SmartXX OS. SmartXX OS is cromwell-based(just like XBlast OS) and the last few OS update BIOS files are universally compatible across all Xbox revisions. To my knowledge, no one ever complained of OS boot issues that could relate to a specific motherboard revision. To do this, I downloaded the latest SmartXX OS update and used the decrypter program found in Eurasia's download section (SmartXX udecode, something like that). This produces a 1MB file that contains a lot of stuff and in this pile of bytes, there's a 256KB section that is essentially the OS BIOS file. From this extracted section, I took the MCPX init table (offset 0x00 to 0x80) and X-Codes section (0x80 to 0x1000) and integrated it in XBlast OS sources. Trying to boot this hybrid abomination, I was presented with the same issue on 1.0 consoles I had with the M8+ X-codes... Darn it, so much frustration.
I tried to reorder the X-Codes execution to help speed up Connexant encoder init but it wouldn't do any good. I then proceeded to gradually change the x86 ASM code from XBlast OS (offset 0x1000 and up) to get the same thing that was pesent in the decrypted SmartXX binary. Nothing would do it and I had changed all the assembly code up to the point in cromwell where it changes from x86 assembly to C language. I didn't want to reverse x86 ASM into C code but I did notice in IDA pro that the ASM section of what represent the C code section of the 2bl bootloader was much smaller in SmartXX OS than any other recent cromwell BIOSes (Cromwell 2.40, Gentoox loader, flashBIOS and XBlast OS of course). Ultimately, I found out that the moment when the 2bl was replying to the PIC cryto request happened much later than in SmartXX OS!
To deactivate the timeout counter of the PIC, you have to answer to a "cryptographic" challenge posed by it. Once you supply the PIC the correct "decoded" values, it will disable the timeout countdown and will never try to forcefully reboot the console(until reboot).
The problem reside in the SHA-1 checksum calculation to check integrity of the 2bl in RAM. It takes too much time to calculate! During the time it will calculate the output checksum, the PIC will timeout and reset the console for 1.0 revision. In regular cromwell BIOSes, this wasn't an issue because X-codes execution took less time to complete and SHA-1 calculation could be completed in time to move on to PIC crypto challenge reply. The X-Codes in SmartXX take much more time to execute but that's a side-effect of having true universal revision compatibility. In fact, cromwell uses the PIC reset feature to forcefully reset the console by deliberately not replying to the PIC crypto challenge in the event of a SHA-1 key mismatch (that would signal corrupted 2bl in memory).
So to fix this, I reduced the calculation time of the SHA-1 hash by reducing the algorithm complexity (it's only used as a checksum not encryption so we don't need a full blown SHA-1 compliant value here) and moved PIC crypto challenge reply before SHA-1 calculation (2bl will still reboot the console if a SHA-1 mismatch is detected). Problem solved! 100% boot rate on all Xbox revisions. XBlast OS now uses the "same" init code as SmartXX OS to make it universal. While I was at it, I also reduced the size of 2bl in the 256KB image file of XBlast OS to leave more space for OS features; I gained 3.75KB of space which is not as negligible as you might think. In fact, it's a lot if you consider that this space was occupied by a piece of code that(still) only copy stuff from flash to RAM, calculate checksums, unzip a file and jumps to it.
Before you ask, no it shouldn't be used in hacked BIOSes to make them universal. To make cromwell universal, I have to reduce RAM performance a lot to accomodate every motherboard revision. This would translate in unacceptable performance lost in games and homebrews. Cromwell is "simple" and does not suffer from any noticeable performance drop by doing this. For those who like Gentoox Loader, vanilla Cromwell or any other Cromwell-based BIOSes, you could recompile them using the new code in the "boot_rom" folder of XBlast OS sources and it would generate a truly universal cromwell BIOS.
So there you have it. That's why I postponed release of v0.3Beta for so long. This whole process took a very long time in itself. I also have my professionnal and personnal life(I have to work to live and live to work!), my main dev rig died on me in March and I had some pretty memorable birthday parties the last few days
Here's v0.31Beta update to XBlast OS:
https://bitbucket.org/psyko_chewbacca/lpcmod_os/downloads/XBlast_OS_v0.31beta.zip
BIOS bin file and XBE version are present in this package.
Please read the "readme.txt" file before using XBlast OS.
Changelog:
For those who are wondering why it took so much time here's why:
TL;DR : I had to reverse engineer a lot of code from SmartXX OS and gradually test everything I integrated into XBlast OS.
Longer explanation:
To avoid having a separate BIOS file for 1.6b Xbox consoles, I initially extracted a part of the initialization sequence(X-codes) from flashBIOS 3.0.3-1 which supposedly was universally compatible across all Xbox revision in a single BIOS file. The problem is that there is a know issue with this code that sometimes caused trouble on 1.6a consoles. Initially, I didn't encounter such issue but it became an increasingly recurrent problem as OS development progressed.
Since the initialization part of the boot process of the Xbox is rather obscure and obviously not very documented, I had very little choice but to try and mimic the init code of other BIOSes that had 100% boot success on all consoles.
I first tried to extract X-codes from Evox M8+ and inject them into XBlast OS (Evox M8+ BIOS will boot on all console) and use more conservative memory timing values (because the main difference between 1.6 M8+ and non-1.6 are memory timings. That's why you should never use a non-1.6 version on a 1.6(b) console and vice-versa.). It partly worked but I then had issues with 1.0 consoles. From an OFF state, I would press the power button, the 1.0 Xbox would power ON for half a second, power cycle and finally reboot into XBlast OS. Really weird stuff I deemed unacceptable behavior for XBlast OS! The M8+ approach was scrapped mainly because of this but also because X-Codes in it looked like a real mess. X-Codes section in M8+ is at least twice as big compared to any other BIOS and there are so many unconditionnal goto statements that could have been avoided by having proper code construction... Really poorly done by the Evox BIOS team...
At the time, I also suspected that there was some sort of x86 assembly init code in M8+ past X-Codes execution that was complementary to it but I did not want to get into this at the time. The issue with 1.0 consoles according to a comment left in cromwell sources is that 1.0 PIC have more strict timeout value to init console than other revisions. If a certain part of the initialization isn't done in a certain amount of time, the PIC will forcefully reset the console. The fact that XBlast OS succesfully boot on such reboot is probably due to the fact that RAM content will be retained across reboot because capacitors on the motherboard will power the RAM for a short period of time even if the console is powered OFF. On the second reboot, the init code is executed much faster because some calculated values from last power ON are already present and thus reduce the init time enough to not trigger the PIC timeout. Ironically, it's kind of like replicating the principle of the Reset Glitch Hack on the Xbox 360!
I then turned myself to a better suited alternative: SmartXX OS. SmartXX OS is cromwell-based(just like XBlast OS) and the last few OS update BIOS files are universally compatible across all Xbox revisions. To my knowledge, no one ever complained of OS boot issues that could relate to a specific motherboard revision. To do this, I downloaded the latest SmartXX OS update and used the decrypter program found in Eurasia's download section (SmartXX udecode, something like that). This produces a 1MB file that contains a lot of stuff and in this pile of bytes, there's a 256KB section that is essentially the OS BIOS file. From this extracted section, I took the MCPX init table (offset 0x00 to 0x80) and X-Codes section (0x80 to 0x1000) and integrated it in XBlast OS sources. Trying to boot this hybrid abomination, I was presented with the same issue on 1.0 consoles I had with the M8+ X-codes... Darn it, so much frustration.
I tried to reorder the X-Codes execution to help speed up Connexant encoder init but it wouldn't do any good. I then proceeded to gradually change the x86 ASM code from XBlast OS (offset 0x1000 and up) to get the same thing that was pesent in the decrypted SmartXX binary. Nothing would do it and I had changed all the assembly code up to the point in cromwell where it changes from x86 assembly to C language. I didn't want to reverse x86 ASM into C code but I did notice in IDA pro that the ASM section of what represent the C code section of the 2bl bootloader was much smaller in SmartXX OS than any other recent cromwell BIOSes (Cromwell 2.40, Gentoox loader, flashBIOS and XBlast OS of course). Ultimately, I found out that the moment when the 2bl was replying to the PIC cryto request happened much later than in SmartXX OS!
To deactivate the timeout counter of the PIC, you have to answer to a "cryptographic" challenge posed by it. Once you supply the PIC the correct "decoded" values, it will disable the timeout countdown and will never try to forcefully reboot the console(until reboot).
The problem reside in the SHA-1 checksum calculation to check integrity of the 2bl in RAM. It takes too much time to calculate! During the time it will calculate the output checksum, the PIC will timeout and reset the console for 1.0 revision. In regular cromwell BIOSes, this wasn't an issue because X-codes execution took less time to complete and SHA-1 calculation could be completed in time to move on to PIC crypto challenge reply. The X-Codes in SmartXX take much more time to execute but that's a side-effect of having true universal revision compatibility. In fact, cromwell uses the PIC reset feature to forcefully reset the console by deliberately not replying to the PIC crypto challenge in the event of a SHA-1 key mismatch (that would signal corrupted 2bl in memory).
So to fix this, I reduced the calculation time of the SHA-1 hash by reducing the algorithm complexity (it's only used as a checksum not encryption so we don't need a full blown SHA-1 compliant value here) and moved PIC crypto challenge reply before SHA-1 calculation (2bl will still reboot the console if a SHA-1 mismatch is detected). Problem solved! 100% boot rate on all Xbox revisions. XBlast OS now uses the "same" init code as SmartXX OS to make it universal. While I was at it, I also reduced the size of 2bl in the 256KB image file of XBlast OS to leave more space for OS features; I gained 3.75KB of space which is not as negligible as you might think. In fact, it's a lot if you consider that this space was occupied by a piece of code that(still) only copy stuff from flash to RAM, calculate checksums, unzip a file and jumps to it.
Before you ask, no it shouldn't be used in hacked BIOSes to make them universal. To make cromwell universal, I have to reduce RAM performance a lot to accomodate every motherboard revision. This would translate in unacceptable performance lost in games and homebrews. Cromwell is "simple" and does not suffer from any noticeable performance drop by doing this. For those who like Gentoox Loader, vanilla Cromwell or any other Cromwell-based BIOSes, you could recompile them using the new code in the "boot_rom" folder of XBlast OS sources and it would generate a truly universal cromwell BIOS.
So there you have it. That's why I postponed release of v0.3Beta for so long. This whole process took a very long time in itself. I also have my professionnal and personnal life(I have to work to live and live to work!), my main dev rig died on me in March and I had some pretty memorable birthday parties the last few days
