UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer peter.kuchnio
Observer
1,754 Views
Registered: ‎11-16-2015

Petalinux 2016.4 /dev/flash

Jump to solution

Hello, we are in the process of migrating from Petalinux 2016.1 to 2016.4

We are using QSPI flash to store our boot and kernel images. I see all of the mtd devices in /dev (e.g. mtdblock0 and so on). 

In 2016.1, we also had a /dev/flash device present. This let us access flash partitions by the partition name (e.g. /dev/flash/boot, /dev/flash/kernel, etc.)

In 2016.4 I no longer see /dev/flash

How do I re-enable it? I need this for my firmware upgrade tool.

0 Kudos
1 Solution

Accepted Solutions
Observer peter.kuchnio
Observer
3,122 Views
Registered: ‎11-16-2015

Re: Petalinux 2016.4 /dev/flash

Jump to solution

In the short term I just used the mtdX devices directly with my firmware upgrade tools. This does work.

 

I just got this answer from Xilinx support. It seems the /dev/flash directory is just a bunch of symlinks. Its somewhat confusing to have 'fake' drivers in /dev in my opinion, but whatever.

 

#!/bin/sh

[ ! -f /proc/mtd ] && echo "/proc/mtd doesn't exist. Will not create /dev/flash/* device nodes" && exit 0

# process mtd entries in /proc, and create symlinks in /dev/flash
echo "Creating /dev/flash/* device nodes"
mkdir -p /dev/flash
rm -f /dev/flash/*

while read line; do
        dev=${line/:*/}
        # skip header line of /proc/mtd
        [ "${dev}" == "dev" ] && continue
        # Extract the partition name, wish there was a one-liner for this
        link=${line##* \"}
        link=${link%%\"}
        # cp -l on devnodes clones the node, not the contents
        # this is what we want
        cp -l /dev/${dev} "/dev/flash/${link}"
done < /proc/mtd
0 Kudos
1 Reply
Observer peter.kuchnio
Observer
3,123 Views
Registered: ‎11-16-2015

Re: Petalinux 2016.4 /dev/flash

Jump to solution

In the short term I just used the mtdX devices directly with my firmware upgrade tools. This does work.

 

I just got this answer from Xilinx support. It seems the /dev/flash directory is just a bunch of symlinks. Its somewhat confusing to have 'fake' drivers in /dev in my opinion, but whatever.

 

#!/bin/sh

[ ! -f /proc/mtd ] && echo "/proc/mtd doesn't exist. Will not create /dev/flash/* device nodes" && exit 0

# process mtd entries in /proc, and create symlinks in /dev/flash
echo "Creating /dev/flash/* device nodes"
mkdir -p /dev/flash
rm -f /dev/flash/*

while read line; do
        dev=${line/:*/}
        # skip header line of /proc/mtd
        [ "${dev}" == "dev" ] && continue
        # Extract the partition name, wish there was a one-liner for this
        link=${line##* \"}
        link=${link%%\"}
        # cp -l on devnodes clones the node, not the contents
        # this is what we want
        cp -l /dev/${dev} "/dev/flash/${link}"
done < /proc/mtd
0 Kudos