Roll your own (kernel RPM) YDL 6.1

All kernel questions! 2.4 or new 2.6 kernel, compiling, modules, panics, etc.

Roll your own (kernel RPM) YDL 6.1

Postby billb » 06 Mar 2009, 21:31

First, let me say that I'm new to kernel building so feedback and corrections are welcome!

Goal:

Build a new kernel RPM for YDL 6.1 with your preferred changes and make it easy to share with the community.

Requirements:

It is assumed that you have installed YDL 6.1 with "Software Development" checked during install.

Steps:

1. Set up your system so you can build RPMs using your regular user account instead of root:

Create the directories needed:
Code: Select all
mkdir ~/rpmbuild

Code: Select all
cd rpmbuild

Code: Select all
mkdir BUILD  RPMS  SOURCES  SPECS  SRPMS


Create an .rpmmacros file in your home directory which points to the ~/rpmbuild directory you just created:
Code: Select all
echo %_topdir $HOME/rpmbuild > ~/.rpmmacros


The contents of ~/.rpmmacros file should look something like this now:
Code: Select all
%_topdir /home/bill/rpmbuild

(with your username instead of mine, of course)

2. Move to your ~/rpmbuild/SRPMS directory and download the kernel src.rpm from one of the Fixstars mirrors:

Code: Select all
cd ~/rpmbuild/SRPMS

Code: Select all
wget http://mirror.anl.gov/yellowdog/releases/yellowdog-6.1/SRPMS/kernel-2.6.27-1.ydl61.4.src.rpm


If that download location doesn't work, look for the file on one of the mirrors listed here:

http://us.fixstars.com/support/downloads/
(releases/yellowdog-6.1/SRPMSkernel-2.6.27-1.ydl61.4.src.rpm

3. Install the kernel src.rpm and take a look around at what got installed in your SOURCES and SPECS folders.

Code: Select all
rpm -ivh kernel-2.6.27-1.ydl61.4.src.rpm


Your SOURCES folder should now contain everything used to build the YDL 6.1 kernel including the original kernel source archive, patches, Fixstars & YDL logos, kernel .config files for different architectures, and "COPYING.modules" (which appears to be some sort of debate?)

Code: Select all
ls ~/rpmbuild/SOURCES/

COPYING.modules                     linux-2.6-ps3-ehci-iso.patch
fbcon-fix-workqueue-shutdown.patch  linux-2.6-ps3-legacy-bootloader-hack.patch
fixstars_logo_40x40.ppm             linux-2.6-ps3-storage-alias.patch
kernel-2.6.27-ppc64.config          linux-2.6-squashfs.patch
kernel-2.6.27-ppc64-fourk.config    linux-modules-unsupported
kernel-2.6.27-ppc64-yhpc.config     logo_ydl_clut224.ppm
kernel-2.6.27-ppc.config            ps3-replace-flip_ctl-by-ps3_gpu_mutex.diff
kernel-2.6.27-ppc-yhpc.config       ps3-usb-add-shutdown-methods-2.patch
linux-2.6.27.1.tar.bz2              ps3vram-driver.patch
linux-2.6-build-nonintconfig.patch


Now have a look at the SPECS folder:

Code: Select all
ls ~/rpmbuild/SPECS/

kernel.spec


4. "Device Tree Compiler" (dtc) is one of build requirements listed in the kernel.spec file, so make sure you have that installed. You'll also need the rpmbuild command, so install that just in case:

Code: Select all
su -

<root password>
Code: Select all
yum install dtc rpm-build

Code: Select all
exit


5. At this point you should be able to rebuild the kernel RPM for YDL 6.1 (though there wouldn't be much point since you haven't changed anything). If you want to try rebuilding it from the kernel.spec file at this point just to confirm it works:

Code: Select all
cd ~/rpmbuild/SPECS

Code: Select all
rpmbuild -ba kernel.spec

(that's going to take a while ...)

6. Making changes ... here's where it gets fun (and I really don't know what I'm doing):

Looking back in the ~/rpmbuild/SOURCES folder, there are multiple .config files. Presumably, the one used for the Playstation 3 is "kernel-2.6.27-ppc64.config" ... so if you're using a PS3 you can edit that file and make changes. Since I know very little about this I'm not even going to bother offering any suggestions here.

Also, looking at the ~/rpmbuild/SPECS/kernel.spec file, if you're creating a modified kernel RPM you should change the release line as noted:

Code: Select all
# Polite request for people who spin their own kernel rpms:
# please modify the "release" field in a way that identifies
# that the kernel isn't the stock distribution kernel, for example by
# adding some text to the end of the version number.
#
%define sublevel 27
%define subrev 1
%define rpmrev 4
%define kversion 2.6.%{sublevel}
%define kversionfull 2.6.%{sublevel}.%{subrev}
%define rpmversion 2.6.%{sublevel}
%if %{build_yhpc}
%define release %{subrev}.yhpc.%{rpmrev}
%else
%define release %{subrev}.ydl61.%{rpmrev}
%endif


So, if you want to bump the RPM version so it appears to be a higher version than the stock distribution kernel, you'd change:

Code: Select all
%define rpmrev 4


To:

Code: Select all
%define rpmrev 5


And to modify the "release" field in a way that identifies that the kernel isn't the stock distribution kernel you could change this:

Code: Select all
%define release %{subrev}.ydl61.%{rpmrev}


To something like this:

Code: Select all
%define release %{subrev}.ydl61.%{rpmrev}.custom


And when you finally build your new kernel RPM the name would look like this:

kernel-2.6.27-1.ydl61.5.custom.1.ppc64.rpm

If you want to add or change patches you're going to need your patch file in the ~/rpmbuild/SOURCES folder where the rest are located, and also edit the kernel.spec file so that the patches are applied. HINT: you can learn how this is done by reviewing the patches already applied in the existing spec file.

When you're done with your changes, build the kernel RPM as noted in back in Step 5.

Assuming everything goes well, you'll have new kernel RPMS in your ~/rpmbuild/RPMS/ppc64 (or ppc depending on your system architecture). Using the example above, those would be:

Code: Select all
kernel-2.6.27-1.ydl61.5.custom.1.ppc64.rpm
kernel-headers-2.6.27-1.ydl61.5.custom.1.ppc64.rpm
kernel-debuginfo-2.6.27-1.ydl61.5.custom.1.ppc64.rpm
kernel-source-2.6.27-1.ydl61.5.custom.1.ppc64.rpm
kernel-doc-2.6.27-1.ydl61.5.custom.1.ppc64.rpm


And also a new kernel src.rpm in your ~/rpmbuild/SRPMS folder:

Code: Select all
kernel-2.6.27-1.ydl61.5.custom.1.src.rpm

(this would include your modified spec file, config file, patches, etc)

To install and test your new kernel:

Code: Select all
cd ~/rpmbuild/RPMS/ppc64

Code: Select all
su -

<root password>
Code: Select all
rpm -ivh kernel-2.6.27-1.ydl61.5.custom.1.ppc64.rpm


Have a look at your /etc/yaboot.conf file and you should see a new entry, but it hasn't been made the default. You can reboot and press TAB at the kboot prompt to select your new kernel. If you decide you want to make it the new default you'll need to edit your /etc/yaboot.conf file, adding a default= line specifying which label / kernel you want to boot.

OK ... gotta run ... will edit / add to this more later as needed.

Again, corrections & suggestions are welcome -- I'm completely new to this.
PS3 60GB [CECHA01], FW 3.15, YDL 6.2, Samsung T260HD @ 1920x1200
Powermac G4 1.25 GHz x2, 2 GB RAM, YDL 6.2
User avatar
billb
Site Admin
Site Admin
 
Posts: 5522
Joined: 24 May 2007, 20:30
Location: Eastern NC, USA

Re: Roll your own (kernel RPM) YDL 6.1

Postby juanito » 07 Mar 2009, 06:41

billb wrote:First, let me say that I'm new to kernel building so feedback and corrections are welcome!

While I built a kernel many times, I've never built rpm files so this post is very welcome :)

At this point you should be able to rebuild the kernel RPM for YDL 6.1 (though there wouldn't be much point since you haven't changed anything).


Not exactly - to build "out of tree" modules, you need a configured kernel so there would be a point to do this. I need to try it out to check if things are set up to link the configured kernel to /lib/modules/`uname -r`
ps3 60gb, cechc04, fw-3.15, ydl-6.2/cblfs multi-lib dual boot
dell 2009w monitor, logitech mediaboard (usb)
juanito
ydl guru
ydl guru
 
Posts: 300
Joined: 30 Jul 2008, 05:30
Location: Dubai, U.A.E.

Re: Roll your own (kernel RPM) YDL 6.1

Postby billb » 07 Mar 2009, 11:24

juanito wrote:
At this point you should be able to rebuild the kernel RPM for YDL 6.1 (though there wouldn't be much point since you haven't changed anything).


Not exactly - to build "out of tree" modules, you need a configured kernel so there would be a point to do this. I need to try it out to check if things are set up to link the configured kernel to /lib/modules/`uname -r`


Thanks -- I was hoping you'd jump in here. :) Let me know how it goes ...
PS3 60GB [CECHA01], FW 3.15, YDL 6.2, Samsung T260HD @ 1920x1200
Powermac G4 1.25 GHz x2, 2 GB RAM, YDL 6.2
User avatar
billb
Site Admin
Site Admin
 
Posts: 5522
Joined: 24 May 2007, 20:30
Location: Eastern NC, USA

Re: Roll your own (kernel RPM) YDL 6.1

Postby kengreen » 18 Mar 2009, 10:05

I downloaded the kernel*.src.rpm as suggested in bill's post and rpm -ivh it in the SRPMS folder. It created the stuff in SOURCES and SPEC as bill indicated. I removed the files created by the kernel-source rpm from the DVD. I have not
gone on to do the rpmbuild -ba because I don't want to rebuild the same kernel that I already have. I am not sure that I should edit the kernel config file since it says automatically generated DO NOT edit. I await more info and suggestions to build a kernel with the zydas1211rw module. There is not a Makefile, so I don't think that make mrproper, make ps3_defconfig, make menuconfig, make, make modules_install and make install will work.
kengreen
ydl lover
ydl lover
 
Posts: 78
Joined: 08 May 2008, 01:22
Location: arkansas

Re: Roll your own (kernel RPM) YDL 6.1

Postby kengreen » 18 Mar 2009, 15:57

I bunzip2 and tar -xvf the linux.2.6.27.1.tar.bz2 file in SOURCES. that gave me a directory linux-2.6.27.1 with the standard files including Makefile. I did a make mrproper and then tried make ps3_defconfig but it complained that there was no .config file and suggested running make oldconfig. I did that and it took the configuration from /boot/linux-2.6.27.1-ydl61.4. I assumed that that .config file was already ps3_defconfig'ed, so I did a make menuconfig and added the zydas wifi module. I did make but did not see a zydas1211rw module. I became root and did make modules_install install and got a new kernel which did allow me to go into X windows. It had the standard RTC problem but no other problems. I could not modprobe the zd1211rw module, so I need help in getting that module compiled, i.e. the right choices in menuconfig. But I have a new kernel that works.
kengreen
ydl lover
ydl lover
 
Posts: 78
Joined: 08 May 2008, 01:22
Location: arkansas

Re: Roll your own (kernel RPM) YDL 6.1

Postby billb » 18 Mar 2009, 16:33

My idea in writing this guide was to help those who are already familiar with the kernel building process figure out how to build a new kernel RPM for sharing with the community. I'm basically familiar with the process of building RPMs, but know virtually nothing about modifying / building the kernel. As you can see, when I get to Step 6 I really don't know what to do next ... :mrgreen: Thanks for the input so far.
PS3 60GB [CECHA01], FW 3.15, YDL 6.2, Samsung T260HD @ 1920x1200
Powermac G4 1.25 GHz x2, 2 GB RAM, YDL 6.2
User avatar
billb
Site Admin
Site Admin
 
Posts: 5522
Joined: 24 May 2007, 20:30
Location: Eastern NC, USA

Re: Roll your own (kernel RPM) YDL 6.1

Postby kengreen » 18 Mar 2009, 18:33

Yes I know. I repeated the build process, make mrproper, make oldconfig started to ask about every configuration choice, so I ran make ps3_defconfig, make menuconfig where I chose the zydas1211rw module, make, make modules_install install. The resulting kernel had the usb problems as well as X window problems. It did have the zydas1211rw module. It seems to me that the ps3_defconfig is toxic. I hope someone with more experience in building kernels will chime in to help.
kengreen
ydl lover
ydl lover
 
Posts: 78
Joined: 08 May 2008, 01:22
Location: arkansas

Re: Roll your own (kernel RPM) YDL 6.1

Postby billb » 18 Mar 2009, 19:57

kengreen wrote:Yes I know. I repeated the build process, make mrproper, make oldconfig started to ask about every configuration choice, so I ran make ps3_defconfig, make menuconfig where I chose the zydas1211rw module, make, make modules_install install. The resulting kernel had the usb problems as well as X window problems. It did have the zydas1211rw module. It seems to me that the ps3_defconfig is toxic. I hope someone with more experience in building kernels will chime in to help.


Sounds as if the patches which are applied on YDL's version of the kernel when you build the RPM from the .spec file wouldn't have been applied ... ? Does the "make menuconfig" command just give you a new kernel.cfg file, or does it do something else?

If it's just creating a modified kernel.cfg file, maybe you can replace the kernel-2.6.27-ppc64.config file (keeping the name the same) that gets placed in your rpmbuild/SOURCES directory with your version, then rebuild the kernel RPM from the spec file as I've described.

If I just rebuild the kernel RPM from the spec with no modifications it appears to behave exactly the same as YDL 6.1's default kernel, including ps3vram swap, etc. as expected.
PS3 60GB [CECHA01], FW 3.15, YDL 6.2, Samsung T260HD @ 1920x1200
Powermac G4 1.25 GHz x2, 2 GB RAM, YDL 6.2
User avatar
billb
Site Admin
Site Admin
 
Posts: 5522
Joined: 24 May 2007, 20:30
Location: Eastern NC, USA

Re: Roll your own (kernel RPM) YDL 6.1

Postby kengreen » 19 Mar 2009, 15:33

I was thinking along the similar lines. When I first installed the src.rpm, make ps3_defconfig couldn't find a .config file and suggested running make oldconfig. When I ran that, it took a config file from /boot/etc/ and after that I ran make menuconfig.
I thought I had selected the zydas module in network/wireless. When I ran make, make modules_install and install, the kernel worked but didn't have the zydas module. I am thinking of reinstalling the src.rpm that I downloaded and making sure that I get the zydas module in menuconfig. Right now, the PS3 is going to be occupied with RockBand, so this will have to wait.
kengreen
ydl lover
ydl lover
 
Posts: 78
Joined: 08 May 2008, 01:22
Location: arkansas

Re: Roll your own (kernel RPM) YDL 6.1

Postby kengreen » 22 Mar 2009, 20:49

The grandkids went home, so the PS3 can be used for other things. I untared the kernel in the SOURCES directory and ran make mrproper to erase old files including the .config file. I ran make oldconfig and it took the config file from /boot/etc/. I ran make menuconfig and chose zydas1211rw module along with generic IEEE80211 module. I ran make with no problems and make modules_install install. The kernel loaded fine, I could load the zd1211rw module and I could go into graphics mode.
kengreen
ydl lover
ydl lover
 
Posts: 78
Joined: 08 May 2008, 01:22
Location: arkansas

Re: Roll your own (kernel RPM) YDL 6.1

Postby billb » 03 Apr 2009, 21:32

I played with this a bit today and got a new kernel RPM built with Xbox gamepad support included (as module). :mrgreen: Other than that it's the same as the stock kernel for YDL 6.1 / PS3.

[bill@localhost ~]$ dmesg | grep xpad
usbcore: registered new interface driver xpad
xpad: X-Box pad driver


So now I can use this old Xbox controller I have on YDL 6.1 (with the stock kernel it doesn't show up as a joystick device) ...
http://www.amazon.com/Xbox-Freaks-Drago ... B000CGK8EU

I'll have to retrace my steps a bit and update the guide (Step 6).

After that I'll start looking at other options to add/remove from the stock kernel ... maybe get a little more free memory available?
PS3 60GB [CECHA01], FW 3.15, YDL 6.2, Samsung T260HD @ 1920x1200
Powermac G4 1.25 GHz x2, 2 GB RAM, YDL 6.2
User avatar
billb
Site Admin
Site Admin
 
Posts: 5522
Joined: 24 May 2007, 20:30
Location: Eastern NC, USA

Re: Roll your own (kernel RPM) YDL 6.1

Postby basic » 23 Apr 2009, 04:37

Thank you for writing this guide! This is great news for me, as I've been wanting XFS/JFS filesystem support for my G5, and this enables me to do that and keep the ydl kernel patches.

One issue I came across was that my system is currently running a 2.6.28-0.ydl61.1 kernel, which was included on the latest DVD installer (along with the rpm, but no source rpm). I can't seem to find a SRPM for this kernel build on any of the ftp mirrors, if anyone knows where that may be hiding I could use it (i'm assuming the patches have changed between .27 and .28).

Thanks!
basic
ydl newbie
ydl newbie
 
Posts: 1
Joined: 23 Apr 2009, 04:30

Re: Roll your own (kernel RPM) YDL 6.1

Postby billb » 23 Apr 2009, 16:35

I don't see that one anywhere either -- maybe just an oversight.
PS3 60GB [CECHA01], FW 3.15, YDL 6.2, Samsung T260HD @ 1920x1200
Powermac G4 1.25 GHz x2, 2 GB RAM, YDL 6.2
User avatar
billb
Site Admin
Site Admin
 
Posts: 5522
Joined: 24 May 2007, 20:30
Location: Eastern NC, USA


Return to Kernel

Who is online

Users browsing this forum: No registered users and 5 guests