For this present article, we use SAMA5d3_Xplained board based on ATSAMA5D36 (ARM based MPU). But, the same step follows for any other hardware.
This article aims to introduce on bringing up SAMA5D3_Xplained board as a Linux System.
Before we start, we need to understand the boot sequence to know what should be done (Ref. Getting Started - at91.com)
The above image will show you three levels of bootloaders which are optional based on whether we implement simple firmware or OS.
Step:1 Prepare the necessary objects
This article aims to introduce on bringing up SAMA5D3_Xplained board as a Linux System.
Before we start, we need to understand the boot sequence to know what should be done (Ref. Getting Started - at91.com)
Boot Sequence (Source: at91.com) |
Step:1 Prepare the necessary objects
- Bootstrap image
- Kernel Image
- Kernel modules
- Device tree file
- Rootfs Image
Note:
arm-linux-gnueabi- toolchain required to build the image, can be downloaded form release.linaro.org and add path to gcc-linaro_<version>_arm-linux-gnueabi/bin directory.$ export PATH=~/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabi/bin/:$PATH
To permanently add the path to the environment, add the above command to .bashrc file.
Building Bootstrap Image
-
Clone/Download at91bootstrap source from linux4sam/at91bootstrap git repository.
-
Configure the source with the default configuration for SD Card boot.
You can find a number of default configurations for different boot media
at ./board/sama5d3xek/ directory.
$ cd at91bootstrap/ $ make mrproper $ make sama5d3_xplainedsd_linux_image_dt_defconfig
Note:nf- NandFlash, sd - MMC Card, df - SerialFlash, linux - linux kernel, android - android kernel, uboot - u-boot, dt - device tree binary (dtb). (Ref. AT91Bootstrap - at91.com) -
Compile the at91bootstrap
$ make CROSS_COMPILE=arm-linux-gnueabi-
The resulting binary will be created at ./binaries/ with the name sama5d3_xplained……bin .
Building Kernel Image, Device Tree (.dtb) and Kernel Modules
The Kernel Image, Device Tree Binary and Kernel Modules are all built form Kernel Source with different options.
-
Get Kernel Source either from kernel.org or linux4sam/linux-ar91 git repository.
-
Configure the build with default configuration.
$ cd linux-at91 $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- sama5_defconfig
-
For any changes needed in the configuration, configure using menuconfig
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig
-
Compile for Kernel Image
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage
-
Compile for Device Tree Binary(.dtb)
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- dtbs
-
Compile for Kernel Modules
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules
The images will be created at arch/arm/boot/.
Building Rootfs
There are several Roofs build systems available such as Yocto, Buildroot, Busybox, Multistrap, etc.,
For our convenience, we can get the archived pre-built custom Rootfs from shark/zdrive. Other sources can also be found online(sborut.wordpress.com, Dropbox). But, for ARM architecture.
Preparing SD/MMC Card
In SD Card, two partitions are to be created.
-
First partition (FAT32) ⇒ boot/ ⇒ required to move the boot images(bootstrap, kernel image and device tree binary).
-
Second partition (EXT4) ⇒ rootfs/ ⇒ for the root file system requied by the kernel to run.
Note:
fdisks is a command-line tool for creating and managing partitions. mkfs is another command-line tool to format paritions to required file system. Need to be super user to use this tool.-
After the SD Card is ready with the required partitions say by name, boot and rootfs, copy the bootstrap image, kernel image, dtb to boot/ as follows.
$ at91bootstrap/binaries/sama5d3_xplained-sdcardboot-linux-image-dt-3.8.bin /media/user/boot/boot.bin $ cp linux-at91/arch/arm/boot/zImage /media/user/boot/image $ cp linux-at91/arch/arm/boot/dts/at91-sama5d3_xplained.dtb /media/user/boot/
-
Untar the downloaded rootfs archive to the second partition rootfs
$ tar -xvf rootfs-armel-wheezy.tar.xz -c /media/user/rootfs
-
Install the Kernel Modules into rootfs
~/linux-at91 $ make modules_install ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/media/user/rootfs
Now, your SD Card is ready with the necessary components to run Linux on SAMA5D3 Xplained board.
Bringing Wi-Fi Client Feature
To bring Wi-Fi client feature with the given NIC, we may need
-
Device driver for the given NIC enabled in the Kernel.
- Some HAL layer firmware, if required by the device driver. (Ref. ath9k_htc firmware - github.com)
-
Certain utilities to configure and manage Wi-Fi.
(iw, ip, iwconfig, wpa_passphrase, wpa_supplicant, firmware-atheros) - Read on through this link to bring WiFi Client feature.
Read on through this link to bring WiFi Access Point feature.
No comments:
Post a Comment
Comment will be published after moderation only. Do not advertise here.