Table of Contents
Author: Jan Kobler, Kobler Systems GmbH, email: eng1@koblersystems.de
This work by Kobler Systems GmbH is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.
This manual shows how to
install the source code of the Linux BSP for phyBOARD-WEGA-AM335x on the host,
build it,
install the resulting images on the target and
start Linux on the target.
It is possible to boot the target
from NAND or
from SD-card
It is possible to load the kernel and the rootfs
from NAND,
from SD-card or
via TFTP and NFS
This BSP is for use with:
phyBOARD-WEGA-AM335x with carrier board 1405.0 or 1405.1
HDMI Adapter PEB-AV-01 1406.0 or 1406.1
Eval Module PEB-EVAL-01 1413.0 or 1413.1
This tutorial and the accompanying makefiles for this BSP have been tested on:
phyBOARD-WEGA-AM335x with carrier board 1405.1
HDMI Adapter PEB-AV-01 1406.1
Eval Module PEB-EVAL-01 1413.1
Some parts of this tutorial are repeated at places where there are needed, to avoid jumping back in the text, when following the instructions.
There are similar chapters in this text, because they describe the commands for a quick start or for development or usage of the commands for the first time or usage of the commands again.
When you want to use only the necessary commands, follow the instructions in the quick start chapter.
When you want to use all commands or want to change the source code, then start with the development chapter and skip the quick start and again chapters.
When you want to use the commands again, then follow the instructions in the development chapter and skip the first time chapters.
At first this might seem to be confusing, but in the long run it saves time, when regularly using this tutorial and the accompanying makefiles.
The commands used in this document are shown in the following graph.
The meaning of the node shapes and arrows in this graph is:
grey circle: state of the development environment or action on the target
ellipse: makefile targets in makefile ${BSP_MK}
or some other command
solid arrow: next step
dashed arrow from A to B: B depends on A
The commands used to manage the version control in this document and the resulting dataflow are shown in the following graph.
The meaning of the node shapes and arrows in this graph is:
grey octagon: git repository
light blue octagon: single file or folder
box: makefile targets in makefile ${BSP_MK}
inverted house: single command
solid arrow: data flow
dashed arrow from A to B: The makefile target A uses the command B
Folders:
Folder for Phytec Linux software: ${MY_DEVELOP}
Folder for current software distribution: ${DISTRIB_IN}
Filenames:
makefile: ${BSP_MK}
Macros:
Version Identifier ${MY_VERSION}
Define environment variables:
export MY_VERSION=20141113-1 export MY_DEVELOP=/MyDevelop/phyBOARD-WEGA-AM335x export DISTRIB_IN=${MY_DEVELOP}/distrib/test-${MY_VERSION}
Please adjust the value of MY_DEVELOP
to your needs. Use the same value also in the makefile ${BSP_MK}
.
This section describes how to install Phytec and third party software on the host.
The commands in this tutorial have been tested on a system running Gentoo Linux. Most commands should be the same on other Linux systems.
For building the Linux BSP from source you need the tools: wget, expect, sudo, fakeroot
On Gentoo Linux you can install these tools with
emerge --ask -v wget expect sudo fakeroot
emerge
is a Gentoo specific command for installing software.
For testing and using the Linux BSP on a Phytec phyBOARD-WEGA-AM335x board you need the utilities: tftp, nfs, minicom, taylor-uucp
You can install these tools with
emerge --ask -v tftp-hpa nfs-utils minicom taylor-uucp
For working with git repositories you need: git
If you want to use the GUI of git you need also: git gui, gitk
nano
is used as editor.
You need a TFTP server on your host system for installing the binary images on the target and boot from NAND.
You need a NFS and TFTP server on your host system for Boot_via_TFTP_and_NFS
make
is usally used in the commands in this manual.
Install missing software on the host.
Phytec software for Linux for phyBOARD-WEGA-AM335x is shipped in several parts. The first part is shipped as git repository.
Please install the software into the folder ${DISTRIB_IN}
mkdir -p ${DISTRIB_IN}/install git clone http://github.com/koblersystems/phyBOARD-WEGA-AM335x-phytec-linux-install-01 ${DISTRIB_IN}/install
So far only a small part of the software has been installed into the folder ${DISTRIB_IN}
. The rest of the Phytec software is downloaded later.
The tutorial has also been installed. You can now switch to the installed tutorial, if you like.
firefox ${DISTRIB_IN}/install/doc/install_pd_src.html
This section describes how to edit the config files of the bootloader barebox on the target and how to return to the default environment.
When you follow the instructions in this manual, you usually don't need to edit files on the target, because the files are edited instead on the host and downloaded via tftp to the target.
When you need to edit a file on the target e.g. /env/network/eth0
, you can use the command edit
edit /env/network/eth0
Save the file with CTRL-D or close the file without saving by pressing CTRL-C.
Save changes
saveenv
The makefile ${BSP_MK}
contains the code to install and use Phytec Linux for phyBOARD-WEGA-AM335x.
Define environment variable:
export BSP_MK=${DISTRIB_IN}/install/scripts/pd_src.mk
Define alias bmk
for the make command:
alias bmk="make --makefile ${BSP_MK} -C $(dirname ${BSP_MK})"
Before using the makefile, you need to set some variables in it
nano ${BSP_MK}
Especially set the value of ${MY_DEVELOP}
to the same value you have already defined in the environment.
New or changed content of file ${BSP_MK}
:
################################################# # User specific settings # Please set the variables below this line ################################################# # Set the root folder for the Phytec Linux BSP software # most of the files and directories are installed or created in this folder or subfolders. MY_DEVELOP:=/MyDevelop/phyBOARD-WEGA-AM335x # current version number MY_VERSION:=20141113-1 # VERY IMPORTANT: This is the device name of the SD-card on the host, when it is inserted in the card reader. # This device will be ERASED and FORMATTED!!! # Don't select a disk of your host, otherwise it will be erased !! # You can use 'dmesg' to find out the device name, after the SD-card has been inserted in the card reader. # If you don't know the device name use /dev/null SDCARD_DEV:=/dev/null # This is the prefix of the partition name: usally it is the same as $(SDCARD_DEV) # but sometimes its value is '$(SDCARD_DEV)p'. SDCARD_PART:=$(SDCARD_DEV) # The distribution archive has been extracted into this folder DISTRIB_IN:=$(MY_DEVELOP)/distrib/test-$(MY_VERSION) # Please set the download folder for software archives, which can be shared with other development environments. MY_DOWNLOAD_SRC:=/MyDevelop/distfiles # Download folder for archives which are specific to this board MY_DOWNLOAD_BOARD:=/MyDownload/phyBOARD-WEGA-AM335x # Install the toolchain into this folder, i.e. the compiler is installed in this folder. MY_TOOLCHAIN:=$(MY_DEVELOP)/toolchain # Please set folder of the tftp server MY_TFTPBOOT:=/tftpboot # Please set the IP addresses of your host and the target. IP_ADDR_TARGET:=192.168.1.8 IP_ADDR_HOST:=192.168.1.32 IP_NETMASK:=255.255.255.0 IP_ADDR_GATEWAY:=192.168.1.1 # This client address is used in the file /etc/exports IP_NFS_CLIENT:=192.168.1.255/24 # Folder for the local git repositories. This folder may be shared by several projects. LOCAL_GIT:=$(MY_DEVELOP)/git-PD # Folder for the makefiles which are included at the end of this file. # If you move this file into another folder, you can define the include directory for the makefiles. # Default value is the current working directory. MY_SCRIPTS:=. ################################################# # # Git Repositories # # For the first tests you don't need to change the following values. # # Only when you change the source code of the BSP # and save the changes in git repositories # you need to adjust the following values as needed # # The values are used in pd_src_git.mk. # Please search there for these macros before you change them. # # Revision names or commit ids or start numbers for git repositories # GIT_REV_NAME_*: git branch or tag name # GIT_REV_ID_*: git commit id # GIT_START_NUMBER_*: git start number of patch numbers # ################################################# GIT_REV_NAME_bsp:=master GIT_REV_ID_bsp:=fb5de7ae1f61a84793bbc4d5fc5c66ec9eccd49b GIT_REV_NAME_ptxdist:=master GIT_REV_ID_ptxdist:=d72665bd5e4565c6793f78ae99e6e22113faed0f GIT_REV_NAME_barebox:=master GIT_REV_ID_barebox:=0000000 GIT_REV_ID_barebox_start:=0000000 GIT_START_NUMBER_barebox:=20 GIT_REV_NAME_linux:=master GIT_REV_ID_linux:=00000000 GIT_REV_ID_linux_start:=00000000 GIT_START_NUMBER_linux:=120 GIT_REV_NAME_toolchain:=master GIT_REV_ID_toolchain:=90a8fe685cb903b4cf2b668be54029d3524207b2 GIT_REV_NAME_gcc-linaro:=master GIT_REV_ID_gcc-linaro:=00000000 GIT_REV_ID_gcc-linaro_start:=000000000 GIT_START_NUMBER_gcc-linaro:=400 GIT_REV_NAME_tftpboot:=phyBOARD-WEGA-13.0.0-01 GIT_REV_ID_tftpboot:=7f123cdf7aa7a2a4a2a58af3edfcd7c11b5541ae ################################################# # No need to change the variables below this line #################################################
Note: All needed variables are defined inside the makefile. No specific environment variable needs to be defined outside the makefile.
Both commands list the available make targets
bmk bmk info_target
Before you make a target, you can check which commands will be used by using the option -n
.
bmk doc_download -n
Note: It is important to check which commands are used to avoid any damage to your computer system.
When some of the make targets are succesfully made, then a state file is created for each target in the folder $(STATE)
. These targets are again made only, when there is no state file. You can remove such a state file by using a target name, which is the old target name with the prefix rm_
. Make e.g. the target doc_download
bmk doc_download -n bmk doc_download
List the target states.
bmk list_states
Before you can make the target doc_download
again, you have to remove the correspondig state file by making the target rm_doc_download
.
bmk rm_doc_download bmk doc_download
The intention of the makefile ${BSP_MK}
is to show or execute the correct commands, which are needed to install and use the software Phytec Linux for phyBOARD-WEGA-AM335x. It is important, that the user understands, what the commands like ptxdist
are doing. This manual tries to show how to use these commands in the correct sequence.
The makefile is not intended to replace any existing tool. Feel free to create your own scripts, makefiles or call the resulting commands directly.
Changes in config files are often achieved by using the stream editor sed
. The scripts for the stream editor search for specific patterns in the config files. Be careful when changing the config files yourself.
If you want to get quickly up and running,
follow first the instructions from the beginning of this document until this chapter
and then the instructions in this chapter.
In this chapter only the commands are shown, which are needed
to install the tools,
to build the BSP,
to install the images on the target and
to boot the target from different sources
for the first time.
In other parts of this document more commands are shown, which can help you with working with the BSP and developing software. Also if you run into problems when executing the commands in this quick start chapter, you should find some solutions in the rest of this document.
This chapter shows how to install the tool ptxdist, the toolchain and the BSP on the host.
download files for ptxdist
bmk ptxdist_download
Extract ptxdist
bmk ptxdist_extract
Install ptxdist
bmk ptxdist_install
Select ${MY_DOWNLOAD_SRC}
as common source directory, where all the archives are downloaded, only missing archives are downloaded. All archives which will be downloaded when building the toolchain or the bsp are downloaded in this folder.
bmk ptxdist_setup_srcdir
download files for toolchain
bmk toolchain_download
Extract Toolchain
bmk toolchain_extract
This describes the usage of ptxdist
for building the toolchain. You don't need to call any of the commands, which are shown in the output, to install the toolchain right now. If you run into problems building the toolchain, you will need to call ptxdist directly. At the moment the output is only for your info:
bmk toolchain_ptxdist
Set prefix for toolchain folder. The default is /opt. Here a local folder is selected in order not to interfere with other toolchains.
bmk toolchain_prefix
select the toolchain
bmk toolchain_select
migrate the config file to a new ptxdist version
bmk toolchain_migrate
check PTXCONF_SETUP_SRCDIR in ptxdistrc for toolchain
bmk toolchain_check_srcdir
build the toolchain from scratch
bmk toolchain_build
remove temporary files of toolchain in order to save disk space
bmk toolchain_clean_build
download files for bsp
bmk bsp_download
Preparations for installing the BSP
bmk bsp_prepare
Extract BSP
bmk bsp_extract
Select the configuration files
bmk bsp_config
The compiler is searched in the /opt folder. If it is found a link is created. Select the compiler, which you have just built.
bmk bsp_compiler
Check PTXCONF_SETUP_SRCDIR in ptxdistrc for bsp
bmk bsp_check_srcdir
Create repository of local repository of tftpboot
bmk create_git_tftpboot_local
Create new git work repository of current tftpboot and checkout files in new source folder for existing local repositories
bmk create_co_git_tftpboot_work
cp env into images. Copy the prepared tftpboot files into the images folder
bmk archive_barebox_env
Install Tools and BSP
bmk \ doc_download \ ptxdist_download \ ptxdist_extract \ ptxdist_install \ ptxdist_setup_srcdir \ toolchain_download \ toolchain_extract \ toolchain_ptxdist \ toolchain_prefix \ toolchain_select \ toolchain_migrate \ toolchain_check_srcdir \ toolchain_build \ toolchain_clean_build \ bsp_download \ bsp_prepare \ bsp_extract \ bsp_config \ bsp_compiler \ bsp_check_srcdir \ create_git_tftpboot_local \ create_co_git_tftpboot_work \ archive_barebox_env
This chapter shows how to build the BSP on the host.
Build BSP with ptxdist
bmk bsp_go
At the end you get the message:
Output:
------------------------------------------------------------------- For a proper NFS-root environment, some device nodes are essential. In order to create them root privileges are required. ------------------------------------------------------------------- (Please press enter to start 'sudo' to gain root privileges.) WARNING: NFS-root might not be working correctly!
If you missed it you can build the bsp again with:
bmk rm_bsp_go bmk bsp_go
Output:
------------------------------------------------------------------- For a proper NFS-root environment, some device nodes are essential. In order to create them root privileges are required. ------------------------------------------------------------------- (Please press enter to start 'sudo' to gain root privileges.)
Press enter.
Output:
Password:
Enter the root password. Output:
creating device node: platform-phyBOARD-WEGA-AM335x/root/dev/null creating device node: platform-phyBOARD-WEGA-AM335x/root/dev/zero creating device node: platform-phyBOARD-WEGA-AM335x/root/dev/console creating device node: platform-phyBOARD-WEGA-AM335x/root-debug/dev/null creating device node: platform-phyBOARD-WEGA-AM335x/root-debug/dev/zero creating device node: platform-phyBOARD-WEGA-AM335x/root-debug/dev/console
Create images for BSP with ptxdist
bmk bsp_images
All binaries for the target have been created now.
This chapter shows how to download the binary images of the bootloader, Linux kernel and the root file system and boot the device in different ways.
Save barebox image, kernel image and device tree in image folder.
bmk kernel_01
overwrite image area on SD-card with zeros , format SD-card, create binary image
bmk parted_sdcard_01 cp_archive_sdcard_01 cp_file_sdcard_01
You can update the bootloader in NAND:
by copying the images from SD-Card or
by downloading the images from an TFTP server.
You can copy the images from an SD-card :
after booting from the SD-Card or
after mounting the SD-Card manually.
When you boot from SD-card, the card is already mounted at /boot.
Check which devices are known
devinfo
Check which images are on the SD-card
ls /boot
Output:
MLO barebox.bin barebox.env linuximage
Update x-loader MLO
erase /dev/nand0.xload.bb cp /boot/MLO /dev/nand0.xload.bb
Update barebox
erase /dev/nand0.barebox.bb cp /boot/barebox.bin /dev/nand0.barebox.bb
When the bootloader has changed significantly, it is also necessary to erase the barebox environment:
erase /dev/nand0.bareboxenv
Further information is available in L-775e_3.pdf on page 22.
Insert SD-Card and mount it.
Check which devices are known
devinfo
Mount the SD-card, if it is not already mounted:
mci0.probe=1 ls /mnt mkdir /mnt/disk mount /dev/disk0.0 /mnt/disk
Check which images are on the SD-card
ls /mnt/disk
Output:
MLO barebox.bin linuximage
Update x-loader MLO
erase /dev/nand0.xload.bb cp /mnt/disk/MLO /dev/nand0.xload.bb
Update barebox
erase /dev/nand0.barebox.bb cp /mnt/disk/barebox.bin /dev/nand0.barebox.bb
When the bootloader has changed significantly, it is also necessary to erase the barebox environment:
erase /dev/nand0.bareboxenv
copy kernel image for boot_tftp_nfs and boot_nand into images folder
bmk kernel_boot_tftp_nfs
Copy kernel into tftp folder
bmk tftpboot_kernel
Copy the ubi image of boot_nand
bmk cp_image_boot_nand
Copy root.ubi into tftp folder
bmk tftpboot_root_ubi
Update kernel and root on target for boot_nand
bmk update_target_boot_nand
cp env into images. Copy the prepared tftpboot files into the images folder
bmk archive_barebox_env
Barebox config files are copied into the real folder tftpboot, which is used by the tftp server. Do it only once. Default settings are to boot from NAND.
bmk cp_barebox_config
Because the config files contain dummy ip addresses, it is important to set the correct ip addresses.
bmk set_ip_barebox_config
Copy env/boot/net-02
and some other files to the target.
bmk cp_init_board
The output of this make command describes how to download files to the target. Follow the instructions.
When barebox is restarted, /env/network/eth0
is used to configure the Ethernet port. When you call
boot net-02
you can boot the board via TFTP and NFS. The file /env/boot/net-02
is executed and loads the file /env/bin/net-03
from the TFTP server. This file is also executed.
Note: It is very important that you copy the init files to the target. Some commands in the makefile are changing the config file in the tftpboot folder on the host.
Adjust boot.default in env/config to boot from TFTP and NFS
bmk tftpboot_config_loc_boot_tftp_nfs
Build BSP with ptxdist
bmk bsp_go
Create images for BSP with ptxdist
bmk bsp_images
copy kernel image for boot_tftp_nfs into images folder
bmk kernel_boot_tftp_nfs
Copy kernel from images into tftp folder
bmk tftpboot_kernel
Copy RootFS Archive of boot_tftp_nfs into images
bmk cp_image_boot_tftp_nfs
Create root file system, which can be mounted via NFS.
bmk create_rootfs_boot_tftp_nfs
Setup NFS, add rootfs to /etc/exports
bmk export_rootfs
exportfs -r
bmk export_refresh
remove fingerprint in .ssh/known_hosts
bmk ssh_fingerprint
Adjust nfsroot in env/config
bmk tftpboot_config
show command for netconsole
bmk netconsole
You have just configured the board to boot via TFTP and NFS. If you want to switch back to booting from NAND, you can use the following command.
Adjust boot.default in env/config to boot from NAND
bmk tftpboot_config_loc_boot_nand
If you want to switch again to booting via TFTP and NFS, you can use again the following command.
Adjust boot.default in env/config to boot from TFTP and NFS
bmk rm_tftpboot_config_loc_boot_tftp_nfs bmk tftpboot_config_loc_boot_tftp_nfs
Check if you have the correct hardware versions:
phyBOARD-WEGA-AM335x with carrier board 1405.0 or 1405.1
HDMI Adapter PEB-AV-01 1406.0 or 1406.1
Eval Module PEB-EVAL-01 1413.0 or 1413.1
By default the board tries to boot from NAND at first. Without any valid bootloader in NAND, the board will try to boot from SD-card next.
You can force the board to try to boot from SD-card at first. This allows you to test the bootloader on the SD-card without changing anything in NAND.
If you have the carrier board 1405.0:
You can force the board to boot from SD-card by connecting X_LCD_D2 (pin 8 at X70) to a high-level (e.g. VCC3V3 – pin13 at X71) during the power-up sequence.
If you have the carrier board 1405.1:
Take off the expansion board PEB-AV-01 or PEB-AV-02. Move the DIP switch to ON, to force booting from SD-card. When you have moved the switch in direction of the SD-card slot, the switch is in position ON.
The description how to boot from SD-card can be found in L-792e_0.pdf on page 77 and in http://www.phytec.de/de/support/faq/faq-phyboard-wega.html.
Connect the board to the host, network and display:
Connect a serial cable (one-to-one) to the DB9 connector on PEB-EVAL-01. Set the speed to 115200 8N1 in your terminal application on the host.
Connect an ethernet cable to the port X16 on the carrier board. This is the ethernet port next to the USB port.
If you want to work with an SD-card, insert the SD-card into carrier board.
You can connect also a display to the HDMI port on PEB-AV-01.
Boot the board again.
Create images for SD-card
bmk \ kernel_01 \ parted_sdcard_01 \ cp_archive_sdcard_01 \ cp_file_sdcard_01
update barebox, kernel and root file system in NAND
bmk \ cp_barebox_boot_nand \ tftpboot_barebox \ update_barebox \ cp_image_boot_nand \ tftpboot_root_ubi \ kernel_boot_tftp_nfs \ tftpboot_kernel \ update_target_boot_nand
update kernel and root file system in NAND
bmk \ cp_image_boot_nand \ tftpboot_root_ubi \ kernel_boot_tftp_nfs \ tftpboot_kernel \ update_target_boot_nand
Prepare tftp config for boot via tftp and nfs
bmk \ archive_barebox_env \ cp_barebox_config \ set_ip_barebox_config \ cp_init_board \ tftpboot_config_loc_boot_tftp_nfs
Prepare kernel and rootfs for boot via TFTP and NFS
bmk \ bsp_go \ bsp_images \ kernel_boot_tftp_nfs \ cp_image_boot_tftp_nfs \ tftpboot_kernel \ create_rootfs_boot_tftp_nfs \ export_rootfs \ export_refresh \ ssh_fingerprint \ tftpboot_config \ netconsole
Switch back to boot from NAND. Adjust boot.default in env/config to boot from NAND
bmk \ tftpboot_config_loc_boot_nand
Switch again to boot via TFTP and NFS. Adjust boot.default in env/config to boot from TFTP and NFS
bmk \ rm_tftpboot_config_loc_boot_tftp_nfs bmk \ tftpboot_config_loc_boot_tftp_nfs
Install the tools and the BSP and create the binaries from scratch.
This chapter shows how to install the tool ptxdist, the toolchain and the BSP on the host.
download files for ptxdist
bmk ptxdist_download
Extract ptxdist
bmk ptxdist_extract
This creates a new and empty local repository for ptxdist, if it doesn't exist already.
bmk create_new_git_ptxdist_local
Create new repository of current ptxdist and add source code to it. This creates a new work repository, adds the current source code to it and pushes it to the local repository.
bmk create_new_git_ptxdist_work
Push changes in ptxdist_work to local repository. If you have changed the work repository, push changes to the local repository. When you have just extracted the archive i.e. you have not done any changes, you can skip this command.
bmk push_git_ptxdist_work
Install ptxdist
bmk ptxdist_install
Select ${MY_DOWNLOAD_SRC}
as common source directory, where all the archives are downloaded, only missing archives are downloaded. All archives which will be downloaded when building the toolchain or the bsp are downloaded in this folder.
bmk ptxdist_setup_srcdir
download files for toolchain
bmk toolchain_download
Extract Toolchain
bmk toolchain_extract
This creates a new and empty local repository for toolchain, if it doesn't exist already.
bmk create_new_git_toolchain_local
Create new repository of current toolchain and add source code to it. This creates a new work repository, adds the current source code to it and pushes it to the local repository.
bmk create_new_git_toolchain_work
Push changes in toolchain_work to local repository. If you have changed the work repository, push changes to the local repository. When you have just extracted the archive i.e. you have not done any changes, you can skip this command.
bmk push_git_toolchain_work
This describes the usage of ptxdist
for building the toolchain. You don't need to call any of the commands, which are shown in the output, to install the toolchain right now. If you run into problems building the toolchain, you will need to call ptxdist directly. At the moment the output is only for your info:
bmk toolchain_ptxdist
Set prefix for toolchain folder. The default is /opt. Here a local folder is selected in order not to interfere with other toolchains.
bmk toolchain_prefix
select the toolchain
bmk toolchain_select
migrate the config file to a new ptxdist version
bmk toolchain_migrate
check PTXCONF_SETUP_SRCDIR in ptxdistrc for toolchain
bmk toolchain_check_srcdir
build the toolchain from scratch
bmk toolchain_build
remove temporary files of toolchain in order to save disk space
bmk toolchain_clean_build
download files for bsp
bmk bsp_download
Preparations for installing the BSP
bmk bsp_prepare
Extract BSP
bmk bsp_extract
This creates a new and empty local repository for bsp, if it doesn't exist already.
bmk create_new_git_bsp_local
Create new repository of current bsp and add source code to it.This creates a new work repository, adds the current source code to it and pushes it to the local repository.
bmk create_new_git_bsp_work
Push changes in bsp_work to local repository. If you have changed the work repository, push changes to the local repository. When you have just extracted the archive i.e. you have not done any changes, you can skip this command.
bmk push_git_bsp_work
Select the configuration files
bmk bsp_config
The compiler is searched in the /opt folder. If it is found a link is created. Select the compiler, which you have just built.
bmk bsp_compiler
Check PTXCONF_SETUP_SRCDIR in ptxdistrc for bsp
bmk bsp_check_srcdir
Create repository of local repository of tftpboot
bmk create_git_tftpboot_local
Create new git work repository of current tftpboot and checkout files in new source folder for existing local repositories
bmk create_co_git_tftpboot_work
cp env into images. Copy the prepared tftpboot files into the images folder
bmk archive_barebox_env
Install Tools and BSP
bmk \ doc_download \ ptxdist_download \ ptxdist_extract \ create_new_git_ptxdist_local \ create_new_git_ptxdist_work \ ptxdist_install \ ptxdist_setup_srcdir \ toolchain_download \ toolchain_extract \ create_new_git_toolchain_local \ create_new_git_toolchain_work \ toolchain_ptxdist \ toolchain_prefix \ toolchain_select \ toolchain_migrate \ toolchain_check_srcdir \ toolchain_build \ toolchain_clean_build \ bsp_download \ bsp_prepare \ bsp_extract \ create_new_git_bsp_local \ create_new_git_bsp_work \ bsp_config \ bsp_compiler \ bsp_check_srcdir \ create_git_tftpboot_local \ create_co_git_tftpboot_work \ archive_barebox_env
Push changes in work folder to local repository
bmk \ push_git_ptxdist_work \ push_git_toolchain_work \ push_git_bsp_work
When you want to install the tools and the bsp on the host again, you have to remove the make states before you can use the make targets. The additional commands are shown.
You have to understand what the commands are doing. Perhaps you have do remove some files or folders before you can use the make targets.
This chapter shows how to install the tool ptxdist, the toolchain and the BSP on the host.
download files for ptxdist
bmk rm_ptxdist_download bmk ptxdist_download
Extract ptxdist
bmk rm_ptxdist_extract bmk ptxdist_extract
This creates a new and empty local repository for ptxdist, if it doesn't exist already.
bmk rm_create_new_git_ptxdist_local bmk create_new_git_ptxdist_local
Create new repository of current ptxdist and add source code to it. This creates a new work repository, adds the current source code to it and pushes it to the local repository.
bmk rm_create_new_git_ptxdist_work bmk create_new_git_ptxdist_work
Push changes in ptxdist_work to local repository. If you have changed the work repository, push changes to the local repository. When you have just extracted the archive i.e. you have not done any changes, you can skip this command.
bmk rm_push_git_ptxdist_work bmk push_git_ptxdist_work
Install ptxdist
bmk rm_ptxdist_install bmk ptxdist_install
Select ${MY_DOWNLOAD_SRC}
as common source directory, where all the archives are downloaded, only missing archives are downloaded. All archives which will be downloaded when building the toolchain or the bsp are downloaded in this folder.
bmk rm_ptxdist_setup_srcdir bmk ptxdist_setup_srcdir
download files for toolchain
bmk rm_toolchain_download bmk toolchain_download
Extract Toolchain
bmk rm_toolchain_extract bmk toolchain_extract
This creates a new and empty local repository for toolchain, if it doesn't exist already.
bmk rm_create_new_git_toolchain_local bmk create_new_git_toolchain_local
Create new repository of current toolchain and add source code to it. This creates a new work repository, adds the current source code to it and pushes it to the local repository.
bmk rm_create_new_git_toolchain_work bmk create_new_git_toolchain_work
Push changes in toolchain_work to local repository. If you have changed the work repository, push changes to the local repository. When you have just extracted the archive i.e. you have not done any changes, you can skip this command.
bmk rm_push_git_toolchain_work bmk push_git_toolchain_work
This describes the usage of ptxdist
for building the toolchain. You don't need to call any of the commands, which are shown in the output, to install the toolchain right now. If you run into problems building the toolchain, you will need to call ptxdist directly. At the moment the output is only for your info:
bmk toolchain_ptxdist
Set prefix for toolchain folder. The default is /opt. Here a local folder is selected in order not to interfere with other toolchains.
bmk rm_toolchain_prefix bmk toolchain_prefix
select the toolchain
bmk rm_toolchain_select bmk toolchain_select
migrate the config file to a new ptxdist version
bmk rm_toolchain_migrate bmk toolchain_migrate
check PTXCONF_SETUP_SRCDIR in ptxdistrc for toolchain
bmk rm_toolchain_check_srcdir bmk toolchain_check_srcdir
build the toolchain from scratch
bmk rm_toolchain_build bmk toolchain_build
remove temporary files of toolchain in order to save disk space
bmk rm_toolchain_clean_build bmk toolchain_clean_build
download files for bsp
bmk rm_bsp_download bmk bsp_download
Preparations for installing the BSP
bmk bsp_prepare
Extract BSP
bmk rm_bsp_extract bmk bsp_extract
This creates a new and empty local repository for bsp, if it doesn't exist already.
bmk rm_create_new_git_bsp_local bmk create_new_git_bsp_local
Create new repository of current bsp and add source code to it.This creates a new work repository, adds the current source code to it and pushes it to the local repository.
bmk rm_create_new_git_bsp_work bmk create_new_git_bsp_work
Push changes in bsp_work to local repository. If you have changed the work repository, push changes to the local repository. When you have just extracted the archive i.e. you have not done any changes, you can skip this command.
bmk rm_push_git_bsp_work bmk push_git_bsp_work
Select the configuration files
bmk rm_bsp_config bmk bsp_config
The compiler is searched in the /opt folder. If it is found a link is created. Select the compiler, which you have just built.
bmk rm_bsp_compiler bmk bsp_compiler
Check PTXCONF_SETUP_SRCDIR in ptxdistrc for bsp
bmk rm_bsp_check_srcdir bmk bsp_check_srcdir
Create repository of local repository of tftpboot
bmk rm_create_git_tftpboot_local bmk create_git_tftpboot_local
Create new git work repository of current tftpboot and checkout files in new source folder for existing local repositories
bmk rm_create_co_git_tftpboot_work bmk create_co_git_tftpboot_work
cp env into images. Copy the prepared tftpboot files into the images folder
bmk rm_archive_barebox_env bmk archive_barebox_env
Install Tools and BSP
bmk \ rm_doc_download \ rm_ptxdist_download \ rm_ptxdist_extract \ rm_create_new_git_ptxdist_local \ rm_create_new_git_ptxdist_work \ rm_ptxdist_install \ rm_ptxdist_setup_srcdir \ rm_toolchain_download \ rm_toolchain_extract \ rm_create_new_git_toolchain_local \ rm_create_new_git_toolchain_work \ rm_toolchain_prefix \ rm_toolchain_select \ rm_toolchain_migrate \ rm_toolchain_check_srcdir \ rm_toolchain_build \ rm_toolchain_clean_build \ rm_bsp_download \ rm_bsp_extract \ rm_create_new_git_bsp_local \ rm_create_new_git_bsp_work \ rm_bsp_config \ rm_bsp_compiler \ rm_bsp_check_srcdir \ rm_create_git_tftpboot_local \ rm_create_co_git_tftpboot_work \ rm_archive_barebox_env bmk \ doc_download \ ptxdist_download \ ptxdist_extract \ create_new_git_ptxdist_local \ create_new_git_ptxdist_work \ ptxdist_install \ ptxdist_setup_srcdir \ toolchain_download \ toolchain_extract \ create_new_git_toolchain_local \ create_new_git_toolchain_work \ toolchain_ptxdist \ toolchain_prefix \ toolchain_select \ toolchain_migrate \ toolchain_check_srcdir \ toolchain_build \ toolchain_clean_build \ bsp_download \ bsp_prepare \ bsp_extract \ create_new_git_bsp_local \ create_new_git_bsp_work \ bsp_config \ bsp_compiler \ bsp_check_srcdir \ create_git_tftpboot_local \ create_co_git_tftpboot_work \ archive_barebox_env
Push changes in work folder to local repository
bmk \ rm_push_git_ptxdist_work \ rm_push_git_toolchain_work \ rm_push_git_bsp_work bmk \ push_git_ptxdist_work \ push_git_toolchain_work \ push_git_bsp_work
This chapter shows how to build the BSP on the host.
Build BSP with ptxdist
bmk bsp_go
At the end you get the message:
Output:
------------------------------------------------------------------- For a proper NFS-root environment, some device nodes are essential. In order to create them root privileges are required. ------------------------------------------------------------------- (Please press enter to start 'sudo' to gain root privileges.) WARNING: NFS-root might not be working correctly!
If you missed it you can build the bsp again with:
bmk rm_bsp_go bmk bsp_go
Output:
------------------------------------------------------------------- For a proper NFS-root environment, some device nodes are essential. In order to create them root privileges are required. ------------------------------------------------------------------- (Please press enter to start 'sudo' to gain root privileges.)
Press enter.
Output:
Password:
Enter the root password. Output:
creating device node: platform-phyBOARD-WEGA-AM335x/root/dev/null creating device node: platform-phyBOARD-WEGA-AM335x/root/dev/zero creating device node: platform-phyBOARD-WEGA-AM335x/root/dev/console creating device node: platform-phyBOARD-WEGA-AM335x/root-debug/dev/null creating device node: platform-phyBOARD-WEGA-AM335x/root-debug/dev/zero creating device node: platform-phyBOARD-WEGA-AM335x/root-debug/dev/console
Create images for BSP with ptxdist
bmk bsp_images
All binaries for the target have been created now.
This chapter shows how to change the source code for some packages.
This describes the usage of ptxdist
for developing and building the BSP:
bmk bsp_ptxdist
You can create an environment setup file for using ptxdist and git on the commandline.
bmk setup_env_git_bsp_work
The output of this make command describes the usage of the setup-env file. Follow the instructions.
Show examples for applying patches to bsp_work.
bmk apply_patches_git_bsp_work
The output of this make command describes the usage of git to apply patches to the BSP. Follow the instructions.
Call menuconfig for kernel
bmk bsp_kernelconfig
The kernel config file is saved in the BSP. Check the changed kernel config file into the repository bsp_work.
bmk gui_git_bsp_work
Create new repository of local repository of linux
bmk create_new_git_linux_local
Create new repository of current linux with ptxdist --git extract kernel
.
Note: ptxdist clean kernel will be called. The source code folder will be deleted!
bmk create_new_git_ptxdist_linux_work
Now you have a repository of the current linux which contains all the patches which have been shipped with the BSP.
You can create an environment setup file when you want to enter some git commands on the commandline.
bmk setup_env_git_linux_work
The output of this make command describes the usage of the setup-env file. Follow the instructions.
Show examples for applying patches to linux_work.
bmk apply_patches_git_linux_work
The output of this make command describes the usage of git to apply patches to the linux source.
After changing the source code of the kernel, you can compile it again. The kernel is built only with one make thread. If there is an error in the source code, it is easier to find.
bmk kernel-compile
Check the changes of the source code into the repository linux_work. You can do it with the help of a GUI.
bmk gui_git_linux_work
Create new patches for the BSP patches folder for Linux.
bmk create_ptx_patches_git_linux_work
Now the patches for the Linux kernel have been saved in the BSP and you may remove the kernel source.
Clean kernel: you can remove all software parts of the kernel and force a complete rebuilt. If you have changed the source code of the kernel, you have to create the patches for it before you clean the kernel software. Otherwise all your changes are lost.
bmk kernel-clean
Create new repository of local repository of barebox
bmk create_new_git_barebox_local
Create new repository of current barebox with ptxdist --git extract barebox
.
Note: ptxdist clean barebox will be called. The source code folder will be deleted!
bmk create_new_git_ptxdist_barebox_work
Now you have a repository of the current barebox which contains all the patches which have been shipped with the BSP.
You can create an environment setup file when you want to enter some git commands on the commandline.
bmk setup_env_git_barebox_work
The output of this make command describes the usage of the setup-env file. Follow the instructions.
Show examples for applying patches to barebox_work.
bmk apply_patches_git_barebox_work
The output of this make command describes the usage of git to apply patches to the barebox source.
After changing the source code of barebox, you can compile it again.
bmk barebox-compile
Check the changes of the source code into the repository barebox_work. You can do it with the help of a GUI.
bmk gui_git_barebox_work
Create new patches for the BSP patches folder for Barebox.
bmk create_ptx_patches_git_barebox_work
Now the patches for barebox have been saved in the BSP and you may remove barebox source.
Clean barebox: you can remove all software parts of barebox and force a complete rebuilt. If you have changed the source code of barebox, you have to create the patches for it before you clean barebox software. Otherwise all your changes are lost.
bmk barebox-clean
Compare new env in folder tftpboot with current env
bmk compare_barebox_env
cp env into images. Copy the prepared tftpboot files into the images folder
bmk archive_barebox_env
Copy barebox config files into tftp folder. Now the files are copied into the real folder tftpboot, which is used by the tftp server.
bmk cp_barebox_config
When you want to change the source code of some packages and build the BSP again, you have to remove the make states before you can use the make targets. The additional commands are shown.
This chapter shows how to change the source code for some packages.
This describes the usage of ptxdist
for developing and building the BSP:
bmk bsp_ptxdist
You can create an environment setup file for using ptxdist and git on the commandline.
bmk rm_setup_env_git_bsp_work bmk setup_env_git_bsp_work
The output of this make command describes the usage of the setup-env file. Follow the instructions.
Show examples for applying patches to bsp_work.
bmk apply_patches_git_bsp_work
The output of this make command describes the usage of git to apply patches to the BSP. Follow the instructions.
Call menuconfig for kernel
bmk bsp_kernelconfig
The kernel config file is saved in the BSP. Check the changed kernel config file into the repository bsp_work.
bmk gui_git_bsp_work
Create new repository of local repository of linux
bmk rm_create_new_git_linux_local bmk create_new_git_linux_local
Create new repository of current linux with ptxdist --git extract kernel
.
Note: ptxdist clean kernel will be called. The source code folder will be deleted!
bmk rm_create_new_git_ptxdist_linux_work bmk create_new_git_ptxdist_linux_work
Now you have a repository of the current linux which contains all the patches which have been shipped with the BSP.
You can create an environment setup file when you want to enter some git commands on the commandline.
bmk rm_setup_env_git_linux_work bmk setup_env_git_linux_work
The output of this make command describes the usage of the setup-env file. Follow the instructions.
Show examples for applying patches to linux_work.
bmk apply_patches_git_linux_work
The output of this make command describes the usage of git to apply patches to the linux source.
After changing the source code of the kernel, you can compile it again. The kernel is built only with one make thread. If there is an error in the source code, it is easier to find.
bmk rm_kernel-compile bmk kernel-compile
Check the changes of the source code into the repository linux_work. You can do it with the help of a GUI.
bmk gui_git_linux_work
Create new patches for the BSP patches folder for Linux.
bmk rm_create_ptx_patches_git_linux_work bmk create_ptx_patches_git_linux_work
Now the patches for the Linux kernel have been saved in the BSP and you may remove the kernel source.
Clean kernel: you can remove all software parts of the kernel and force a complete rebuilt. If you have changed the source code of the kernel, you have to create the patches for it before you clean the kernel software. Otherwise all your changes are lost.
bmk rm_kernel-clean bmk kernel-clean
Create new repository of local repository of barebox
bmk rm_create_new_git_barebox_local bmk create_new_git_barebox_local
Create new repository of current barebox with ptxdist --git extract barebox
.
Note: ptxdist clean barebox will be called. The source code folder will be deleted!
bmk rm_create_new_git_ptxdist_barebox_work bmk create_new_git_ptxdist_barebox_work
Now you have a repository of the current barebox which contains all the patches which have been shipped with the BSP.
You can create an environment setup file when you want to enter some git commands on the commandline.
bmk rm_setup_env_git_barebox_work bmk setup_env_git_barebox_work
The output of this make command describes the usage of the setup-env file. Follow the instructions.
Show examples for applying patches to barebox_work.
bmk apply_patches_git_barebox_work
The output of this make command describes the usage of git to apply patches to the barebox source.
After changing the source code of barebox, you can compile it again.
bmk rm_barebox-compile bmk barebox-compile
Check the changes of the source code into the repository barebox_work. You can do it with the help of a GUI.
bmk gui_git_barebox_work
Create new patches for the BSP patches folder for Barebox.
bmk rm_create_ptx_patches_git_barebox_work bmk create_ptx_patches_git_barebox_work
Now the patches for barebox have been saved in the BSP and you may remove barebox source.
Clean barebox: you can remove all software parts of barebox and force a complete rebuilt. If you have changed the source code of barebox, you have to create the patches for it before you clean barebox software. Otherwise all your changes are lost.
bmk rm_barebox-clean bmk barebox-clean
Compare new env in folder tftpboot with current env
bmk compare_barebox_env
cp env into images. Copy the prepared tftpboot files into the images folder
bmk rm_archive_barebox_env bmk archive_barebox_env
Copy barebox config files into tftp folder. Now the files are copied into the real folder tftpboot, which is used by the tftp server.
bmk rm_cp_barebox_config bmk cp_barebox_config
When you want to install the tools and the bsp on the host again, you have to remove the make states before you can use the make targets. The additional commands are shown.
You have to understand what the commands are doing. Perhaps you have do remove some files or folders before you can use the make targets.
This chapter shows how to build the BSP on the host.
Build BSP with ptxdist
bmk rm_bsp_go bmk bsp_go
Create images for BSP with ptxdist
bmk rm_bsp_images bmk bsp_images
All binaries for the target have been created now.
This chapter shows how to download the binary images of the bootloader, Linux kernel and the root file system and boot the device in different ways.
Save barebox image, kernel image and device tree in image folder.
bmk kernel_01
overwrite image area on SD-card with zeros , format SD-card, create binary image
bmk parted_sdcard_01 cp_archive_sdcard_01 cp_file_sdcard_01
You can update the bootloader in NAND:
by copying the images from SD-Card or
by downloading the images from an TFTP server.
You can copy the images from an SD-card :
after booting from the SD-Card or
after mounting the SD-Card manually.
When you boot from SD-card, the card is already mounted at /boot.
Check which devices are known
devinfo
Check which images are on the SD-card
ls /boot
Output:
MLO barebox.bin barebox.env linuximage
Update x-loader MLO
erase /dev/nand0.xload.bb cp /boot/MLO /dev/nand0.xload.bb
Update barebox
erase /dev/nand0.barebox.bb cp /boot/barebox.bin /dev/nand0.barebox.bb
When the bootloader has changed significantly, it is also necessary to erase the barebox environment:
erase /dev/nand0.bareboxenv
Further information is available in L-775e_3.pdf on page 22.
Insert SD-Card and mount it.
Check which devices are known
devinfo
Mount the SD-card, if it is not already mounted:
mci0.probe=1 ls /mnt mkdir /mnt/disk mount /dev/disk0.0 /mnt/disk
Check which images are on the SD-card
ls /mnt/disk
Output:
MLO barebox.bin linuximage
Update x-loader MLO
erase /dev/nand0.xload.bb cp /mnt/disk/MLO /dev/nand0.xload.bb
Update barebox
erase /dev/nand0.barebox.bb cp /mnt/disk/barebox.bin /dev/nand0.barebox.bb
When the bootloader has changed significantly, it is also necessary to erase the barebox environment:
erase /dev/nand0.bareboxenv
copy kernel image for boot_tftp_nfs and boot_nand into images folder
bmk kernel_boot_tftp_nfs
Copy kernel into tftp folder
bmk tftpboot_kernel
Copy the ubi image of boot_nand
bmk cp_image_boot_nand
Copy root.ubi into tftp folder
bmk tftpboot_root_ubi
Update kernel and root on target for boot_nand
bmk update_target_boot_nand
cp env into images. Copy the prepared tftpboot files into the images folder
bmk archive_barebox_env
Barebox config files are copied into the real folder tftpboot, which is used by the tftp server. Do it only once. Default settings are to boot from NAND.
bmk cp_barebox_config
Because the config files contain dummy ip addresses, it is important to set the correct ip addresses.
bmk set_ip_barebox_config
Copy env/boot/net-02
and some other files to the target.
bmk cp_init_board
The output of this make command describes how to download files to the target. Follow the instructions.
When barebox is restarted, /env/network/eth0
is used to configure the Ethernet port. When you call
boot net-02
you can boot the board via TFTP and NFS. The file /env/boot/net-02
is executed and loads the file /env/bin/net-03
from the TFTP server. This file is also executed.
Note: It is very important that you copy the init files to the target. Some commands in the makefile are changing the config file in the tftpboot folder on the host.
Adjust boot.default in env/config to boot from TFTP and NFS
bmk tftpboot_config_loc_boot_tftp_nfs
Build BSP with ptxdist
bmk bsp_go
Create images for BSP with ptxdist
bmk bsp_images
copy kernel image for boot_tftp_nfs into images folder
bmk kernel_boot_tftp_nfs
Copy kernel from images into tftp folder
bmk tftpboot_kernel
Copy RootFS Archive of boot_tftp_nfs into images
bmk cp_image_boot_tftp_nfs
Create root file system, which can be mounted via NFS.
bmk create_rootfs_boot_tftp_nfs
Setup NFS, add rootfs to /etc/exports
bmk export_rootfs
exportfs -r
bmk export_refresh
remove fingerprint in .ssh/known_hosts
bmk ssh_fingerprint
Adjust nfsroot in env/config
bmk tftpboot_config
show command for netconsole
bmk netconsole
You have just configured the board to boot via TFTP and NFS. If you want to switch back to booting from NAND, you can use the following command.
Adjust boot.default in env/config to boot from NAND
bmk tftpboot_config_loc_boot_nand
If you want to switch again to booting via TFTP and NFS, you can use again the following command.
Adjust boot.default in env/config to boot from TFTP and NFS
bmk rm_tftpboot_config_loc_boot_tftp_nfs bmk tftpboot_config_loc_boot_tftp_nfs
Check if you have the correct hardware versions:
phyBOARD-WEGA-AM335x with carrier board 1405.0 or 1405.1
HDMI Adapter PEB-AV-01 1406.0 or 1406.1
Eval Module PEB-EVAL-01 1413.0 or 1413.1
By default the board tries to boot from NAND at first. Without any valid bootloader in NAND, the board will try to boot from SD-card next.
You can force the board to try to boot from SD-card at first. This allows you to test the bootloader on the SD-card without changing anything in NAND.
If you have the carrier board 1405.0:
You can force the board to boot from SD-card by connecting X_LCD_D2 (pin 8 at X70) to a high-level (e.g. VCC3V3 – pin13 at X71) during the power-up sequence.
If you have the carrier board 1405.1:
Take off the expansion board PEB-AV-01 or PEB-AV-02. Move the DIP switch to ON, to force booting from SD-card. When you have moved the switch in direction of the SD-card slot, the switch is in position ON.
The description how to boot from SD-card can be found in L-792e_0.pdf on page 77 and in http://www.phytec.de/de/support/faq/faq-phyboard-wega.html.
Connect the board to the host, network and display:
Connect a serial cable (one-to-one) to the DB9 connector on PEB-EVAL-01. Set the speed to 115200 8N1 in your terminal application on the host.
Connect an ethernet cable to the port X16 on the carrier board. This is the ethernet port next to the USB port.
If you want to work with an SD-card, insert the SD-card into carrier board.
You can connect also a display to the HDMI port on PEB-AV-01.
Boot the board again.
Create images for SD-card
bmk \ kernel_01 \ parted_sdcard_01 \ cp_archive_sdcard_01 \ cp_file_sdcard_01
update barebox, kernel and root file system in NAND
bmk \ cp_barebox_boot_nand \ tftpboot_barebox \ update_barebox \ cp_image_boot_nand \ tftpboot_root_ubi \ kernel_boot_tftp_nfs \ tftpboot_kernel \ update_target_boot_nand
update kernel and root file system in NAND
bmk \ cp_image_boot_nand \ tftpboot_root_ubi \ kernel_boot_tftp_nfs \ tftpboot_kernel \ update_target_boot_nand
Prepare tftp config for boot via tftp and nfs
bmk \ archive_barebox_env \ cp_barebox_config \ set_ip_barebox_config \ cp_init_board \ tftpboot_config_loc_boot_tftp_nfs
Prepare kernel and rootfs for boot via TFTP and NFS
bmk \ bsp_go \ bsp_images \ kernel_boot_tftp_nfs \ cp_image_boot_tftp_nfs \ tftpboot_kernel \ create_rootfs_boot_tftp_nfs \ export_rootfs \ export_refresh \ ssh_fingerprint \ tftpboot_config \ netconsole
Switch back to boot from NAND. Adjust boot.default in env/config to boot from NAND
bmk \ tftpboot_config_loc_boot_nand
Switch again to boot via TFTP and NFS. Adjust boot.default in env/config to boot from TFTP and NFS
bmk \ rm_tftpboot_config_loc_boot_tftp_nfs bmk \ tftpboot_config_loc_boot_tftp_nfs
When you want to install the binary images in the internal flash again, you have to remove the make states before you can use the make targets. The additional commands are shown.
This chapter shows how to download the binary images of the bootloader, Linux kernel and the root file system and boot the device in different ways.
Build Phytec Linux BSP, if you have not already done it.Build BSP with ptxdist
bmk rm_bsp_go bmk bsp_go
Create images for BSP with ptxdist
bmk rm_bsp_images bmk bsp_images
Save barebox image, kernel image and device tree in image folder.
Note: You only have to do this again, when the image has been rebuilt.
bmk rm_kernel_01 rm_kernel_boot_tftp_nfs rm_cp_image_boot_tftp_nfs bmk kernel_01
overwrite image area on SD-card with zeros , format SD-card, create binary image
bmk rm_parted_sdcard_01 bmk parted_sdcard_01 cp_archive_sdcard_01 cp_file_sdcard_01
You can update the bootloader in NAND:
by copying the images from SD-Card or
by downloading the images from an TFTP server.
You can copy the images from an SD-card :
after booting from the SD-Card or
after mounting the SD-Card manually.
When you boot from SD-card, the card is already mounted at /boot.
Check which devices are known
devinfo
Check which images are on the SD-card
ls /boot
Output:
MLO barebox.bin barebox.env linuximage
Update x-loader MLO
erase /dev/nand0.xload.bb cp /boot/MLO /dev/nand0.xload.bb
Update barebox
erase /dev/nand0.barebox.bb cp /boot/barebox.bin /dev/nand0.barebox.bb
When the bootloader has changed significantly, it is also necessary to erase the barebox environment:
erase /dev/nand0.bareboxenv
Further information is available in L-775e_3.pdf on page 22.
Insert SD-Card and mount it.
Check which devices are known
devinfo
Mount the SD-card, if it is not already mounted:
mci0.probe=1 ls /mnt mkdir /mnt/disk mount /dev/disk0.0 /mnt/disk
Check which images are on the SD-card
ls /mnt/disk
Output:
MLO barebox.bin linuximage
Update x-loader MLO
erase /dev/nand0.xload.bb cp /mnt/disk/MLO /dev/nand0.xload.bb
Update barebox
erase /dev/nand0.barebox.bb cp /mnt/disk/barebox.bin /dev/nand0.barebox.bb
When the bootloader has changed significantly, it is also necessary to erase the barebox environment:
erase /dev/nand0.bareboxenv
Copy barebox image of boot_nand into images folder
bmk rm_cp_barebox_boot_nand bmk cp_barebox_boot_nand
Copy barebox from images folder into tftp folder
bmk rm_tftpboot_barebox bmk tftpboot_barebox
Update barebox via TFTP
bmk rm_update_barebox bmk update_barebox
copy kernel image for boot_tftp_nfs and boot_nand into images folder
bmk rm_kernel_boot_tftp_nfs bmk kernel_boot_tftp_nfs
Copy kernel into tftp folder
bmk rm_tftpboot_kernel bmk tftpboot_kernel
Copy the ubi image of boot_nand
bmk rm_cp_image_boot_nand bmk cp_image_boot_nand
Copy root.ubi into tftp folder
bmk rm_tftpboot_root_ubi bmk tftpboot_root_ubi
Update kernel and root on target for boot_nand
bmk update_target_boot_nand
Copy env/boot/net-02
and some other files to the target.
bmk rm_cp_init_board bmk cp_init_board
The output of this make command describes how to download files to the target. Follow the instructions.
When barebox is restarted, /env/network/eth0
is used to configure the Ethernet port. When you call
boot net-02
you can boot the board via TFTP and NFS. The file /env/boot/net-02
is executed and loads the file /env/bin/net-03
from the TFTP server. This file is also executed.
Note: It is very important that you copy the init files to the target. Some commands in the makefile are changing the config file in the tftpboot folder on the host.
Adjust boot.default in env/config to boot from TFTP and NFS
bmk rm_tftpboot_config_loc_boot_tftp_nfs bmk tftpboot_config_loc_boot_tftp_nfs
Build BSP with ptxdist
bmk rm_bsp_go bmk bsp_go
Create images for BSP with ptxdist
bmk rm_bsp_images bmk bsp_images
copy kernel image for boot_tftp_nfs into images folder
bmk rm_kernel_boot_tftp_nfs bmk kernel_boot_tftp_nfs
Copy kernel from images into tftp folder
bmk rm_tftpboot_kernel bmk tftpboot_kernel
Copy RootFS Archive of boot_tftp_nfs into images
bmk rm_cp_image_boot_tftp_nfs bmk cp_image_boot_tftp_nfs
Remove root file system, which can be mounted via NFS.
bmk rm_remove_rootfs_boot_tftp_nfs bmk remove_rootfs_boot_tftp_nfs -n bmk remove_rootfs_boot_tftp_nfs
Create root file system, which can be mounted via NFS.
bmk rm_create_rootfs_boot_tftp_nfs bmk create_rootfs_boot_tftp_nfs
exportfs -r
bmk export_refresh
remove fingerprint in .ssh/known_hosts
bmk rm_ssh_fingerprint bmk ssh_fingerprint
show command for netconsole
bmk rm_netconsole bmk netconsole
You have just configured the board to boot via TFTP and NFS. If you want to switch back to booting from NAND, you can use the following command.
Adjust boot.default in env/config to boot from NAND
bmk rm_tftpboot_config_loc_boot_nand bmk tftpboot_config_loc_boot_nand
If you want to switch again to booting via TFTP and NFS, you can use again the following command.
Adjust boot.default in env/config to boot from TFTP and NFS
bmk rm_tftpboot_config_loc_boot_tftp_nfs bmk tftpboot_config_loc_boot_tftp_nfs
Check if you have the correct hardware versions:
phyBOARD-WEGA-AM335x with carrier board 1405.0 or 1405.1
HDMI Adapter PEB-AV-01 1406.0 or 1406.1
Eval Module PEB-EVAL-01 1413.0 or 1413.1
By default the board tries to boot from NAND at first. Without any valid bootloader in NAND, the board will try to boot from SD-card next.
You can force the board to try to boot from SD-card at first. This allows you to test the bootloader on the SD-card without changing anything in NAND.
If you have the carrier board 1405.0:
You can force the board to boot from SD-card by connecting X_LCD_D2 (pin 8 at X70) to a high-level (e.g. VCC3V3 – pin13 at X71) during the power-up sequence.
If you have the carrier board 1405.1:
Take off the expansion board PEB-AV-01 or PEB-AV-02. Move the DIP switch to ON, to force booting from SD-card. When you have moved the switch in direction of the SD-card slot, the switch is in position ON.
The description how to boot from SD-card can be found in L-792e_0.pdf on page 77 and in http://www.phytec.de/de/support/faq/faq-phyboard-wega.html.
Connect the board to the host, network and display:
Connect a serial cable (one-to-one) to the DB9 connector on PEB-EVAL-01. Set the speed to 115200 8N1 in your terminal application on the host.
Connect an ethernet cable to the port X16 on the carrier board. This is the ethernet port next to the USB port.
If you want to work with an SD-card, insert the SD-card into carrier board.
You can connect also a display to the HDMI port on PEB-AV-01.
Boot the board again.
Create images for SD-card
bmk \ rm_bsp_go \ rm_bsp_images \ rm_kernel_01 \ rm_kernel_boot_tftp_nfs \ rm_cp_image_boot_tftp_nfs bmk \ bsp_go \ bsp_images \ kernel_01
bmk \ rm_parted_sdcard_01 bmk \ parted_sdcard_01 \ cp_archive_sdcard_01 \ cp_file_sdcard_01
update barebox, kernel and root file system in NAND
bmk \ rm_cp_barebox_boot_nand \ rm_tftpboot_barebox \ rm_update_barebox \ rm_cp_image_boot_nand \ rm_tftpboot_root_ubi \ rm_kernel_boot_tftp_nfs \ rm_tftpboot_kernel bmk \ cp_barebox_boot_nand \ tftpboot_barebox \ update_barebox \ cp_image_boot_nand \ tftpboot_root_ubi \ kernel_boot_tftp_nfs \ tftpboot_kernel \ update_target_boot_nand
update kernel and root file system in NAND
bmk \ rm_cp_image_boot_nand \ rm_tftpboot_root_ubi \ rm_kernel_boot_tftp_nfs \ rm_tftpboot_kernel bmk \ cp_image_boot_nand \ tftpboot_root_ubi \ kernel_boot_tftp_nfs \ tftpboot_kernel \ update_target_boot_nand
Prepare tftp config for boot via tftp and nfs
bmk \ rm_set_ip_barebox_config \ rm_cp_init_board \ rm_tftpboot_config_loc_boot_tftp_nfs bmk \ set_ip_barebox_config \ cp_init_board \ tftpboot_config_loc_boot_tftp_nfs
Prepare kernel and rootfs for boot via TFTP and NFS
bmk \ rm_bsp_go \ rm_bsp_images \ rm_kernel_boot_tftp_nfs \ rm_cp_image_boot_tftp_nfs \ rm_tftpboot_kernel \ rm_remove_rootfs_boot_tftp_nfs \ rm_create_rootfs_boot_tftp_nfs \ rm_ssh_fingerprint bmk \ bsp_go \ bsp_images \ kernel_boot_tftp_nfs \ cp_image_boot_tftp_nfs \ tftpboot_kernel \ remove_rootfs_boot_tftp_nfs \ create_rootfs_boot_tftp_nfs \ export_refresh \ ssh_fingerprint \ netconsole
Switch back to boot from NAND. Adjust boot.default in env/config to boot from NAND
bmk \ rm_tftpboot_config_loc_boot_nand bmk \ tftpboot_config_loc_boot_nand
Switch again to boot via TFTP and NFS. Adjust boot.default in env/config to boot from TFTP and NFS
bmk \ rm_tftpboot_config_loc_boot_tftp_nfs bmk \ tftpboot_config_loc_boot_tftp_nfs
This is usually used only once, but may be reused: Copy barebox config files into tftp folder and adjust all the settings to boot via TFTP and NFS.
bmk \ rm_cp_barebox_config \ rm_set_ip_barebox_config \ rm_tftpboot_config \ rm_tftpboot_config_loc_boot_tftp_nfs bmk \ cp_barebox_config \ set_ip_barebox_config \ tftpboot_config \ tftpboot_config_loc_boot_tftp_nfs
This is usually used only once, but may be reused: Adjust nfsroot in env/config
bmk \ rm_tftpboot_config bmk \ tftpboot_config
This is usually used only once, but may be reused: Setup NFS, add rootfs to /etc/exports
bmk \ rm_export_rootfs bmk \ export_rootfs
Remove fingerprint in .ssh/known_hosts
bmk rm_ssh_fingerprint bmk ssh_fingerprint
show command for netconsole
bmk netconsole
dmesg over ssh
bmk ssh_dmesg
Create and manage git repositories for the source code of the BSP and its software packages.
If you want to learn more about git, there is a book on git : Pro Git
There are many more make targets in the makefile ${DISTRIB_IN}/install/scripts/pd_src_git.mk
which have not been described so far. You can list most of the make targets with the following command:
bmk | grep git
You can look at the contents of the file ${DISTRIB_IN}/install/scripts/pd_src_git.mk
more ${DISTRIB_IN}/install/scripts/pd_src_git.mk
In this tutorial and the accompanying makefile some specific names are used for the repositories:
A repository is called work, when it is used to checkout and edit the current version of the source code.
A repository is called local, when it is used to save the current state of the source code on your computer. You push your changes from the work repository to the local repository, to save it there. This is a bare repository.
A remote repository is used to create or update the local repository. Usually you don't have write access to the remote repository.
In the following chapters some useful commands are shown.
For the work with repositories of some source code folders you need to define an environment.
Create environment setup file for barebox_work
bmk rm_setup_env_git_barebox_work bmk setup_env_git_barebox_work
The output of this make command describes the usage of the setup-env file. Follow the instructions.
Create environment setup file for linux_work
bmk rm_setup_env_git_linux_work bmk setup_env_git_linux_work
The output of this make command describes the usage of the setup-env file. Follow the instructions.
Create environment setup file for gcc-linaro_work
bmk rm_setup_env_git_gcc-linaro_work bmk setup_env_git_gcc-linaro_work
The output of this make command describes the usage of the setup-env file. Follow the instructions.
Start tools with GUI like git gui
and gitk
.
start git gui or gitk for bsp_local
bmk gui_git_bsp_local
start git gui or gitk for bsp_work
bmk gui_git_bsp_work
start git gui or gitk for ptxdist_local
bmk gui_git_ptxdist_local
start git gui or gitk for ptxdist_work
bmk gui_git_ptxdist_work
start git gui or gitk for barebox_local
bmk gui_git_barebox_local
start git gui or gitk for barebox_work
bmk gui_git_barebox_work
start git gui or gitk for linux_local
bmk gui_git_linux_local
start git gui or gitk for linux_work
bmk gui_git_linux_work
start git gui or gitk for toolchain_local
bmk gui_git_toolchain_local
start git gui or gitk for toolchain_work
bmk gui_git_toolchain_work
start git gui or gitk for gcc-linaro_local
bmk gui_git_gcc-linaro_local
start git gui or gitk for gcc-linaro_work
bmk gui_git_gcc-linaro_work
start git gui or gitk for tftpboot_local
bmk gui_git_tftpboot_local
start git gui or gitk for tftpboot_work
bmk gui_git_tftpboot_work
Show and check current state of the git repositories.
show branches and HEAD of all repositories
bmk show_branch_git
check branch and HEAD of all repositories
bmk check_branch_git
show commit id of release branch
bmk show_release_git
Create environment setup files
bmk \ rm_setup_env_git_barebox_work \ rm_setup_env_git_linux_work \ rm_setup_env_git_gcc-linaro_work bmk \ setup_env_git_barebox_work \ setup_env_git_linux_work \ setup_env_git_gcc-linaro_work
Show and check current state of the git repositories.
bmk \ show_branch_git \ check_branch_git \ show_release_git