How to make device-files static in nfsroot

we are using beaglebone black based custom board,

We have programming station[desktop PC just naming it] where we have configured tftpboot and nfsroot(network rfs).
And Last init script( programming init script in /etc/init.d/ folder) flashes freshly manufactured board.

Programming script does following steps,

  1. Partition emmc(using parted)
  2. format partitions
  3. Write bootloader, kernel and root file system.

nfsroot folder contains all static device files under /dev/ folder with respect to partitions structure. i.e. it contains /dev/mmcblk0, /dev/mmcblk0p1, /dev/mmcblk0p2 .. etc.

when we observed the directory /dev/ during partitioning process of emmc we see that /dev/mmcblk0p1, /dev/mmcblk0p2 .. gets deleted and after partitioning is done device files are created again.

This all works fine when we are flashing one device on that programming station.

However this fails when try flashing multiple devices on the programming station, reason being when one device’s emmc is being partitioned other device’s emmc’s partitions are being formatted one by one.

Sometimes second device doesn’t find device file(e.g. /dev/mmbclk0p15) it is looking at while formatting the partition, So programming fails.

so my question is, is there anyway to prevent deletion of the device file when emmc is being partitioned ? is there a kernel configuration which stops device file creation/deletion ?

Any other suggestion/pointers?

so my question is, is there anyway to prevent deletion of the device file when
emmc is being partitioned ? is there a kernel configuration which stops device
file creation/deletion ?

Play with your udev rules.

Any other suggestion/pointers?

You could go "old school":

Disable udev and use mknod to create static device entries in /dev (or
leave udev enabled and put your device nodes somewhere else like
/mydev). You can also name them whatever you want (perhaps rootfs,
data, or similar), the existing names are just a convention.

This can be cumbersome (and potentially quite confusing) in a dynamic
environment, but if you're just running an automated programming
script you should be fine.

Hi Charles,

Thank you for reply,
I was on vacation so I couldn’t reply this, apologies for the same

We are using mdev

We have statically created the device files under /dev directory but they get deleted when parted partitions the emmc.

Let me try it with mdev disabled and see if that helps.

Thank you,

Regards,
Ankur

Hi Charles,

I seems your solution is working.
I don’t see device file being deleted when mdev daemon is not running.
Only thing pending is testing with multiple device, however I am confident that it would work fine.

Thank you,

Regards,
Ankur