Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
iconfalse

$ make ARCH=arm CROSS_COMPILE=${CC} distclean

$ make ARCH=arm CROSS_COMPILE=${CC} smarct335x_evm_uart3_defconfig

$ make ARCH=arm CROSS_COMPILE=${CC}

 

Note
iconfalse

The uartx in u-boot config (defconfig) file is to specify the debug console outputs.

Linux Kernel

...

Download:

For 3.2 (AMSDK6, Stable, LTS release):

...

Info
iconfalse
title~/uEnv.txt

optargs="consoleblank=0 mem=512M"
#u-boot eMMC specific overrides; Angstrom Distribution (SMARC T335X) 2014-05-20
kernel_file=zImage
initrd_file=initrd.img

loadaddr=0x82000000
initrd_addr=0x88080000
fdtaddr=0x88000000
fdtfile=am335x-smarct335x.dtb 

initrd_high=0xffffffff
fdt_high=0xffffffff

loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${kernel_file}
loadinitrd=load mmc ${mmcdev}:${mmcpart} ${initrd_addr} ${initrd_file}; setenv initrd_size ${filesize}
loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdtaddr} /dtbs/${fdtfile}
#

##Un-comment to enable systemd in Debian Wheezy
#optargs=quiet init=/lib/systemd/systemd

console=ttyO3,115200n8
mmcroot=/dev/mmcblk0p2 mmcblk1p2 ro
mmcrootfstype=ext4 rootwait fixrtc

mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}

#zImage:
uenvcmd=run loadimage; run loadfdt; run mmcargs; bootz ${loadaddr} - ${fdtaddr}

#zImage + uInitrd: where uInitrd has to be generated on the running system.
#boot_fdt=run loadimage; run loadinitrd; run loadfdt
#uenvcmd=run boot_fdt; run mmcargs; bootz ${loadaddr} ${initrd_addr}:${initrd_size} ${fdtaddr}

###Begin Rootfs from NFS
#serverip=192.168.1.51
#rootpath=/srv/nfs/smarct335x/ubuntu1204/
#nfsopts=nolock,acdirmin=60
#netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
##netboot=echo Loading kernel from SDCARD and booting from NFS ...; run loadimage; run netargs; bootz ${loadaddr} - ${fdtaddr}
##uenvcmd=run netboot
###End Rootfs from NFS

###Begin Load kernel from TFTP
#netmask=255.255.255.0
#ipaddr=192.168.1.65
#serverip=192.168.1.51
#netboot=echo Loading kernel and device tree from TFTP and booting from NFS ...; setenv autoload no; tftp ${loadaddr} ${kernel_file}; tftp ${fdtaddr} ${fdtfile}; run netargs; bootz ${loadaddr} - ${fdtaddr}
#uenvcmd=run netboot
###End Load kernel from TFTP

Note

For kernel 3.14.y and after, the serial port device descriptor changes from ttyO to ttyS

The above uEnv.txt file needs to change accordingly. (ttyO3 --> ttyS3)

SD card will always be emulated as /dev/mmcblk1 at kernel 3.12 and newer version 

 

Copy uEnv.txt to the boot partition:

...

Info
iconfalse
titledirectory where your root file system is

$ sudo tar xvfz smarct335x-rootfs-image-smarct335x-sdk6.tar.gz -C /media/rootfs

 

Ubuntu 1214.04:

Info
iconfalse
titledirectory where your root file system is

$ sudo tar xvfz
ubuntu
 smarc-
12
ubuntu14.04
-minimal-armhf-2012-11-29
.tar.gz -C /media/rootfs

Copy Kernel Modules:

Info
iconfalse
title~/linux-smarc-t335x-v3.2 (v3.2) or ~/smarc-ti-linux-kernel (v3.12 or after)

$ sudo make ARCH=arm INSTALL_MOD_PATH=/media/rootfs modules_install

...

Info
iconfalse
$ sync
$ sudo umount /media/boot
$ sudo umount /media/rootfs
Note
iconfalse

If your rootfs is ubuntu, before un-mounting it, check

/media/rootfs/etc/fstab to see if the mounting point is /dev/mmcblk1p2 and

/media/rootfs/etc/init/serial.conf to see if your console port device descriptor correct or not.

Setup eMMC

...

Setting up eMMC usually is the last step at development stage after the development work is done at your SD card or NFS environments. From software point of view, eMMC is nothing but a non-removable SD card on board. When booting from eMMC and SD card is present, SD card is emulated as /dev/mmcblk0 and eMMC is emulated as /dev/mmcblk1. On the other hand, when booting from eMMC and SD card is absent, eMMC will be on module will be always emulated as /dev/mmcblk0 now. eMMC could be /dev/mmcblk0 or /dev/mmcblk1 depending on if SD card is inserted and the boot device become dynamic when booting from eMMC.

Initramfs is the successor of initrd and has many advantages over initrd. Linux kernel here will mount it as a temperately rootfs and starts the init process from here. The init script will check if the partition 2 of eMMC is exist and them mount the real rootfs.

 Setting up eMMC now is nothing but changing the device descriptor. 

This section gives a step-by-step procedure to setup eMMC flash. Users can write a shell script your own at production to simplify the steps.

Get initramfs (assuming the home directory is /home/developer here)

Info
iconfalse

$ cd ~/

$ wget http://developer.embedian.com/download/attachments/2883656/initramfs.tar.gz

$ mkdir initramfs

$ sudo tar xvfz initramfs.tar.gz -C initramfs/

Note: Regarding to how to generate initramfs, users can refer to Yocto build.

Prepare for initramfs zImage

Info
iconfalse

$ cd <kernel source directory>

$ export CC=/opt/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin/arm-linux-gnueabihf-

$ make ARCH=arm CROSS_COMPILE=${CC} smarc_t335x_defconfig

$ make ARCH=arm CROSS_COMPILE=${CC} menuconfig

Select

General setup --> 

     [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support

     ()    Initramfs source file(s)

Enter the directory where your initramfs is. In this example

/home/developer/initramfs

Save the kernel config.

Build for kernel 3.2:

Info
iconfalse

$ make ARCH=arm CROSS_COMPILE=${CC} uImage modules

Build for kernel 3.12.y or later:

Info
iconfalse

$ make ARCH=arm CROSS_COMPILE=${CC} zImage modules am335x-smarct335x.dtb

...

First, we need to backup the final firmware from your SD card or NFS.

Prepare for eMMC binaries from SD card (or NFS): 

Insert SD card into your Linux PC. For these instructions, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.

For these instruction, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.

Info
iconfalse

$ export DISK=/dev/mmcblk0

Mount Partitions:

On some systems, these partitions may be auto-mounted...

Info
iconfalse
$ sudo mkdir -p /media/boot/dtbs
$ sudo mkdir -p /media/rootfs/
 
for: DISK=/dev/mmcblk0
$ sudo mount ${DISK}p1 /media/boot/
$ sudo mount ${DISK}p2 /media/rootfs/
 
for: DISK=/dev/sdX
$ sudo mount ${DISK}1 /media/boot/
$ sudo mount ${DISK}2 /media/rootfs/

Copy MLO zImage to rootfs partition:

Info
iconfalse

$ sudo cp -v /media/boot/MLO zImage /media/rootfs/home/root

 

Copy u-boot.img to rootfs partition:

$ sudo cp -v /media/boot/u-boot.img /
Info
iconfalse
Note
titleNote
  1. If your rootfs is Ubuntu 14.04, copy to /media/rootfs/home/ubuntu instead of /media/rootfs/home/root

 


Copy initramfs zImage to rootfs partition:

...

Info
iconfalse

optargs="consoleblank=0 mem=512M"
bootfile=zImage
loadaddr=0x80200000
#fdtaddr=0x80F80000
#fdtfile=am335x-smarct335x.dtb
console=ttyO3,115200n8
#mmcrootmmcroot=/dev/mmcblk0p2 rw
#mmcrootfstypemmcrootfstype=ext4 rootwait fixrtcmmcroot=/dev/ram0

#To boot old v3.2.x based kernel enable: (SMARC T335X and BeagleBone)
uenvcmd=run loadimage; run mmc_classic_boot

#For u-boot 13.10
#uenvcmd=run loadzimage; run mmc_classic_boot

###Begin Rootfs from NFS
#serverip=192.168.1.51
#rootpath=/srv/nfs/smarct335x/arago6/
#nfsopts=nolock
#netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
##netboot=echo Loading kernel from SDCARD and booting from NFS ...; run loaduimage; run netargs; bootz ${loadaddr}
##uenvcmd=run netboot
###End Rootfs from NFS

###Begin Load kernel from TFTP
#netmask=255.255.255.0
#ipaddr=192.168.1.65
#serverip=192.168.1.51
#netboot=echo Loading kernel from TFTP and booting from NFS ...; setenv autoload no; tftp ${loadaddr} ${bootfile}; run netargs; bootz ${loadaddr}
#uenvcmd=run netboot
###End Load kernel from TFTP

...

Info
iconfalse

optargs="consoleblank=0 mem=512M"
#u-boot eMMC specific overrides; Angstrom Distribution (SMARC T335X) 2014-05-20
kernel_file=zImage
initrd_file=initrd.img

loadaddr=0x82000000
initrd_addr=0x88080000
fdtaddr=0x88000000
fdtfile=am335x-smarct335x.dtbdtb 

initrd_high=0xffffffff
fdt_high=0xffffffff

loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${kernel_file}
loadinitrd=load mmc ${mmcdev}:${mmcpart} ${initrd_addr} ${initrd_file}; setenv initrd_size ${filesize}
loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdtaddr} /dtbs/${fdtfile}
#

##Un-comment to enable systemd in Debian Wheezy
#optargs=quiet init=/lib/systemd/systemd

console=ttyO3,115200n8
#mmcrootmmcroot=/dev/mmcblk0p2 ro
#mmcrootfstypemmcrootfstype=ext4 rootwait fixrtc

mmcroot=/dev/ram0
#mmcargs=mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}mmcargs=setenv bootargs

console=${console} root=${mmcroot} initramfs=0x81000000, 8M
#zImage:
uenvcmd=run loadimage; run loadfdt; run mmcargs; bootz ${loadaddr} - ${fdtaddr}

#zImage + uInitrd: where uInitrd has to be generated on the running system.
#boot_fdt=run loadimage; run loadinitrd; run loadfdt
#uenvcmd=run boot_fdt; run mmcargs; bootz ${loadaddr} ${initrd_addr}:${initrd_size} ${fdtaddr}

###Begin Rootfs from NFS
#serverip=192.168.1.51
#rootpath=/srv/nfs/smarct335x/ubuntu1204/
#nfsopts=nolock,acdirmin=60
#netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
##netboot=echo Loading kernel from SDCARD and booting from NFS ...; run loadimage; run netargs; bootz ${loadaddr} - ${fdtaddr}
##uenvcmd=run netboot
###End Rootfs from NFS

###Begin Load kernel from TFTP
#netmask=255.255.255.0
#ipaddr=192.168.1.65
#serverip=192.168.1.51
#netboot=echo Loading kernel and device tree from TFTP and booting from NFS ...; setenv autoload no; tftp ${loadaddr} ${kernel_file}; tftp ${fdtaddr} ${fdtfile}; run netargs; bootz ${loadaddr} - ${fdtaddr}
#uenvcmd=run netboot
###End Load kernel from TFTP

Note

For kernel 3.14.y and after, the serial port device descriptor changes from ttyO to ttyS

The above uEnv.txt file needs to change accordingly. (ttyO3 --> ttyS3)

The uEnv.txt file only changes mmcroot from /dev/mmcblk1 (SD) to /dev/mmcblk0 (eMMC)

 

Copy real rootfs to rootfs partition:

...

Now it will be almost the same as you did when setup your SD card, but the eMMC device descriptor is /dev/mmcblk1 mmcblk0 now.

Info
iconfalse

$ export DISK=/dev/mmcblk1mmcblk0

Erase SD card:

Info
iconfalse

$ sudo dd if=/dev/zero of=${DISK} bs=1M count=16

...

In SDK6, Arago rootfs will mount partition2 as /media/mmcblk1p2 mmcblk0p2 automatically after executing the above command. Umount the partition first.

Info
iconfalse

$ sudo umount /media/mmcblk1p2mmcblk0p2


Format Partitions:

Info
iconfalse
$ sudo mkfs.vfat -F 16 ${DISK}p1 -n boot
$ sudo mkfs.ext4 ${DISK}p2 -L rootfs

...

Unmount eMMC:

 
Info
iconfalse
$ sync
$ sudo umount /media/boot
$ sudo umount /media/rootfs

 

Note

If your rootfs id Ubuntu, you need to modify /media/rootfs/etc/fstab and change the mount point from /dev/mmcblk1p2 to /dev/mmcblk0p2 before un-mounting it.

Switch your Boot Select to eMMC and you will be able to boot up from eMMC now.


Last updated 2015-10-22