Use Perf on Odroid XU3/XU4

Because the Odroid is using a minor kernel version which does not support apt-get to install Perf directly, so users need to rebuild the kernel and make perf from source by themselves.

The official guide has some errors, therefore I make a clearer line of this process.

Install kernerl

install relevant packages

sudo apt-get install flex bison libdw-dev libnewt-dev binutils-dev libaudit-dev libgtk2.0-dev libperl-dev libpython-dev libunwind-*
sudo apt-get install build-essential libqt4-dev libncurses5-dev git 

download source code. The github is https://github.com/hardkernel/linux. This code includes kernel and perf. The version I downloaded is 3.10.105, replace 3.10.105 below with your download kernel version.

cd /usr/src
sudo su root 
git clone https://github.com/hardkernel/linux.git -b odroidxu3-3.10.y odroidxu3-3.10.y 
mv linux-odroidxu3-* linux

make .config

make odroidxu3_defconfig 
//or 
sudo cp /boot/config ./.config

change files to Enable PMU setting

gedit arch/arm/boot/dts/exynos5422_evt0.dtsi
/*--------------around line 91, change-------------------*/
    };
};

    watchdog@10020000 {
        compatible = "samsung,s3c2410-wdt";
        reg = <0x101D0000 0x100>;
/*----------------------into----------------------------*/
    };
};
    arm-pmu {
        /* compatible = "arm,cortex-a15-pmu";
        interrupt-parent = <&combiner>;
        interrupts = <1 2>, <7 0>, <16 6>, <19 2>;
        */
        compatible = "arm,cortex-a7-pmu";
        interrupt-parent = <&gic>;
        interrupts = <0 192 4>, <0 193 4>, <0 194 4>, <0 195 4>;
    };

    watchdog@10020000 {
        compatible = "samsung,s3c2410-wdt";
        reg = <0x101D0000 0x100>;

make files & install

make -j8
sudo cp arch/arm/boot/zImage arch/arm/boot/dts/exynos5422-odroidxu3.dtb /media/boot && sync
mkdir tmp
sudo make modules_install ARCH=arm INSTALL_MOD_PATH=./tmp && sync

rewrite config file.

sudo cp .config /boot/config-3.10.105

create initramfs

cp -r ./tmp/lib/modules/3.10.105 /lib/modules
sudo update-initramfs -c -k 3.10.105

create & install uInitrd

sudo mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n uInitrd -d /boot/initrd.img-3.10.105 /boot/uInitrd-3.10.105
sudo cp /boot/uInitrd-3.10.105 /media/boot/uInitrd

reboot

sudo sync && reboot

now your kernel should be installed

Install perf

cd /usr/src/linux/tools/perf
sudo make WERROR=0 NO_LIBNUMA=1 
sudo cp ./perf /usr/bin/

test perf

perf list

你可能感兴趣的:(odroid)