Skip to main content
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

In my initramfs.cpio I have only these directories:

root@localhost extract]# ls 
dev  init  tmp sys 

dev has console and sys is empty.

init is a binary corresponding to program that I discussed in Accessing GPIO after kernel bootsAccessing GPIO after kernel boots.

Now in the same GPIO program I would like to write code to mount a /sys. I understand it can be mounted using mount:

mount -t sysfs none /sys

How do I write a C program that will implement the above line. Please note that I do not have a file system; initramfs.cpio has empty folders: /sys, /tmp. I can put more empty folder if required. But I cannot put full file system.

My main intention To access GPIO using this programprogram or otherwise, but without using a full file system. I dont need any other thing to run, but just want GPIO access (and LED blink)

In my initramfs.cpio I have only these directories:

root@localhost extract]# ls 
dev  init  tmp sys 

dev has console and sys is empty.

init is a binary corresponding to program that I discussed in Accessing GPIO after kernel boots.

Now in the same GPIO program I would like to write code to mount a /sys. I understand it can be mounted using mount:

mount -t sysfs none /sys

How do I write a C program that will implement the above line. Please note that I do not have a file system; initramfs.cpio has empty folders: /sys, /tmp. I can put more empty folder if required. But I cannot put full file system.

My main intention To access GPIO using this program or otherwise, but without using a full file system. I dont need any other thing to run, but just want GPIO access (and LED blink)

In my initramfs.cpio I have only these directories:

root@localhost extract]# ls 
dev  init  tmp sys 

dev has console and sys is empty.

init is a binary corresponding to program that I discussed in Accessing GPIO after kernel boots.

Now in the same GPIO program I would like to write code to mount a /sys. I understand it can be mounted using mount:

mount -t sysfs none /sys

How do I write a C program that will implement the above line. Please note that I do not have a file system; initramfs.cpio has empty folders: /sys, /tmp. I can put more empty folder if required. But I cannot put full file system.

My main intention To access GPIO using this program or otherwise, but without using a full file system. I dont need any other thing to run, but just want GPIO access (and LED blink)

Post Deleted by CommunityBot
Post Locked by CommunityBot
Post Migrated Away to stackoverflow.com by Gilles 'SO- stop being evil', slm, jasonwryan, manatwork, Anthon
Post Closed as "Not suitable for this site" by Gilles 'SO- stop being evil', slm, jasonwryan, manatwork, Anthon
Source Link
user2799508
  • 1.7k
  • 9
  • 29
  • 46

Mounting a file system using a C program

In my initramfs.cpio I have only these directories:

root@localhost extract]# ls 
dev  init  tmp sys 

dev has console and sys is empty.

init is a binary corresponding to program that I discussed in Accessing GPIO after kernel boots.

Now in the same GPIO program I would like to write code to mount a /sys. I understand it can be mounted using mount:

mount -t sysfs none /sys

How do I write a C program that will implement the above line. Please note that I do not have a file system; initramfs.cpio has empty folders: /sys, /tmp. I can put more empty folder if required. But I cannot put full file system.

My main intention To access GPIO using this program or otherwise, but without using a full file system. I dont need any other thing to run, but just want GPIO access (and LED blink)