xcp-ng / xcp

Entry point for issues and wiki. Also contains some scripts and sources.
https://xcp-ng.org
1.26k stars 74 forks source link

Replace Tianocore logo by XCP-ng one #343

Open olivierlambert opened 4 years ago

olivierlambert commented 4 years ago

If it's OK regarding licenses etc.

stormi commented 4 years ago

Citrix has it in its "known issues" so it may change in future releases. We need to check about whether licensing allows it indeed.

CAPS3 commented 1 month ago

Hi xcp-ng team :) Sorry for the necro-bump, but I was wondering if this is still in the works for a later release (I.E 8.3 or 8.3.1). Understandable if it's a licence restriction and cannot be recompiled/desitributed, but would you be able to provide a guide for individual homelab users?

I can see that this has been accomplished by another user here: https://xcp-ng.org/forum/topic/1850/replaced-tianocore-uefi-logo-with-xcp-ng-logo?_=1723096579846 (I've reached out to the user, but they haven't been online since 2019...)

I was able to get the edk2 src rpm (for xcpng 8.2 / 8.2.1) from here: https://koji.xcp-ng.org/buildinfo?buildID=2495 And I was trying to use the following guides/resources: https://github.com/xcp-ng/xcp-ng-build-env https://docs.xcp-ng.org/project/development-process/local-rpm-build/

But when running the build.sh script (./build.sh 8.2), I eventually run into a yum repo mirror issue. I tried with both 8.2 and 8.3 options, and they both failed with the same yum repo mirror error. (I tried this on 2 different networks to rule out firewall/IPS/IDS getting in the way but both failed).

I have been able to extract the edk2 src rpm, and then extract the tar.gz and replaced the Logo.bmp under MdeModulePkg/Logo with the (new & aesthetically pleasing) xcp-ng logo as .bmp, but now I'm stuck because I can't actually recompile it using the xcp-ng-build-env-master docker method.

Any suggestions would be appreciated. I'm also happy to supply the modified edk2-.tar.gz etc if someone else is able to get the build env working and compile for us perhaps?

Thanks again for all your hard work!

stormi commented 1 month ago

The failure to build the build env could be related to the demise of CentOS 7 repositories. We likely need to update the repo files so that they point at vault.centos.org.

We haven't been affected yet internally because the ones who usually use this build env already have it setup.

Could you open an issue against https://github.com/xcp-ng/xcp-ng-build-env ?

CAPS3 commented 1 month ago

The failure to build the build env could be related to the demise of CentOS 7 repositories. We likely need to update the repo files so that they point at vault.centos.org.

We haven't been affected yet internally because the ones who usually use this build env already have it setup.

Could you open an issue against https://github.com/xcp-ng/xcp-ng-build-env ?

Hi Stormi,

I tried again from another machine, and this time it worked without issue! Sorry for the hassle. (as an aside, it doesnt look like I could create issues on that page - they seem to be disabled?)

I was able to work my way through and generate a new UEFI splash screen. I wrote this half-baked guide; Obvious Disclaimer - I am not a professional; some parts of this guide maybe incorrect and may negatively affect your xcp-ng host. Do not test in Prod - this is for homlabs only - edk2-20180522git4b8552d-1.4.6.xcpng8.2.x86_64.zip I hope it helps someone :)


The goal of this post is to assist XCP-ng Homelab users change the default Tianocore Logo to something more aesthetically pleasing. This guide leverages docker, so you will need to ensure you have that running on your system.

On your machine, lets create a new working directory called 'tianocore' - the name doesnt really matter.

mkdir tianocore
cd tianocore

Now we're in our working directory, lets clone the xcp-ng-build-env repo from here: https://github.com/xcp-ng/xcp-ng-build-env (note that I'm using the https method with wget), after which we can un-extract the contents, and remove the file we just downloaded:

wget https://github.com/xcp-ng/xcp-ng-build-env/archive/refs/heads/master.zip

unzip master.zip 

rm master.zip

This should create a folder called "xcp-ng-build-env-master" - lets move into that directory:

cd xcp-ng-build-env-master

Run the build.sh script and make sure to specify your version. This will create a docker container that contains all the tools we need to create an updated RPM with the new logo

./build.sh 8.2

NOTE: if you get any errors trying to run the script, please check your docker config. Once the above script has run, and the script steps have executed, you should be back at the command line.

We are now ready to start the container. Run the following, making sure to modify the -b flag for your build version

./run.py -b=8.2 --rm --volume=./data:/data

This will create and pass through a folder call 'data' to the container, which can be accessed in the container. If this works correctly, you should now have a terminal inside the container, and it should look similar to this:

[builder@0c8bf329eeee ~]$>

If you open another terminal, and check the xcp-ng-build-env-master folder, you should see a new 'data' folder - try placing a file in it. Now, go back to your other terminal inside the container; if you then do an "ls /data", you should be able to see the file you copied across!

Great! We're getting there...

Now, lets get the edk2 RPM src from here: https://koji.xcp-ng.org/buildinfo?buildID=2495 - make sure you get the correct version (I.E in this guide, we're getting the version for xcp-ng 8.2). This source rpm contains the Tianocore UEFI logo which we want to change:

wget https://koji.xcp-ng.org/kojifiles/packages/edk2/20180522git4b8552d/1.4.6.xcpng8.2/src/edk2-20180522git4b8552d-1.4.6.xcpng8.2.src.rpm

We now have our Source RPM. We need to extract it, make the changes, zip it back up and then recompile, so lets get to it! Use "rpm2cpio" to unextract the rpm

rpm2cpio edk2-20180522git4b8552d-1.4.6.xcpng8.2.src.rpm | cpio -idmv

You will see this create a bunch of .patch files, and a .tar.gz file with the same name as our src.rpm. We now need to unextract the .tar.gz file to a folder:

tar -xvf edk2-20180522git4b8552d.tar.gz

Now if we do an "ls" we can see we have extracted the .tar.gz file into a folder (again, with the same name, but missing the .tar.gz suffix).

The EUFI logo is hiding in the new folder under "MdeModulePkg/Logo" and is called "Logo.bmp".

At this stage, you need to find and download the new UEFI logo you want, and ensure it's converted into a .bmp bitmap file. Transparency doesn't seem to be supported, but you can use up to 24bit bmp file for full colour! Name the file "Logo.bmp"

In your other terminal, copy the new .bmp file to the tianocore/xcp-ng-build-env/data folder. Then, from the container, it should be accessible via /data/Logo.bmp

From within the container, copy the Logo.bmp from our /data/ folder over to the edk2-20180522git4b8552d/MdeModulePkg/Logo/ folder:

cp /data/Logo.bmp edk2-20180522git4b8552d/MdeModulePkg/Logo/Logo.bmp

Now that we have uploaded our new image, we need to tar up the folder:

tar -czf edk2-20180522git4b8552d.tar.gz edk2-20180522git4b8552d

(NOTE: this should overwrite the 'old' .tar.gz folder in the same directory with the same name)

Now, in our current directory, we need to create 2 folders, one called "SOURCES" and one called "SPECS"

mkdir SOURCES

mkdir SPECS

We now need to move all of our .patch files, as well as the modified .tar.gz files into the SOURCES folder

mv *.patch SOURCES/

mv *.tar.gz SOURCES/

And finally, we move our edk2.spec file into the SPEC folder

mv *.spec SPECS/

NOTE: If you wanted to at this stage, you can clean up the directory by removing the edk2 folder and the original source RPM with the following:

  rm -r edk2-20180522git4b8552d/
  rm edk2-20180522git4b8552d-1.4.6.xcpng8.2.src.rpm

We're almost ready to compile, but first, we need to make sure we have all the build dependencies installed:

sudo yum-builddep SPECS/*.spec -y

We should now be ready to re-compile. This should result in some new folders being created, but we really want the new .rpm package that should be created in a folder called "RPMS" after we run the following command:

rpmbuild -ba SPECS/*.spec --define "_topdir $(pwd)"

Once the above command has finished compiling (and resulted in an exit 0 code), if we run "ls", we can see that we have our newly created RPMS folder, and if we run 'ls RPMS", we should be able to see a subdirectory called "x86_64", and if we look inside that with "ls RPMS/x86_64/", we can see that we have our new RPM - edk2-20180522git4b8552d-1.4.6.xcpng8.2.x86_64.rpm - WOOHOO!

Lets copy that new RPM to our data folder so we can access it from our main machine:

cp RPMS/x86_64/edk2-20180522git4b8552d-1.4.6.xcpng8.2.x86_64.rpm /data/ 

Now if you go to the terminal on you main machine, and check the tianocore/xcp-ng-build-env-master/data folder, we can see the .rpm!

Now we have the file on our main machine, we need to copy it over to the XCP-NG host with scp:

scp tianocore/xcp-ng-build-env-master/data/edk2-20180522git4b8552d-1.4.6.xcpng8.2.x86_64.rpm root@<xcp-ng-host-ip>:/tmp

Once the file has copied to the host, ssh to it:

ssh root@<xcp-ng-host-ip>

Once on the host, cd to the /tmp directory and you should be able to see your .rpm file that was copied over with scp as above.

Now, to actually apply the new package, we need to tell rpm to update the package and replacefiles, so our new logo takes effect:

rpm -U --replacefiles --replacepkgs edk2-20180522git4b8552d-1.4.6.xcpng8.2.x86_64.rpm

Once that has run (should be really really quick), head to your XOA, select the host and restart the toolstack (or just run "xe-toolstack-restart" from your ssh sesison)

Once the toolstack has restarted, try launching a new UEFI VM and you should be greeted with the new Logo! :partying_face:


I've attached a copy of the file that I generated if someone else would like to test. (I need to shrink/scale the image down by 50%) but I think it looks rather good - definately better than the tianocore one

stormi commented 1 month ago

You can likely simplify your guide by using https://docs.xcp-ng.org/project/development-process/local-rpm-build/

CAPS3 commented 1 month ago

I did see that, but ran into some issue with rpm2cpio on my main machine, so felt it was easier to leverage the rpm2cpio tools inside the container which worked a treat.

I do have some questions though: 1) Will this survive a Host reboot? 2) Will this need to be run again after a host update (or only if the edk2 rpm is updated?) 3) Did I apply the RPM correctly using the "rpm -U --replacefiles --replacepkgs" command?

Also, I dont suppose you know where I might be able to find some of the new xcp-ng logo assets? I spent some time in gimp trying to modify the mainlogo.bmp from the xcp-ng website, and it took some fluffing around with GIMP, layers, transparency, and getting the right bitmap format, but it would be a lot easier if there was one without the transparency (or without the white ring around the planet/rocket, or replaced with a black ring so it blends in with most black boot screens).

This is what it looks like atm:

Screenshot from 2024-08-09 19-01-44

I've also posted this guide across to the XCP-ng forums. Not sure if you want to place any additional disclaimers on the post here: https://xcp-ng.org/forum/topic/9493/guide-to-replace-tianocore-uefi-logo

stormi commented 1 month ago

You don't need rpm2cpio if you fetch the RPM sources directly from where the doc points at.

stormi commented 1 month ago

Will this survive a Host reboot?

Yes

Will this need to be run again after a host update (or only if the edk2 rpm is updated?)

Only if the edk2 RPM is updated.

Did I apply the RPM correctly using the "rpm -U --replacefiles --replacepkgs" command?

yum update ./name-of-rpm is better because yum doesn't like that you alter the rpm database outside of its control. Also you don't need --replacefiles nor --replacepkgs as far as I can tell.