Changes

Jump to: navigation, search

AXEL ULite and SBC Lynx Embedded Linux Kit (XUELK)

2,147 bytes added, 09:38, 15 March 2017
How to create a bootable microSD card
It is worth remembering that the microSD card is [[Booting_options_(SBC_Lynx)|bootable]], because U-Boot image is stored at address 0x400. However, even if U-Boot is run from the microSD card, '''the environment is retrieved from NOR flash'''.
====How to create a bootable microSD card====
TBDThe following script can be used to create a bootable microSD card. Is has been tested with 16 GB microSD cards. In case you have a different size, you'll need to change the <code>sfdisk</code> parameters accordingly. The resulting card is partitioned as depicted in the previous section.<pre>#!/bin/bash if [[ -z $1 || -z $2 || -z $3 || -z $4 ]]then echo "$0 Usage:" echo " $0 <device> <u-boot.imx> <binaries directory> <rootfs tar.bz2>" echo " Example: $0 /dev/sdc u-boot.imx binaries/ rootfs.tar.bz2" exitfi if [ "$(whoami)" != "root" ]then echo "you must be root to run this script!" exitfi if ! [[ -b $1 ]]then echo "$1 is not a valid block device!" exitfi if ! [[ -e $2 ]]then echo "Incorrect u-boot.imx location!" exitfi if ! [[ -d $3 ]]then echo "Incorrect Binaries location!" exitfi if ! [[ -f $4 ]]then echo "Incorrect rootfs location!" exitfi DRIVE=$1if [[ "$DRIVE" == *"mmcblk"* ]]then echo "You're using a mmc device, I need to fix partition names" PART="p"else PART=""fiUBOOT=$2BINARIES=$3RFS=$4 echo "All data on "$DRIVE" now will be destroyed! Continue? [y/n]"read ansif ! [ $ans == 'y' ]then exitfi echo "[Partitioning $1...]" dd if=/dev/zero of=$DRIVE bs=1024 count=1024 SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'` echo DISK SIZE - $SIZE bytes CYLINDERS=`echo $SIZE/255/63/512 | bc` { echo 10,1380,0x0c,* echo 1390,,83,-} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVEsudo partprobe echo "[Making filesystems...]"mkfs.vfat -F 32 -n BOOT "$DRIVE$PART"1 #> /dev/nullmkfs.ext3 -L ROOTFS "$DRIVE$PART"2 #> /dev/null echo "[Copying files...]" binaries_dir=${BINARIES%/}mount "$DRIVE$PART"1 /mntcp -av --no-preserve=ownership $binaries_dir/* /mnt/umount "$DRIVE$PART"1 echo "[Extracting rfs (this may take a while...)]"mount "$DRIVE$PART"2 /mnttar jxf $RFS -C /mnt > /dev/nullchmod 755 /mntumount "$DRIVE$PART"2 echo "[Programming u-boot.imx]"dd if=$UBOOT of=$DRIVE bs=1k seek=1 echo "[Done]"</pre> Here is an example that shows how to use this script to program a bootable microSD card, containing the binaries delivered along with the XUELK 1.1.3.
=== XUELK updates ===
4,650
edits

Navigation menu