LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-13-2020, 11:36 AM   #1
ZH_Y
LQ Newbie
 
Registered: Feb 2020
Posts: 4

Rep: Reputation: Disabled
Board: i.MX6Q Uboot:2019-04 kernel:4.1.15 My file system was built with buildroot-2019.02.9 and works fine on the board.I added the init sc


Board: i.MX6Q
Uboot:2019-04
kernel:4.1.15

My file system was built with buildroot-2019.02.9 and works fine on the board.I added the init script file under /, which is as follows:
Code:
#!/bin/sh
echo "sleep 10s"
sleep 10
echo "finished sleep"
echo "current pid is $$"
Use the following command for cpio packaging.
Code:
find . | cpio --create --format='newc' | gzip > ../ramdisk.img
mkimage -A arm -O linux -T ramdisk -C none -a 0x12c00000 -n "Label you want" -d ./ramdisk.img ./uramdisk.img
On the uboot command line, type the following command, copy the initramfs of the usb disk into the DDR, and start the kernel
Code:
Hit any key to stop autoboot:  0
=> usb start;fatload usb 0 0x12c00000 uramdisk.img;fatload mmc 3:1 0x12000000 zImage;fatload mmc 3:1 0x18000000 topeet_9.7inch.dtb;run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};
starting USB...
USB0:   Port not available.
USB1:   USB EHCI 1.00
scanning bus 1 for devices... 4 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
2036176 bytes read in 174 ms (11.2 MiB/s)
8306792 bytes read in 235 ms (33.7 MiB/s)
46349 bytes read in 15 ms (2.9 MiB/s)
Kernel image @ 0x12000000 [ 0x000000 - 0x7ec068 ]
## Loading init Ramdisk from Legacy Image at 12c00000 ...
   Image Name:   Label you want
   Image Type:   ARM Linux RAMDisk Image (uncompressed)
   Data Size:    2036112 Bytes = 1.9 MiB
   Load Address: 12c00000
   Entry Point:  12c00000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 18000000
   Booting using the fdt blob at 0x18000000
   Using Device Tree in place at 18000000, end 1800e50c

Starting kernel ...
After starting initramfs, I found that my /init file was not executed and the process in pid = 1 was {linuxrc} init.According to the busybox documentation, when the kernel goes into initramfs, it calls the /init file first with PID = 1,and can then use switch_root for system switching. But that's not what my board looks like. What's the problem?
Quote:
Starting syslogd: OK
Starting klogd: OK
Starting mdev...
modprobe: can't change directory to '/lib/modules': No such file or directory
Initializing random number generator... random: dd urandom read with 16 bits of entropy available
done.
Starting network: OK
# top
Mem: 79348K used, 1982272K free, 4168K shrd, 0K buff, 4168K cached
CPU: 0% usr 2% sys 0% nic 97% idle 0% io 0% irq 0% sirq
Load average: 0.07 0.02 0.01 1/86 240
PID PPID USER STAT VSZ %VSZ %CPU COMMAND
240 233 root R 2164 0% 2% top
233 1 root S 2268 0% 0% -/bin/sh
1 0 root S 2164 0% 0% {linuxrc} init
205 1 root S 2164 0% 0% /sbin/syslogd -n
209 1 root S 2164 0% 0% /sbin/klogd -n
87 2 root SW 0 0% 0% [kworker/1:1]
6 2 root SW 0 0% 0% [kworker/u8:0]
90 2 root SW 0 0% 0% [kworker/u8:1]
24 2 root SW 0 0% 0% [kdevtmpfs]
88 2 root SW 0 0% 0% [scsi_eh_0]
2 0 root SW 0 0% 0% [kthreadd]
3 2 root SW 0 0% 0% [ksoftirqd/0]
4 2 root SW 0 0% 0% [kworker/0:0]
5 2 root SW< 0 0% 0% [kworker/0:0H]
7 2 root SW 0 0% 0% [rcu_preempt]
8 2 root SW 0 0% 0% [rcu_sched]
9 2 root SW 0 0% 0% [rcu_bh]
10 2 root SW 0 0% 0% [migration/0]
11 2 root SW 0 0% 0% [migration/1]
12 2 root SW 0 0% 0% [ksoftirqd/1]
# pwd
/
# cat init
#!/bin/sh
echo "sleep 10s"
sleep 10
echo "finished sleep"
echo "current pid is $$"

# ls
bin init linuxrc opt run tmp
dev lib media proc sbin usr
etc lib32 mnt root sys var
# echo $$
233
#
 
Old 02-14-2020, 09:34 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,455
Blog Entries: 13

Rep: Reputation: 3773Reputation: 3773Reputation: 3773Reputation: 3773Reputation: 3773Reputation: 3773Reputation: 3773Reputation: 3773Reputation: 3773Reputation: 3773Reputation: 3773
Just because you have a file in the root directory titled "init" does not mean that it will be run. What gave you that impression?

Figure out if you're systemd or sysv init and run your script at startup the correct way.
 
1 members found this post helpful.
Old 02-15-2020, 08:33 AM   #3
ZH_Y
LQ Newbie
 
Registered: Feb 2020
Posts: 4

Original Poster
Rep: Reputation: Disabled
I have solved the problem

Quote:
Originally Posted by rtmistler View Post
Just because you have a file in the root directory titled "init" does not mean that it will be run. What gave you that impression?

Figure out if you're systemd or sysv init and run your script at startup the correct way.
Thank you for your reply.I have just solved this problem. The problem is that there is a rdinit=linuxrc in the parameter passed to the kernel by uboot, which causes the init process in initramfs to not execute properly.

Last edited by ZH_Y; 02-15-2020 at 08:35 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Install php5 & nginx server via buildroot for imx53 target board pillisrikanth Linux - Software 0 01-31-2014 03:44 PM
What is the exact diff between init 1,init S and init s challavijay Linux - Newbie 1 08-05-2010 07:51 AM
Buildroot halts for kernel config file of board parag_opensrc Linux - Embedded & Single-board computer 1 11-17-2009 11:54 AM
Help: Added HDD gives no added free space? LouArnold Linux - Hardware 5 10-12-2009 12:27 PM
Buildroot for at91sam9263 board parag_opensrc Linux - Embedded & Single-board computer 0 09-19-2009 02:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration