注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

U-booting Funtoo on the TI AM335x X2 SBC-B2

From Funtoo
Jump to navigation Jump to search

Introduction

Installing Funtoo to a Raspberry Pi is fun, but there are a lot more boards out there. For example, the AM335x series. To get this going, we need to use the U-Boot bootloader.

See http://funtoo.org/Crossdev_Automation for the xcompile_variables.sh script referenced here, and a more complete introduction to the process.

U-Boot Building

root # wget $UBOOT_URL -O $UBOOTS/$UBOOT
root # cd $UBOOTS
root # mkdir u-boot && tar xf $UBOOT -C u-boot --strip-components 1
root # cd $XC_UBOOT
root # ARCH=$ARCH CROSS_COMPILE=$CROSSDEV_TARGET- make mrproper
root # ARCH=$ARCH CROSS_COMPILE=$CROSSDEV_TARGET- make distclean
root # ARCH=$ARCH CROSS_COMPILE=$CROSSDEV_TARGET- make O=$XC_LINUX_PREFIX am335x_evm_defconfig
root # ARCH=$ARCH CROSS_COMPILE=$CROSSDEV_TARGET- make O=$XC_LINUX_PREFIX

Kernel Building

Defconfig Generation

root # cd $XC_KERNEL_SRC
root # ARCH=$ARCH CROSS_COMPILE=$CROSSDEV_TARGET ti_config_fragments/defconfig_builder.sh -t ti_sdk_am3x_release
root # ARCH=$ARCH CROSS_COMPILE=$CROSSDEV_TARGET make ti_sdk_am3x_release_defconfig
root # ARCH=$ARCH CROSS_COMPILE=$CROSSDEV_TARGET- make zImage
root # ARCH=$ARCH CROSS_COMPILE=$CROSSDEV_TARGET- make uImage dtbs LOADADDR=0x82000000

Setup Stage3

We set up the boot partion differently. The rest of the steps are the same.

root # sed -i "s/\/dev\/sda1.*/\/dev\/mmcblk0p1 \/boot/uboot vfat defaults 0 2/" $XC_STAGE3S/etc/fstab

Copy Over Kernel Files

root # cd $XC_KERNEL_SRC
root # ARCH=$ARCH CROSS_COMPILE=$CROSSDEV_TARGET- INSTALL_MOD_PATH=$XC_STAGE3S INSTALL_MOD_STRIP=1 make modules_install
root # cp arch/arm/boot/{z,u}Image $XC_STAGE3S/boot
root # cp arch/arm/boot/dts/am335x-evm{,sk}.dtb  $XC_STAGE3S/boot
root # cp arch/arm/boot/dts/am335x-bone{,black}.dtb  $XC_STAGE3S/boot

Copy Over U-Boot Files

root # cp $XC_UBOOT/$XC_LINUX_PREFIX/{MLO,u-boot.img,u-boot.bin} $XC_STAGE3S/boot/uboot
root # echo "bootargs=console=ttyS0,115200n8 root=/dev/mmcblk0p2 mem=128M rootwait
bootcmd=mmc rescan; fatload mmc 0 0x82000000 uImage; bootm 0x82000000
uenvcmd=boot" > $XC_STAGE3S/boot/uboot/uEnv.txt

Install to the Board

root # mkdir -p /mnt/funtoo
root # mount /dev/<your_dev>2 /mnt/funtoo
root # mkdir -p /mnt/funtoo/boot/uboot
root # mount /dev/<your_dev>1 /mnt/funtoo/boot/uboot
root # rsync -avz --exclude "usr/portage/*" $XC_STAGE3S/{boot,bin,etc,home,lib,mnt,opt,root,run,sbin,srv,tmp,usr,var,dev} /mnt/funtoo
root # mkdir /mnt/funtoo/{proc,sys}
root # umount -R /mnt/funtoo