From Fedora Project Wiki
m (typos)
m (typo)
Line 22: Line 22:
of course, you may need to apply a few patches before you actually perform the make steps.
of course, you may need to apply a few patches before you actually perform the make steps.


n.b the example above assuems you have a config file supplied with the kernel to configure the kernel settings. If you don't have a pre-defined config then you can execute command 'make config' to interactively select from a vast array of config options or you can run 'make arm_defconfig' to generate an arm default config.
n.b the example above assumes you have a config file supplied with the kernel to configure the kernel settings. If you don't have a pre-defined config then you can execute command 'make config' to interactively select from a vast array of config options or you can run 'make arm_defconfig' to generate an arm default config.


Also, it is probably quicker to cross-compile from, say, x86 if you have the relevant tool chain available. Of course, after building you will need to make the src tree available on the trimslice to install.
Also, it is probably quicker to cross-compile from, say, x86 if you have the relevant tool chain available. Of course, after building you will need to make the src tree available on the trimslice to install.

Revision as of 01:58, 30 June 2013

Upgrading A Fedora Kernel on Arm Systems

Normally you just use yum to install the latest Fedora release kernel. However, occasionally you may need to build and install a custom kernel to test out new functionality.

Goal

To update your ARM system with a newly built kernel so that it is available for use from uboot.

This HowTo is based upon experience updating trimslice hardware. However, the general principles should apply for other arm systems.

Building the kernel from source

Obtain a src tarball for the build then follow the instructions in the README.

  # cd linux-xxxxx     # or wherever you uinpacked the kernel to
  # make mrproper
  # cp/path/to/provided/config ./config
  # make oldconfig
  # make -j 6

of course, you may need to apply a few patches before you actually perform the make steps.

n.b the example above assumes you have a config file supplied with the kernel to configure the kernel settings. If you don't have a pre-defined config then you can execute command 'make config' to interactively select from a vast array of config options or you can run 'make arm_defconfig' to generate an arm default config.

Also, it is probably quicker to cross-compile from, say, x86 if you have the relevant tool chain available. Of course, after building you will need to make the src tree available on the trimslice to install.

Installing the kernel

As root in the src tree top-level dir:

 # make modules_install install

This should put the vmlinux and initramfs images into /boot or /boot/uboot or wherever your boot scripts and images are located. The destination may vary depending on how your system is configured. The target dir for the install should be the one defined by the setting for UBOOT_DIR in /etc/sysconfig/uboot)

Generating the uImage and uInitrd Images Needed By UBoot

Next you need to generate the uInitrd (uboot initial ram disk) and uImage (uboot image) files in your boot directory. You can substitute more suitable siffixes than armv7hl-tegra if you ar eon a different architecture.

  # cd /boot                     # or whatever UBOOT_DIR is
  # export VERSION=3.4.0-rc4     # or whatever the kernel version is
  # mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e
0x00008000 -n $VERSION -d ./vmlinuz-$VERSION uImage-$VERSION-armv7hl-tegra
  # mkimage -A arm -O linux -T ramdisk -C none -n $VERSION -d
./initramfs-$VERSION.img uInitrd-$VERSION-armv7hl-tegra

Going Live

You might want to save a cop of your rootfs at this point, just in case.

You can now copy the files uImage-$VERSION-armv7hl-tegra and uInitrd-$VERSION-armv7hl-tegra over the current ones referenced from boot.scr so they are used for booting (in my case it loads files uImage and uInitrd). Or alternatively rebuild boot.scr to point at the new files.

The 3.4.0 kernel shown here is a lot bigger than the one I was using previously. If that is true for you this might mean that you need to change the load addresses used in your boot.cmd to load the uInitrd file at a higher initial address. Rebuild boot.scr using this command:

  # mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Trim Slice
F17 boot script" -d boot.cmd boot.scr

Currently my boot.cmd contains the following

  setenv bootargs mem=384M@0M mem=512M@512M nvmem=128M@384M vmalloc=248M
video=tegrafb console=ttyS0,115200n8 rw root=/dev/sdb1 nohdparm rootwait
earlyprintk rd_NO_PLYMOUTH
  ext2load usb 0:1 4080000 /boot/uImage
  ext2load usb 0:1 4480000 /boot/uInitrd
  bootm 4080000 4480000

WIll Cohen and Jon Masters recommended replacing 4480000 with 8400000. All you need to do is make sure that the uImage file extent does not overlap the uInitrd file extent

  setenv bootargs mem=384M@0M mem=512M@512M nvmem=128M@384M vmalloc=248M
video=tegrafb console=ttyS0,115200n8 rw root=/dev/sdb1 nohdparm rootwait
earlyprintk rd_NO_PLYMOUTH
  ext2load usb 0:1 4080000 /boot/uImage
  ext2load usb 0:1 8400000 /boot/uInitrd
  bootm 4080000 8400000

n.b. don't forget to set the correct device in boot.cmd -- usb 0:1 iedntifies my usb stick but you may need to specify a memory card or local disk and so the device may be different. Check UBOOT_DEVICE in /etc/sysconfig/uboot which ought to match the value in boot.cmd/boot.scr

Ok, now reboot and enjoy, fingers crossed!