Grsecurity beaglebone black gentoo hardened

Discuss and suggest new grsecurity features

Moderators: spender, PaX Team

Grsecurity beaglebone black gentoo hardened

Postby revskills » Thu Jan 22, 2015 7:00 pm

Hi there,

Just to share some notes, and I've seen people interested in this but nothing specific to beaglebone black am335x.
Gentoo documentation is fairly complete and basically is the same procedure for hardened sources. Similarly you can do with grsec patches and the official bbb kernel (which of course is a better option). Feel free to fix/update/whatever this notes in .

Grsecurity on Beaglebone Black Rev. C

#toolchain & overlay
emerge dev-vcs/git sys-devel/crossdev sys-fs/dosfstools app-arch/lzop
mkdir -p /usr/local/portage/{metadata,profiles}
echo "local_overlay" > /usr/local/portage/profiles/repo_name #repo_name
echo "masters = gentoo" > /usr/local/portage/metadata/layout.conf
chown -R portage:portage /usr/local/portage
echo "PORTDIR_OVERLAY=\"/usr/local/portage\"" >>/etc/portage/make.conf

crossdev -S -P -v -t armv7a-hardfloat-linux-gnueabihf
crossdev -C armv7a-hardfloat-linux-gnueabihf

tar xvjf u-boot-2015.01.tar.bz2
cd u-boot-2015.01
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabihf- am335x_boneblack_config
install tools/mkimage /usr/local/bin
##scp/cp to microSD or eMMC first partition (I used the microSD to store logs)
cp {MLO,u-boot.img} p1/

#You have two options hardened-sources or use the official beaglebone linux kernel with patches/firmware/config (probably better option) and apply the grsec patch
emerge hardened-sources
cd /usr/src/linux
make distclean
## download firmware needed
wget\;a=blob_plain\;f=bin/am335x-pm-firmware.bin\;hb=HEAD -O firmware/am335x-pm-firmware.bin
wget ... _defconfig -O .config ## CONFIG_EXTRA_FIRMWARE="am335x-pm-firmware.bin"
## setup your custom grsec options or use mine grsec-bbb, LOCALVERSION=-grsec
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabihf- menuconfig
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabihf- -j`getconf _NPROCESSORS_ONLN`
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabihf- -j`getconf _NPROCESSORS_ONLN` uImage dtbs LOADADDR=0x82000000
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabihf- -j`getconf _NPROCESSORS_ONLN` modules
make ARCH=arm CROSS_COMPILE=armv7a-hardfloat-linux-gnueabihf- INSTALL_MOD_PATH=../linux_modules -j`getconf _NPROCESSORS_ONLN` modules_install

##scp/cp files to bbb
linux/arch/arm/boot/{uImage,zImage,/dts/am335x-boneblack.dtb} /boot
linux_modules/lib/{modules,firmware} /lib

Linux bblack 3.17.7-grsec #1 SMP PREEMPT Thu Jan 22 13:21:20 UTC 2015 armv7l Generic AM33XX (Flattened Device Tree) GNU/Linux

References: ... on_the_BBB ... l_emmc.xml
Posts: 2
Joined: Wed Sep 17, 2014 9:11 am

Re: Grsecurity beaglebone black gentoo hardened

Postby revskills » Fri Jan 23, 2015 7:46 pm

Note: I updated the latest 3.14.29 grsecurity patch with some minimal fixes (fbdev paths, ln, etc) for the official beaglebone kernel 3.14 branch. ... -bbb.patch
Posts: 2
Joined: Wed Sep 17, 2014 9:11 am

Return to grsecurity development