Make nl to enumerate from a specified line - bash

I intent to enumerate the files and dirs
[root#iz2ze9wve43n2nyuvmsfx5z /]# ls -lh |nl
1 total 60K
2 lrwxrwxrwx 1 root root 7 Jun 15 22:08 bin -> usr/bin
3 dr-xr-xr-x. 5 root root 4.0K Jun 15 22:10 boot
4 drwxr-xr-x 19 root root 2.9K Sep 17 11:35 dev
5 drwxr-xr-x. 85 root root 4.0K Sep 18 22:44 etc
6 drwxr-xr-x. 2 root root 4.0K Sep 17 08:25 home
7 lrwxrwxrwx 1 root root 7 Jun 15 22:08 lib -> usr/lib
8 lrwxrwxrwx 1 root root 9 Jun 15 22:08 lib64 -> usr/lib64
9 drwx------. 2 root root 16K Oct 15 2017 lost+found
10 drwxr-xr-x. 2 root root 4.0K Apr 11 2018 media
11 drwxr-xr-x. 2 root root 4.0K Apr 11 2018 mnt
12 drwxr-xr-x. 2 root root 4.0K Apr 11 2018 opt
13 dr-xr-xr-x 86 root root 0 Sep 17 11:35 proc
14 drwxrwxrwx. 21 root root 4.0K Oct 22 08:11 root
15 drwxr-xr-x 24 root root 660 Oct 24 19:10 run
16 lrwxrwxrwx 1 root root 8 Jun 15 22:08 sbin -> usr/sbin
17 drwxr-xr-x. 2 root root 4.0K Apr 11 2018 srv
18 dr-xr-xr-x 13 root root 0 Oct 21 19:50 sys
19 drwxrwxrwt. 11 root root 4.0K Oct 24 05:19 tmp
20 drwxr-xr-x. 13 root root 4.0K Jun 15 22:08 usr
21 drwxr-xr-x. 19 root root 4.0K Jun 15 22:08 var
It starts with 1 which I desire is 0.
How could make nl to enumerate from a specified line.

You just need to use the -v option, and specify to start from 0; your instruction becoming:
ls -lh |nl -v 0

Lets have a look at nl --help:
$ nl --help
Usage: nl [OPTION]... [FILE]...
Write each FILE to standard output, with line numbers added.
With no FILE, or when FILE is -, read standard input.
Mandatory arguments to long options are mandatory for short options too.
...
-v, --starting-line-number=NUMBER first line number for each section
Therefore:
$ nl -v0 <<EOF
> a
> b
> EOF
0 a
1 b
Note that it does not really matter whether you want to enumerate directories or anything else, which is why you probably should strip this part from your question to make it more specific.

Related

Linux command du returns different size when the same content is, either an image mount to the file system, or under a directory of it

I have a qcow2 image which I have converted to raw format, and then mount to my file system:
# qemu-img convert -O raw initial-image.qcow2 raw-image.img
# kpartx -av raw-image.img
add map loop0p1 (253:1): 0 41940992 linear /dev/loop0 2048
# mount /dev/mapper/loop0p1 ~/myImage
# ls ~/myImage
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
The size of ~/myImage mountpoint is checked with du command as follows:
# du -hx --max-depth=1 ~/myImage/
0 /root/myImage/dev
0 /root/myImage/proc
0 /root/myImage/run
0 /root/myImage/sys
36M /root/myImage/etc
40K /root/myImage/root
53M /root/myImage/var
12K /root/myImage/tmp
834M /root/myImage/usr
89M /root/myImage/boot
0 /root/myImage/home
0 /root/myImage/media
0 /root/myImage/mnt
0 /root/myImage/opt
0 /root/myImage/srv
1012M /root/myImage/
At this point I copied the contents of ~/myImage and pasted them inside ~/myImage-copy directory. Then I checked the size of the newly created directory. I expected the exact same size for each directory between ~/myImage and ~/myImage-copy, but it's not:
# cp -R myImage/ ~/myImage-copy
# du -hx --max-depth=1 ~/myImage-copy/
0 /root/myImage-copy/dev
0 /root/myImage-copy/proc
0 /root/myImage-copy/run
0 /root/myImage-copy/sys
36M /root/myImage-copy/etc
40K /root/myImage-copy/root
63M /root/myImage-copy/var
12K /root/myImage-copy/tmp
862M /root/myImage-copy/usr
89M /root/myImage-copy/boot
0 /root/myImage-copy/home
0 /root/myImage-copy/media
0 /root/myImage-copy/mnt
0 /root/myImage-copy/opt
0 /root/myImage-copy/srv
1.1G /root/myImage-copy/
From the paths above with different size, I chose /usr and I followed a branch of it until I conclude to an innermost directory which has different size, in order to inspect its files. Below is shown the size difference of an innermost directory:
# du -hx --max-depth=1 ~/myImage/usr/lib64/python2.7/json/
112K /root/myImage/usr/lib64/python2.7/json/
# du -hx --max-depth=1 ~/myImage-copy/usr/lib64/python2.7/json/
164K /root/myImage-copy/usr/lib64/python2.7/json/
However, by inspecting their file content, I can't see any difference related to their size. I don't know if the second column plays a role:
# ls -lah ~/myImage/usr/lib64/python2.7/json/
total 200K
drwxr-xr-x. 2 root root 280 Feb 3 11:17 .
drwxr-xr-x. 26 root root 20K Feb 3 11:17 ..
-rw-r--r--. 1 root root 14K Aug 13 2020 decoder.py
-rw-r--r--. 2 root root 12K Aug 13 2020 decoder.pyc
-rw-r--r--. 2 root root 12K Aug 13 2020 decoder.pyo
-rw-r--r--. 1 root root 17K Aug 13 2020 encoder.py
-rw-r--r--. 2 root root 14K Aug 13 2020 encoder.pyc
-rw-r--r--. 2 root root 14K Aug 13 2020 encoder.pyo
-rw-r--r--. 1 root root 15K Aug 13 2020 __init__.py
-rw-r--r--. 2 root root 14K Aug 13 2020 __init__.pyc
-rw-r--r--. 2 root root 14K Aug 13 2020 __init__.pyo
-rw-r--r--. 1 root root 2.3K Aug 13 2020 scanner.py
-rw-r--r--. 2 root root 2.2K Aug 13 2020 scanner.pyc
-rw-r--r--. 2 root root 2.2K Aug 13 2020 scanner.pyo
-rw-r--r--. 1 root root 997 Aug 13 2020 tool.py
-rw-r--r--. 2 root root 1.3K Aug 13 2020 tool.pyc
-rw-r--r--. 2 root root 1.3K Aug 13 2020 tool.pyo
# ls -lah ~/myImage-copy/usr/lib64/python2.7/json/
total 200K
drwxr-xr-x 2 root root 280 Mar 4 17:55 .
drwxr-xr-x 26 root root 20K Mar 4 17:55 ..
-rw-r--r-- 1 root root 14K Mar 4 17:55 decoder.py
-rw-r--r-- 1 root root 12K Mar 4 17:55 decoder.pyc
-rw-r--r-- 1 root root 12K Mar 4 17:55 decoder.pyo
-rw-r--r-- 1 root root 17K Mar 4 17:55 encoder.py
-rw-r--r-- 1 root root 14K Mar 4 17:55 encoder.pyc
-rw-r--r-- 1 root root 14K Mar 4 17:55 encoder.pyo
-rw-r--r-- 1 root root 15K Mar 4 17:55 __init__.py
-rw-r--r-- 1 root root 14K Mar 4 17:55 __init__.pyc
-rw-r--r-- 1 root root 14K Mar 4 17:55 __init__.pyo
-rw-r--r-- 1 root root 2.3K Mar 4 17:55 scanner.py
-rw-r--r-- 1 root root 2.2K Mar 4 17:55 scanner.pyc
-rw-r--r-- 1 root root 2.2K Mar 4 17:55 scanner.pyo
-rw-r--r-- 1 root root 997 Mar 4 17:55 tool.py
-rw-r--r-- 1 root root 1.3K Mar 4 17:55 tool.pyc
-rw-r--r-- 1 root root 1.3K Mar 4 17:55 tool.pyo
In addition, I checked the md5 hash of the files above as a view of their content. It seems there is no content differences between the same files:
# md5sum ~/myImage/usr/lib64/python2.7/json/*
598c681c82c582ca3f17950b4d5413c1 /root/myImage/usr/lib64/python2.7/json/decoder.py
939055a9fdfbbe6ab4d4babeb3ae63f5 /root/myImage/usr/lib64/python2.7/json/decoder.pyc
939055a9fdfbbe6ab4d4babeb3ae63f5 /root/myImage/usr/lib64/python2.7/json/decoder.pyo
007a9954ca6641b29564a0f0cb55096b /root/myImage/usr/lib64/python2.7/json/encoder.py
366d44efbfce1e5b4a3397b15f202765 /root/myImage/usr/lib64/python2.7/json/encoder.pyc
366d44efbfce1e5b4a3397b15f202765 /root/myImage/usr/lib64/python2.7/json/encoder.pyo
dd5db0c7fb7c531be4e14feebbdb52e8 /root/myImage/usr/lib64/python2.7/json/__init__.py
791c8dca2a86ce50ead04e918a17b508 /root/myImage/usr/lib64/python2.7/json/__init__.pyc
791c8dca2a86ce50ead04e918a17b508 /root/myImage/usr/lib64/python2.7/json/__init__.pyo
8d6660f10863f99ffdd9a95eeddd7b64 /root/myImage/usr/lib64/python2.7/json/scanner.py
59865f486b742aea959693c04cfce057 /root/myImage/usr/lib64/python2.7/json/scanner.pyc
59865f486b742aea959693c04cfce057 /root/myImage/usr/lib64/python2.7/json/scanner.pyo
ad879e2ba247d3d4a5cc71fe22db91d0 /root/myImage/usr/lib64/python2.7/json/tool.py
af6b5531a8bc6977bca14e8d34ba8f68 /root/myImage/usr/lib64/python2.7/json/tool.pyc
af6b5531a8bc6977bca14e8d34ba8f68 /root/myImage/usr/lib64/python2.7/json/tool.pyo
# md5sum ~/myImage-copy/usr/lib64/python2.7/json/*
598c681c82c582ca3f17950b4d5413c1 /root/myImage-copy/usr/lib64/python2.7/json/decoder.py
939055a9fdfbbe6ab4d4babeb3ae63f5 /root/myImage-copy/usr/lib64/python2.7/json/decoder.pyc
939055a9fdfbbe6ab4d4babeb3ae63f5 /root/myImage-copy/usr/lib64/python2.7/json/decoder.pyo
007a9954ca6641b29564a0f0cb55096b /root/myImage-copy/usr/lib64/python2.7/json/encoder.py
366d44efbfce1e5b4a3397b15f202765 /root/myImage-copy/usr/lib64/python2.7/json/encoder.pyc
366d44efbfce1e5b4a3397b15f202765 /root/myImage-copy/usr/lib64/python2.7/json/encoder.pyo
dd5db0c7fb7c531be4e14feebbdb52e8 /root/myImage-copy/usr/lib64/python2.7/json/__init__.py
791c8dca2a86ce50ead04e918a17b508 /root/myImage-copy/usr/lib64/python2.7/json/__init__.pyc
791c8dca2a86ce50ead04e918a17b508 /root/myImage-copy/usr/lib64/python2.7/json/__init__.pyo
8d6660f10863f99ffdd9a95eeddd7b64 /root/myImage-copy/usr/lib64/python2.7/json/scanner.py
59865f486b742aea959693c04cfce057 /root/myImage-copy/usr/lib64/python2.7/json/scanner.pyc
59865f486b742aea959693c04cfce057 /root/myImage-copy/usr/lib64/python2.7/json/scanner.pyo
ad879e2ba247d3d4a5cc71fe22db91d0 /root/myImage-copy/usr/lib64/python2.7/json/tool.py
af6b5531a8bc6977bca14e8d34ba8f68 /root/myImage-copy/usr/lib64/python2.7/json/tool.pyc
af6b5531a8bc6977bca14e8d34ba8f68 /root/myImage-copy/usr/lib64/python2.7/json/tool.pyo
So, what is the reason behind the size difference of the same content in du output?
My operating system is CentOS Linux release 7.9.2009.

How to debug unexpected OpenBMC hwmon AST2600 behavior?

I am debugging a pwmtachtool<->hwmon interaction problem, observed when OpenBMC image is running
on an AST2600 EVB, which is connected to a SensorsBoard and a Fan (Host is not connected).
The running OpenBMC image was built using bitbake, and it includes recipes-phosphor/configuration/entity-manager/SensorBoard.json,
customized for this SensorBoard. Verified that I2C sensors on the SensorsBoard are accessible via i2ctools,
and behave as expected. However, running "pwmtachtool <dev_id> --get-fan-speed <fan_num>" consistently
reports "Fan speed is 0", even though phy Fan is properly connected.
For example:
/usr/local/bin/pwmtachtool 0 --get-fan-speed 0 --verbose
GET_TACH_SPEED:rpm value 0
Fan 0 speed is 0
cat /sys/class/hwmon/hwmon0/fan0_input
0
Looking closely at the pwmtachtool codepath, I am seeing that it calls pwmtach_action(), which reads
"/sys/class/hwmon/hwmon<dev_id>/fan", which is always 0. Tried all <dev_id>/ combinations,
exposed by sysfs: same result. So far, unable to figure out why this is so.
I would really appreciate all recommendations for how to debug this problem.
Additional details:
ll /sys/class/hwmon/
lrwxrwxrwx 1 root root 0 Feb 16 08:52 hwmon0 -> ../../devices/platform/ahb/ahb:apb/1e610000.pwm-tacho-controller/hwmon/hwmon0
lrwxrwxrwx 1 root root 0 Feb 16 08:52 hwmon1 -> ../../devices/platform/iio-hwmon/hwmon/hwmon1
lrwxrwxrwx 1 root root 0 Feb 26 22:20 hwmon2 -> ../../devices/platform/ahb/ahb:apb/ahb:apb:bus#1e78a000/1e78a480.i2c-bus/i2c-8/8-004d/hwmon/hwmon2
ll /sys/class/hwmon/hwmon0/*
lrwxrwxrwx 1 root root 0 Feb 26 22:20 /sys/class/hwmon/hwmon0/device -> ../../../1e610000.pwm-tacho-controller
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan0_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan10_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan11_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan12_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan13_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan14_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan15_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan1_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan2_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan3_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan4_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan5_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan6_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan7_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan8_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/fan9_input
-r--r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/name
lrwxrwxrwx 1 root root 0 Feb 26 22:20 /sys/class/hwmon/hwmon0/of_node -> ../../../../../../../firmware/devicetree/base/ahb/apb/pwm-tacho-controller#1e610000
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm0
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm1
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm10
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm11
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm12
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm13
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm14
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm15
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm2
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm3
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm4
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm5
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm6
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm7
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm8
-rw-r--r-- 1 root root 4096 Feb 26 22:20 /sys/class/hwmon/hwmon0/pwm9
lrwxrwxrwx 1 root root 0 Feb 16 08:52 /sys/class/hwmon/hwmon0/subsystem -> ../../../../../../../class/hwmon
-rw-r--r-- 1 root root 4096 Feb 16 08:52 /sys/class/hwmon/hwmon0/uevent
In my case, the problem was because of J80 jumper connected PWM and TACH lines. So, when I removed it pwmtachtool started to work as expected.

Extract lines with duplicate last field

Based on a list generated with the command
find '/patch' -name A* -exec ls -la {} \;
Get only a list with file names that appears more than once (duplicated), but I want display the full line not only the file name.
File name consider only the name of file not the full path.
Example
Based on this file:
-rw-r--r-- 1 root root 34K Jan 9 2014 /usr/share/dia/sheets/AADL.sheet
-rw-r--r-- 1 root root 952 Fev 14 07:07 /usr/share/postgresql/9.3/man/man7/ABORT.7.gz
-rw-r--r-- 1 root root 955 Jul 30 2014 /usr/share/postgresql/9.1/man/man7/ABORT.7.gz
-rw-r--r-- 1 root root 92K Abr 28 2014 /usr/share/gettext/ABOUT-NLS
-rw-r--r-- 1 root root 545 Dez 14 2013 /usr/share/dia/sheets/Automata.sheet
-rw-r--r-- 1 root root 6,7K Dez 21 2012 /usr/share/perl5/Mail/Address.pm
-rw-r--r-- 1 root root 709 Mar 3 09:03 /home/test/Address.pm
-rw-r--r-- 1 root root 709 Mar 3 11:13 /home/test/Automata.sheet
-rw-r--r-- 1 root root 520 Mar 3 11:15 /home/test/t2/Address.pm
I want get this result:
-rw-r--r-- 1 root root 952 Fev 14 07:07 /usr/share/postgresql/9.3/man/man7/ABORT.7.gz
-rw-r--r-- 1 root root 955 Jul 30 2014 /usr/share/postgresql/9.1/man/man7/ABORT.7.gz
-rw-r--r-- 1 root root 6,7K Dez 21 2012 /usr/share/perl5/Mail/Address.pm
-rw-r--r-- 1 root root 709 Mar 3 09:03 /home/test/Address.pm
-rw-r--r-- 1 root root 520 Mar 3 11:15 /home/test/t2/Address.pm
-rw-r--r-- 1 root root 545 Dez 14 2013 /usr/share/dia/sheets/Automata.sheet
-rw-r--r-- 1 root root 709 Mar 3 11:13 /home/test/Automata.sheet
Using this commands
awk -F. '{ n = split($0, a, "/"); print a[n] }' file |sort | uniq -d > filedups
I got
ABORT.7.gz
Address.pm
Automata.sheet
and after
grep -f filedups file
I get expected result.
My question:
Is there a direct way to do this in just one line using awk and/or other commands?
awk to the rescue!
starting with your initial file
$ awk '{n=split($NF,a,"/"); k=a[n]; c[k]++;
v[k]=k in v?v[k] ORS $0:$0}
END {for(k in c) if(c[k]>1) print v[k]}' file
-rw-r--r-- 1 root root 6,7K Dez 21 2012 /usr/share/perl5/Mail/Address.pm
-rw-r--r-- 1 root root 709 Mar 3 09:03 /home/test/Address.pm
-rw-r--r-- 1 root root 520 Mar 3 11:15 /home/test/t2/Address.pm
-rw-r--r-- 1 root root 545 Dez 14 2013 /usr/share/dia/sheets/Automata.sheet
-rw-r--r-- 1 root root 709 Mar 3 11:13 /home/test/Automata.sheet
-rw-r--r-- 1 root root 952 Fev 14 07:07 /usr/share/postgresql/9.3/man/man7/ABORT.7.gz
-rw-r--r-- 1 root root 955 Jul 30 2014 /usr/share/postgresql/9.1/man/man7/ABORT.7.gz

Symfony2 : can't duplicate site because of strange folders architecture

I have to retrieve an existing symfony2 (2.1.13) project from prod server in order to run it locally to make some changes. The problem is the architecture seems to be a little bit strange. Please have a look on it :
$pwd
/var/www/html/sites/www.mysite.com
drwxr-xr-x 2 ... 4.0K Jun 30 09:30 backups/
drwxr-x--- 2 ... 6 Mar 15 2013 cgi-bin/
drwxr-xr-x 4 ... 41 Aug 10 18:09 _copie1/
drwxr-xr-x 2 ... 6 Apr 25 2014 log/
drwxr-xr-x 12 ... 4.0K Aug 11 15:41 releases/
drwxr-xr-x 7 ... 146 May 12 16:46 repo/
drwxr-xr-x 5 ... 85 May 12 16:49 shared/
lrwxrwxrwx 1 ... 58 Jul 6 15:11 current -> /var/www/html/sites/www.mysite.com/releases/201508/
lrwxrwxrwx 1 ... 12 Mar 28 2013 html -> current/web//
-rw-r--r-- 1 ... 1022 Jul 6 15:11 revisions.log
current/
drwxr-xr-x 6 ... 4.0K Jul 6 15:09 app/
drwxr-xr-x 2 ... 124 Jul 6 15:05 bin/
drwxr-xr-x 4 ... 50 Aug 11 14:54 src/
drwxr-xr-x 35 ... 4.0K Aug 11 12:08 vendor/
drwxr-xr-x 5 ... 4.0K Aug 11 18:28 web/
-rw-r--r-- 1 ... 626 Jul 6 15:05 Capfile
-rw-r--r-- 1 ... 4.1K Jul 6 15:05 composer.json
-rw-r--r-- 1 ... 167K Jul 6 15:05 composer.lock
-rw-r--r-- 1 ... 216 Jul 6 15:05 Gemfile
-rw-r--r-- 1 ... 1.2K Jul 6 15:05 Gemfile.lock
-rw-r--r-- 1 ... 1.1K Jul 6 15:05 LICENSE
-rw-r--r-- 1 ... 1.6K Jul 6 15:05 README.md
-rw-r--r-- 1 ... 8 Jul 6 15:06 REVISION
-rw-r--r-- 1 ... 7.7K Jul 6 15:05 UPGRADE.md
-rw-r--r-- 1 ... 7 Jul 6 15:05 VERSION
current/web/
drwxr-xr-x 2 ... 4.0K Aug 11 12:10 bundles/
drwxr-xr-x 4 ... 4.0K Jul 6 15:11 compiled/
drwxr-xr-x 2 ... 47 Jul 6 15:11 js/
-rw-r--r-- 1 ... 46K Jul 6 15:11 apc.php
-rw-r--r-- 1 ... 11K Jul 6 15:05 apple-touch-icon.png
-rw-r--r-- 1 ... 7.0K Jul 6 15:05 apple-touch-icon-precomposed.png
-rw-r--r-- 1 ... 728 Jul 6 15:05 app.php
-rw-r--r-- 1 ... 33K Jul 6 15:05 favicon.ico
-rw-r--r-- 1 ... 20K Jul 6 15:05 favicon.jpg
-rw-r--r-- 1 ... 4.6K Jul 6 15:05 favicon.png
lrwxrwxrwx 1 ... 51 Jul 6 15:06 image -> /var/www/html/sites/www.mysite.com/shared/web/image/
lrwxrwxrwx 1 ... 52 Jul 6 15:06 medias -> /var/www/html/sites/www.mysite.com/shared/web/medias/
-rw-r--r-- 1 ... 66 Aug 10 12:28 robots.txt
-rw-r--r-- 1 ... 2.2M Aug 11 03:00 sitemap.xml
current/web/bundles/
lrwxrwxrwx 1 ... 147 Jul 6 15:09 bazingaexposetranslation -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/willdurand/js-translation-bundle/Bazinga/ExposeTranslationBundle/Resources/public/
lrwxrwxrwx 1 ... 121 Jul 6 15:09 ericharddms -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/erichard/dms-bundle/Erichard/DmsBundle/Resources/public/
lrwxrwxrwx 1 ... 126 Jul 6 15:09 farosadmin -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/faros/admin-bundle-legacy/Faros/AdminBundle/Resources/public/
lrwxrwxrwx 1 ... 125 Jul 6 15:09 faroselfinder -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/faros/elfinder-bundle/Faros/ElFinderBundle/Resources/public/
lrwxrwxrwx 1 ... 113 Jul 6 15:09 farosqb -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/faros/qb-bundle/Faros/QBBundle/Resources/public/
lrwxrwxrwx 1 ... 116 Jul 6 15:09 fosjsrouting -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/friendsofsymfony/jsrouting-bundle/Resources/public/
lrwxrwxrwx 1 ... 133 Jul 6 15:09 framework -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/public/
lrwxrwxrwx 1 ... 132 Jul 6 15:09 mopabootstrap -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/mopa/bootstrap-bundle/Mopa/Bundle/BootstrapBundle/Resources/public/
lrwxrwxrwx 1 ... 129 Jul 6 15:09 trsteelckeditor -> /var/www/html/sites/www.mysite.com/releases/201508/vendor/trsteel/ckeditor-bundle/Trsteel/CkeditorBundle/Resources/public/
lrwxrwxrwx 1 ... 99 Jul 6 15:09 mysiteadmin -> /var/www/html/sites/www.mysite.com/releases/201508/src/mysite/AdminBundle/Resources/public/
lrwxrwxrwx 1 ... 98 Jul 6 15:09 mysitesite -> /var/www/html/sites/www.mysite.com/releases/201508/src/mysite/SiteBundle/Resources/public/
current/app/
drwxr-xr-x 4 ... 27 Aug 11 18:32 cache/
drwxr-xr-x 3 ... 4.0K Aug 11 12:12 config/
drwxr-xr-x 2 ... 4.0K Jul 6 15:05 DoctrineMigrations/
drwxr-xr-x 8 ... 105 Jul 6 15:06 Resources/
-rw-r--r-- 1 ... 141 Jul 6 15:05 AppCache.php
-rw-r--r-- 1 ... 4.3K Jul 6 15:05 AppKernel.php
-rw-r--r-- 1 ... 474 Jul 6 15:05 autoload.php
-rw-r--r-- 1 ... 48K Jul 6 15:09 bootstrap.php.cache
-rw-r--r-- 1 ... 1.7K Jul 6 15:09 check.php
-rwxr-xr-x 1 ... 794 Jul 6 15:05 console*
lrwxrwxrwx 1 ... 50 Jul 6 15:06 logs -> /var/www/html/sites/www.mysite.com/shared/app/logs/
-rw-r--r-- 1 ... 1.7K Jul 6 15:05 phpunit.xml.dist
-rw-r--r-- 1 ... 26K Jul 6 15:09 SymfonyRequirements.php
lrwxrwxrwx 1 ... 49 Jul 6 15:06 var -> /var/www/html/sites/www.mysite.com/shared/app/var/
As you can see there are so many symlinks :(
I have a new installation of symfony 2.1.13 on my wamp server, so :
1. What should I exactly copy from the server ?
2. And where to copy ?
3. How to configure files like AppKernel.php, config.php, parameters.yml ...
Thanks :)
Looks like you are stepped to the task from apposite side
First of all "strange" folders architecture is comming from the nature of the deployment tool "capifony". You can see folder "releases" that keeps all history of releases deployed and folder(symlink) "current" that points to the latest(current) release. Also you can see some symlinks to the folder "shared" that suppose to keep some content that doesn't suppose change from deploy to deploy (like images, logs).
It is possible to explain long how capifony works, but seems it is better to get some quick overview http://capifony.org/
In short words I can say that you can copy the site to local, but it is not the best way. I suppose you need to clone the project from its repository(most probably git) and setup parameters.yml
You should not change AppKernel.php or config.php
Clone the respository and looks for app/config/parameters.yml.dist that will(should) have initial configuration for the project
PS: you should not copy "current/web/bundles/" but should use "assets install" command to create these assets
PPS: And I believe you should to learn some symfony docs(at least basic) before start to copy the site

How to install GCC and/or apt on embedded linux Raspberry Pi

I have a pre-configured linux distro on a raspberry pi (used for a bitcoin miner).
The problem is that this distro is very minimal, only has busybox for basic commands. It doesn't have a package manager and it doesn't even have a gcc compiler. So my target is to install a gcc compiler on it so I can go further and install other software.
So I'm basically limited to these commands from busybox:
root#raspberrypi:~# ls /bin
addgroup fgrep ping6
adduser grep ps
ash gunzip pwd
busybox gzip rm
cat hostname rmdir
chattr ip sed
chgrp kill sh
chmod ln sleep
chown login stty
cp ls su
cpio mkdir sync
date mknod tar
dd mktemp tinylogin
delgroup more touch
deluser mount true
df mountpoint umount
dmesg mountpoint.sysvinit uname
dnsdomainname mv usleep
dumpkmap netstat vi
echo pidof zcat
egrep pidof.sysvinit
false ping
root#raspberrypi:~# ls -l /usr/bin
lrwxrwxrwx 1 root root 12 Feb 21 14:30 [ -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 [[ -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 ar -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 awk -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 basename -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 bunzip2 -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 bzcat -> /bin/busybox
-rwxr-xr-x 1 root root 302368 Apr 22 2014 cgminer
-rwxrwxr-x 1 root root 4179 Apr 18 2014 cherryd
lrwxrwxrwx 1 root root 17 Feb 21 14:30 chvt -> /usr/bin/chvt.kbd
-rwxr-xr-x 1 root root 6860 Feb 19 12:23 chvt.kbd
lrwxrwxrwx 1 root root 12 Feb 21 14:30 clear -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 cmp -> /bin/busybox
-rwxr-xr-x 1 root root 4304 Mar 11 03:18 cracklib-check
-rwxr-xr-x 1 root root 218 Mar 11 03:18 cracklib-format
-rwxr-xr-x 1 root root 4796 Mar 11 03:18 cracklib-packer
-rwxr-xr-x 1 root root 3968 Mar 11 03:18 cracklib-unpacker
-rwxr-xr-x 1 root root 990 Mar 11 03:18 create-cracklib-dict
-rwxr-xr-x 1 root root 135908 Mar 28 12:33 curl
lrwxrwxrwx 1 root root 12 Feb 21 14:30 cut -> /bin/busybox
lrwxrwxrwx 1 root root 23 Feb 21 14:37 dbclient -> /usr/sbin/dropbearmulti
lrwxrwxrwx 1 root root 12 Feb 21 14:30 dc -> /bin/busybox
-rwxr-xr-x 1 root root 13372 Feb 19 12:24 ddcmon
lrwxrwxrwx 1 root root 22 Feb 21 14:30 deallocvt -> /usr/bin/deallocvt.kbd
-rwxr-xr-x 1 root root 7352 Feb 19 12:23 deallocvt.kbd
-rwxr-xr-x 1 root root 64815 Feb 19 12:24 decode-dimms
-rwxr-xr-x 1 root root 6104 Feb 19 12:24 decode-edid
-rwxr-xr-x 1 root root 5650 Feb 19 12:24 decode-vaio
lrwxrwxrwx 1 root root 12 Feb 21 14:30 diff -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 dirname -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 du -> /bin/busybox
-rwxr-xr-x 1 root root 58744 Feb 19 12:23 dumpkeys
lrwxrwxrwx 1 root root 12 Feb 21 14:30 dumpleases -> /bin/busybox
-rwxr-xr-x 1 root root 287 Feb 19 12:24 easy_install
-rwxr-xr-x 1 root root 295 Feb 19 12:24 easy_install-2.7
lrwxrwxrwx 1 root root 12 Feb 21 14:30 env -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 expr -> /bin/busybox
lrwxrwxrwx 1 root root 22 Feb 21 14:30 fgconsole -> /usr/bin/fgconsole.kbd
-rwxr-xr-x 1 root root 7460 Feb 19 12:23 fgconsole.kbd
lrwxrwxrwx 1 root root 12 Feb 21 14:30 find -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 flock -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 free -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 fuser -> /bin/busybox
-rwxr-xr-x 1 root root 7736 Feb 19 12:23 getkeycodes
lrwxrwxrwx 1 root root 12 Feb 21 14:30 groups -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 head -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 hexdump -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 id -> /bin/busybox
-rwxr-xr-x 1 root root 7936 Feb 19 12:23 kbd_mode
-rwxr-xr-x 1 root root 8492 Feb 19 12:23 kbdrate
lrwxrwxrwx 1 root root 12 Feb 21 14:30 killall -> /bin/busybox
lrwxrwxrwx 1 root root 22 Feb 21 14:32 last -> /usr/bin/last.sysvinit
-rwxr-xr-x 1 root root 14048 Feb 19 12:15 last.sysvinit
lrwxrwxrwx 1 root root 4 Feb 21 14:32 lastb -> last
lrwxrwxrwx 1 root root 12 Feb 21 14:30 less -> /bin/busybox
-rwxr-xr-x 1 root root 85348 Feb 19 12:23 loadkeys
-rwxr-xr-x 1 root root 19952 Feb 19 12:23 loadunimap
lrwxrwxrwx 1 root root 12 Feb 21 14:30 logger -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 logname -> /bin/busybox
-rwxr-xr-x 1 root root 1229 Feb 19 12:24 mako-render
-rwxr-xr-x 1 root root 15000 Feb 19 12:23 mapscrn
lrwxrwxrwx 1 root root 12 Feb 21 14:30 md5sum -> /bin/busybox
lrwxrwxrwx 1 root root 22 Feb 21 14:32 mesg -> /usr/bin/mesg.sysvinit
-rwxr-xr-x 1 root root 6532 Feb 19 12:15 mesg.sysvinit
lrwxrwxrwx 1 root root 12 Feb 21 14:30 microcom -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 mkfifo -> /bin/busybox
-rwxr-xr-x 1 root root 18056 Mar 11 03:20 mkhomedir_helper
lrwxrwxrwx 1 root root 12 Feb 21 14:30 nc -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 nohup -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 nslookup -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 od -> /bin/busybox
-rwxr-xr-x 1 root root 488032 Apr 18 2014 openssl
lrwxrwxrwx 1 root root 19 Feb 21 14:30 openvt -> /usr/bin/openvt.kbd
-rwxr-xr-x 1 root root 12084 Feb 19 12:23 openvt.kbd
-rwxr-xr-x 1 root root 9852 Mar 11 03:20 pam_tally
-rwxr-xr-x 1 root root 9872 Mar 11 03:20 pam_tally2
-rwxr-xr-x 1 root root 9904 Mar 11 03:20 pam_timestamp_check
lrwxrwxrwx 1 root root 14 Feb 21 14:30 passwd -> /bin/tinylogin
lrwxrwxrwx 1 root root 12 Feb 21 14:30 patch -> /bin/busybox
lrwxrwxrwx 1 root root 10 Feb 21 14:37 perl -> perl5.14.3
-rwxr-xr-x 1 root root 8768 Feb 19 12:25 perl5.14.3
lrwxrwxrwx 1 root root 12 Feb 21 14:30 printf -> /bin/busybox
lrwxrwxrwx 1 root root 9 Feb 21 14:30 psfaddtable -> psfxtable
lrwxrwxrwx 1 root root 9 Feb 21 14:30 psfgettable -> psfxtable
lrwxrwxrwx 1 root root 9 Feb 21 14:30 psfstriptable -> psfxtable
-rwxr-xr-x 1 root root 16844 Feb 19 12:23 psfxtable
lrwxrwxrwx 1 root root 28 Feb 21 14:32 psplash -> /usr/bin/psplash-raspberrypi
-rwxr-xr-x 1 root root 50484 Feb 19 12:16 psplash-default
-rwxr-xr-x 1 root root 113760 Feb 19 12:16 psplash-raspberrypi
-rwxr-xr-x 1 root root 5516 Feb 19 12:16 psplash-write
lrwxrwxrwx 1 root root 7 Feb 21 14:37 python -> python2
lrwxrwxrwx 1 root root 14 Feb 21 14:37 python-config -> python2-config
lrwxrwxrwx 1 root root 9 Feb 21 14:37 python2 -> python2.7
lrwxrwxrwx 1 root root 16 Feb 21 14:37 python2-config -> python2.7-config
-rwxr-xr-x 1 root root 6268 Apr 18 2014 python2.7
-rwxr-xr-x 1 root root 1618 Feb 19 12:19 python2.7-config
lrwxrwxrwx 1 root root 12 Feb 21 14:30 readlink -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 realpath -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 renice -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 reset -> /bin/busybox
-rwxr-xr-x 1 root root 11882 Feb 19 12:24 rpio
-rwxr-xr-x 1 root root 16597 Feb 19 12:24 rpio-curses
lrwxrwxrwx 1 root root 12 Feb 21 14:30 run-parts -> /bin/busybox
lrwxrwxrwx 1 root root 23 Feb 21 14:37 scp -> /usr/sbin/dropbearmulti
lrwxrwxrwx 1 root root 12 Mar 11 02:22 screen -> screen-4.0.3
-rwxr-xr-x 1 root root 312200 Mar 11 02:22 screen-4.0.3
lrwxrwxrwx 1 root root 12 Feb 21 14:30 seq -> /bin/busybox
-rwxr-xr-x 1 root root 33868 Feb 19 12:23 setfont
-rwxr-xr-x 1 root root 7276 Feb 19 12:23 setkeycodes
-rwxr-xr-x 1 root root 8768 Feb 19 12:23 setleds
-rwxr-xr-x 1 root root 6900 Feb 19 12:23 setmetamode
-rwxr-xr-x 1 root root 14260 Feb 19 12:23 showconsolefont
-rwxr-xr-x 1 root root 10020 Feb 19 12:23 showkey
lrwxrwxrwx 1 root root 12 Feb 21 14:30 sort -> /bin/busybox
-rwxr-xr-x 1 root root 49100 Feb 19 12:13 sqlite3
lrwxrwxrwx 1 root root 23 Feb 21 14:37 ssh -> /usr/sbin/dropbearmulti
lrwxrwxrwx 1 root root 12 Feb 21 14:30 stat -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 strings -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 tail -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 tee -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 telnet -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 test -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 tftp -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 time -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 top -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 tr -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 traceroute -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 tty -> /bin/busybox
-rwxr-xr-x 1 root root 137588 Feb 19 12:23 udevadm
-rwxr-xr-x 1 root root 2425 Feb 19 12:23 unicode_start
-rwxr-xr-x 1 root root 363 Feb 19 12:23 unicode_stop
lrwxrwxrwx 1 root root 12 Feb 21 14:30 uniq -> /bin/busybox
-rwxr-xr-x 1 root root 26424 Mar 11 03:20 unix_chkpwd
-rwxr-xr-x 1 root root 26412 Mar 11 03:20 unix_update
lrwxrwxrwx 1 root root 12 Feb 21 14:30 unzip -> /bin/busybox
-rwxr-xr-x 1 root root 4267 Feb 19 12:09 update-alternatives
lrwxrwxrwx 1 root root 12 Feb 21 14:30 uptime -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 users -> /bin/busybox
lrwxrwxrwx 1 root root 26 Feb 21 14:32 utmpdump -> /usr/bin/utmpdump.sysvinit
-rwxr-xr-x 1 root root 9568 Feb 19 12:15 utmpdump.sysvinit
lrwxrwxrwx 1 root root 14 Feb 21 14:30 vlock -> /bin/tinylogin
lrwxrwxrwx 1 root root 22 Feb 21 14:32 wall -> /usr/bin/wall.sysvinit
-rwxr-xr-x 1 root root 10764 Feb 19 12:15 wall.sysvinit
lrwxrwxrwx 1 root root 12 Feb 21 14:30 watch -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 wc -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 wget -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 which -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 who -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 whoami -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 xargs -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 yes -> /bin/busybox
What I have tried so far is to download a new busybox from here
which includes more commands, most notably rpm (still lacks dpkg though)
root#raspberrypi:~# ./busybox-armv7l
BusyBox v1.21.1 (2013-07-08 10:26:30 CDT) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2012.
Licensed under GPLv2. See source distribution for detailed
copyright notices.
Usage: busybox [function [arguments]...]
or: busybox --list[-full]
or: busybox --install [-s] [DIR]
or: function [arguments]...
BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable. Most people will create a
link to busybox for each function they wish to use and BusyBox
will act like whatever it was invoked as.
Currently defined functions:
[, [[, acpid, add-shell, addgroup, adduser, adjtimex, arp, arping, ash, awk, base64,
basename, beep, blkid, blockdev, bootchartd, brctl, bunzip2, bzcat, bzip2, cal, cat,
catv, chat, chattr, chgrp, chmod, chown, chpasswd, chpst, chroot, chrt, chvt, cksum,
clear, cmp, comm, conspy, cp, cpio, crond, crontab, cryptpw, cttyhack, cut, date, dc, dd,
deallocvt, delgroup, deluser, depmod, devmem, df, dhcprelay, diff, dirname, dmesg, dnsd,
dnsdomainname, dos2unix, du, dumpkmap, dumpleases, echo, ed, egrep, eject, env, envdir,
envuidgid, ether-wake, expand, expr, fakeidentd, false, fbset, fbsplash, fdflush,
fdformat, fdisk, fgconsole, fgrep, find, findfs, flock, fold, free, freeramdisk, fsck,
fsck.minix, fsync, ftpd, ftpget, ftpput, fuser, getopt, getty, grep, groups, gunzip,
gzip, halt, hd, hdparm, head, hexdump, hostid, hostname, httpd, hush, hwclock, id,
ifconfig, ifdown, ifenslave, ifplugd, ifup, inetd, init, insmod, install, ionice, iostat,
ip, ipaddr, ipcalc, ipcrm, ipcs, iplink, iproute, iprule, iptunnel, kbd_mode, kill,
killall, killall5, klogd, last, less, linux32, linux64, linuxrc, ln, loadfont, loadkmap,
logger, login, logname, logread, losetup, lpd, lpq, lpr, ls, lsattr, lsmod, lsof, lspci,
lsusb, lzcat, lzma, lzop, lzopcat, makedevs, makemime, man, md5sum, mdev, mesg, microcom,
mkdir, mkdosfs, mke2fs, mkfifo, mkfs.ext2, mkfs.minix, mkfs.vfat, mknod, mkpasswd,
mkswap, mktemp, modinfo, modprobe, more, mount, mountpoint, mpstat, mt, mv, nameif,
nanddump, nandwrite, nbd-client, nc, netstat, nice, nmeter, nohup, nslookup, ntpd, od,
openvt, passwd, patch, pgrep, pidof, ping, ping6, pipe_progress, pivot_root, pkill, pmap,
popmaildir, poweroff, powertop, printenv, printf, ps, pscan, pstree, pwd, pwdx,
raidautorun, rdate, rdev, readahead, readlink, readprofile, realpath, reboot, reformime,
remove-shell, renice, reset, resize, rev, rm, rmdir, rmmod, route, rpm, rpm2cpio,
rtcwake, run-parts, runlevel, runsv, runsvdir, rx, script, scriptreplay, sed, sendmail,
seq, setarch, setconsole, setfont, setkeycodes, setlogcons, setserial, setsid, setuidgid,
sh, sha1sum, sha256sum, sha3sum, sha512sum, showkey, slattach, sleep, smemcap, softlimit,
sort, split, start-stop-daemon, stat, strings, stty, su, sulogin, sum, sv, svlogd,
swapoff, swapon, switch_root, sync, sysctl, syslogd, tac, tail, tar, tcpsvd, tee, telnet,
telnetd, test, tftp, tftpd, time, timeout, top, touch, tr, traceroute, traceroute6, true,
tty, ttysize, tunctl, udhcpc, udhcpd, udpsvd, umount, uname, unexpand, uniq, unix2dos,
unlzma, unlzop, unxz, unzip, uptime, users, usleep, uudecode, uuencode, vconfig, vi,
vlock, volname, wall, watch, watchdog, wc, wget, which, who, whoami, whois, xargs, xz,
xzcat, yes, zcat, zcip
I have downloaded some gcc rpm's from here
http://rpmfind.net/linux/rpm2html/search.php?query=gcc&submit=Search+...&system=&arch=
but for some reason gcc does not execute
root#raspberrypi:~# ./busybox-armv7l rpm -i gcc-4.8.2-1.fc20.armv7hl.rpm
root#raspberrypi:~# find / -name gcc
/usr/bin/gcc
/usr/share/doc/gcc
/usr/lib/gcc
/usr/libexec/gcc
/opt/STM/STLinux-2.4/devkit/armv7/target/usr/bin/gcc
/opt/STM/STLinux-2.4/devkit/armv7/target/usr/lib/gcc
/opt/STM/STLinux-2.4/devkit/armv7/target/usr/libexec/gcc
root#raspberrypi:~# cd /usr/bin
root#raspberrypi:/usr/bin# ./gcc
-sh: ./gcc: not found
root#raspberrypi:/usr/bin# ls -l
lrwxrwxrwx 1 root root 12 Feb 21 14:30 [ -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 [[ -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 ar -> /bin/busybox
-rwxr-xr-x 1 root root 562184 Mar 29 02:30 arm-linux-gnu-cpp
-rwxr-xr-x 1 root root 562184 Mar 29 02:30 arm-linux-gnu-gcc
-rwxr-xr-x 1 root root 257596 Mar 29 02:30 arm-linux-gnu-gcov
-rwxr-xr-x 2 root root 622224 Oct 17 10:53 armv7hl-redhat-linux-gnueabi-gcc
lrwxrwxrwx 1 root root 12 Feb 21 14:30 awk -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 basename -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 bunzip2 -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 bzcat -> /bin/busybox
-rwxr-xr-x 1 root root 224 Oct 17 10:52 c89
-rwxr-xr-x 1 root root 215 Oct 17 10:52 c99
lrwxrwxrwx 1 root root 3 Apr 10 21:31 cc -> gcc
-rwxr-xr-x 1 root root 302368 Apr 22 2014 cgminer
-rwxrwxr-x 1 root root 4179 Apr 18 2014 cherryd
lrwxrwxrwx 1 root root 17 Feb 21 14:30 chvt -> /usr/bin/chvt.kbd
-rwxr-xr-x 1 root root 6860 Feb 19 12:23 chvt.kbd
lrwxrwxrwx 1 root root 12 Feb 21 14:30 clear -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 cmp -> /bin/busybox
-rwxr-xr-x 1 root root 4304 Mar 11 03:18 cracklib-check
-rwxr-xr-x 1 root root 218 Mar 11 03:18 cracklib-format
-rwxr-xr-x 1 root root 4796 Mar 11 03:18 cracklib-packer
-rwxr-xr-x 1 root root 3968 Mar 11 03:18 cracklib-unpacker
-rwxr-xr-x 1 root root 990 Mar 11 03:18 create-cracklib-dict
....
-rwxr-xr-x 1 root root 287 Feb 19 12:24 easy_install
-rwxr-xr-x 1 root root 295 Feb 19 12:24 easy_install-2.7
lrwxrwxrwx 1 root root 12 Feb 21 14:30 env -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 expr -> /bin/busybox
lrwxrwxrwx 1 root root 22 Feb 21 14:30 fgconsole -> /usr/bin/fgconsole.kbd
-rwxr-xr-x 1 root root 7460 Feb 19 12:23 fgconsole.kbd
lrwxrwxrwx 1 root root 12 Feb 21 14:30 find -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 flock -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 free -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 fuser -> /bin/busybox
-rwxr-xr-x 2 root root 622224 Oct 17 10:53 gcc
-rwxr-xr-x 1 root root 25900 Oct 17 10:54 gcc-ar
-rwxr-xr-x 1 root root 25856 Oct 17 10:53 gcc-nm
-rwxr-xr-x 1 root root 25864 Oct 17 10:54 gcc-ranlib
-rwxr-xr-x 1 root root 260996 Oct 17 10:54 gcov
-rwxr-xr-x 1 root root 7736 Feb 19 12:23 getkeycodes
lrwxrwxrwx 1 root root 12 Feb 21 14:30 groups -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 head -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 hexdump -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 id -> /bin/busybox
-rwxr-xr-x 1 root root 7936 Feb 19 12:23 kbd_mode
-rwxr-xr-x 1 root root 8492 Feb 19 12:23 kbdrate
lrwxrwxrwx 1 root root 12 Feb 21 14:30 killall -> /bin/busybox
lrwxrwxrwx 1 root root 22 Feb 21 14:32 last -> /usr/bin/last.sysvinit
-rwxr-xr-x 1 root root 14048 Feb 19 12:15 last.sysvinit
lrwxrwxrwx 1 root root 4 Feb 21 14:32 lastb -> last
lrwxrwxrwx 1 root root 12 Feb 21 14:30 less -> /bin/busybox
-rwxr-xr-x 1 root root 85348 Feb 19 12:23 loadkeys
-rwxr-xr-x 1 root root 19952 Feb 19 12:23 loadunimap
lrwxrwxrwx 1 root root 12 Feb 21 14:30 logger -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 logname -> /bin/busybox
-rwxr-xr-x 1 root root 1229 Feb 19 12:24 mako-render
-rwxr-xr-x 1 root root 15000 Feb 19 12:23 mapscrn
lrwxrwxrwx 1 root root 12 Feb 21 14:30 md5sum -> /bin/busybox
lrwxrwxrwx 1 root root 22 Feb 21 14:32 mesg -> /usr/bin/mesg.sysvinit
-rwxr-xr-x 1 root root 6532 Feb 19 12:15 mesg.sysvinit
lrwxrwxrwx 1 root root 12 Feb 21 14:30 microcom -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 mkfifo -> /bin/busybox
-rwxr-xr-x 1 root root 18056 Mar 11 03:20 mkhomedir_helper
lrwxrwxrwx 1 root root 12 Feb 21 14:30 nc -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 nohup -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 nslookup -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 od -> /bin/busybox
-rwxr-xr-x 1 root root 488032 Apr 18 2014 openssl
lrwxrwxrwx 1 root root 19 Feb 21 14:30 openvt -> /usr/bin/openvt.kbd
-rwxr-xr-x 1 root root 12084 Feb 19 12:23 openvt.kbd
-rwxr-xr-x 1 root root 9852 Mar 11 03:20 pam_tally
-rwxr-xr-x 1 root root 9872 Mar 11 03:20 pam_tally2
-rwxr-xr-x 1 root root 9904 Mar 11 03:20 pam_timestamp_check
lrwxrwxrwx 1 root root 14 Feb 21 14:30 passwd -> /bin/tinylogin
lrwxrwxrwx 1 root root 12 Feb 21 14:30 patch -> /bin/busybox
lrwxrwxrwx 1 root root 10 Feb 21 14:37 perl -> perl5.14.3
-rwxr-xr-x 1 root root 8768 Feb 19 12:25 perl5.14.3
lrwxrwxrwx 1 root root 12 Feb 21 14:30 printf -> /bin/busybox
lrwxrwxrwx 1 root root 9 Feb 21 14:30 psfaddtable -> psfxtable
lrwxrwxrwx 1 root root 9 Feb 21 14:30 psfgettable -> psfxtable
lrwxrwxrwx 1 root root 9 Feb 21 14:30 psfstriptable -> psfxtable
-rwxr-xr-x 1 root root 16844 Feb 19 12:23 psfxtable
lrwxrwxrwx 1 root root 28 Feb 21 14:32 psplash -> /usr/bin/psplash-raspberrypi
-rwxr-xr-x 1 root root 50484 Feb 19 12:16 psplash-default
-rwxr-xr-x 1 root root 113760 Feb 19 12:16 psplash-raspberrypi
-rwxr-xr-x 1 root root 5516 Feb 19 12:16 psplash-write
lrwxrwxrwx 1 root root 7 Feb 21 14:37 python -> python2
lrwxrwxrwx 1 root root 14 Feb 21 14:37 python-config -> python2-config
lrwxrwxrwx 1 root root 9 Feb 21 14:37 python2 -> python2.7
lrwxrwxrwx 1 root root 16 Feb 21 14:37 python2-config -> python2.7-config
-rwxr-xr-x 1 root root 6268 Apr 18 2014 python2.7
-rwxr-xr-x 1 root root 1618 Feb 19 12:19 python2.7-config
lrwxrwxrwx 1 root root 12 Feb 21 14:30 readlink -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 realpath -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 renice -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 reset -> /bin/busybox
-rwxr-xr-x 1 root root 11882 Feb 19 12:24 rpio
-rwxr-xr-x 1 root root 16597 Feb 19 12:24 rpio-curses
lrwxrwxrwx 1 root root 12 Feb 21 14:30 run-parts -> /bin/busybox
lrwxrwxrwx 1 root root 23 Feb 21 14:37 scp -> /usr/sbin/dropbearmulti
lrwxrwxrwx 1 root root 12 Mar 11 02:22 screen -> screen-4.0.3
-rwxr-xr-x 1 root root 312200 Mar 11 02:22 screen-4.0.3
lrwxrwxrwx 1 root root 12 Feb 21 14:30 seq -> /bin/busybox
-rwxr-xr-x 1 root root 33868 Feb 19 12:23 setfont
-rwxr-xr-x 1 root root 7276 Feb 19 12:23 setkeycodes
-rwxr-xr-x 1 root root 8768 Feb 19 12:23 setleds
-rwxr-xr-x 1 root root 6900 Feb 19 12:23 setmetamode
-rwxr-xr-x 1 root root 14260 Feb 19 12:23 showconsolefont
-rwxr-xr-x 1 root root 10020 Feb 19 12:23 showkey
lrwxrwxrwx 1 root root 12 Feb 21 14:30 sort -> /bin/busybox
-rwxr-xr-x 1 root root 49100 Feb 19 12:13 sqlite3
.....
lrwxrwxrwx 1 root root 12 Feb 21 14:30 tty -> /bin/busybox
-rwxr-xr-x 1 root root 137588 Feb 19 12:23 udevadm
-rwxr-xr-x 1 root root 2425 Feb 19 12:23 unicode_start
-rwxr-xr-x 1 root root 363 Feb 19 12:23 unicode_stop
lrwxrwxrwx 1 root root 12 Feb 21 14:30 uniq -> /bin/busybox
-rwxr-xr-x 1 root root 26424 Mar 11 03:20 unix_chkpwd
-rwxr-xr-x 1 root root 26412 Mar 11 03:20 unix_update
lrwxrwxrwx 1 root root 12 Feb 21 14:30 unzip -> /bin/busybox
-rwxr-xr-x 1 root root 4267 Feb 19 12:09 update-alternatives
lrwxrwxrwx 1 root root 12 Feb 21 14:30 uptime -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 users -> /bin/busybox
lrwxrwxrwx 1 root root 26 Feb 21 14:32 utmpdump -> /usr/bin/utmpdump.sysvinit
-rwxr-xr-x 1 root root 9568 Feb 19 12:15 utmpdump.sysvinit
lrwxrwxrwx 1 root root 14 Feb 21 14:30 vlock -> /bin/tinylogin
lrwxrwxrwx 1 root root 22 Feb 21 14:32 wall -> /usr/bin/wall.sysvinit
-rwxr-xr-x 1 root root 10764 Feb 19 12:15 wall.sysvinit
lrwxrwxrwx 1 root root 12 Feb 21 14:30 watch -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 wc -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 wget -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 which -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 who -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 whoami -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 xargs -> /bin/busybox
lrwxrwxrwx 1 root root 12 Feb 21 14:30 yes -> /bin/busybox
Also tried installing apt-rpm to get apt-get, but it misses a shared libary
root#raspberrypi:~# apt-get
apt-get: error while loading shared libraries: /usr/lib/liblua-5.1.so: internal error
can someone help me on all this??
you've tagged this post as "yocto".
So the only thing I can advice you is using this wonderful tool :)
you don't want to compile your tools from your raspi, but from your killer linux machine :)
first, make sure you have all the prerequisists.
for fedora:
sudo yum install gawk make wget tar bzip2 gzip python unzip perl patch \
diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath \
ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue socat
for ubuntu / debian:
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat
then, you can get yocto from git://git.yoctoproject.org/poky
git clone git://git.yoctoproject.org/poky -b daisy
then, you need to get the raspberrypi layer and its dependencies:
cd poky
git clone http://git.yoctoproject.org/git/meta-raspberrypi -b daisy
git clone git://git.openembedded.org/meta-openembedded -b daisy
then, setup the build environment:
source oe-init-build-env rpi-build
here rpi-build will be the name of the build directory, it can be whatever you want.
this will setup all the environment variables needed to use yocto, andmove you to the newly create build directory.
edit conf/bblayers.conf
and add the needed layers to BBLAYERS. it should look like something like this:
BBLAYERS ?= " \
/path/to/poky/meta \
/path/to/poky/meta-yocto \
/path/to/poky/meta-yocto-bsp \
/path/to/poky/meta-openembedded/meta-oe \
/path/to/poky/meta-raspberrypi \
"
then, edit conf/local.conf
set the MACHINE variabel to raspberrypi:
MACHINE ?= "raspberrypi"
you can also tell yocto to generate deb files instead of the default rpms by changing:
PACKAGE_CLASSES ?= "package_rpm"
to:
PACKAGE_CLASSES ?= "package_deb"
in order to quickly have dpkg present in the build, just add the following line in your conf/local.conf
CORE_IMAGE_EXTRA_INSTALL="dpkg"
and create a basic image:
bitbake rpi-basic-image
this will take some time.... a LOT of time in fact (yocto will generate the whole rootfilesystem, it will download the sources and compile them, will create deb packages for each of them, and will generate a flashable s image).
during that time I suggest you read the yocto documentation in order to understand how to add more software to the resulting image and / or customise it.
Explaining how yocto works can't just be an answer in stackoverflow you'll need to read the documentation and practice a little bit.
but the main thing to understand is that yocto provides receipes. Basically, a receipe describes how to get a packages and how to compile it.
a simple example of receipe can be found in:
meta/recipes-devtools/rpm/rpmresolve_1.0.bb
the good thing with yocto, is that you can easily add your own receipes.
layers provide supersets of receipes, they also allow customisation.
here, we added the raspberrypi layer in order to add support for the raspberry board.
the raspberry layer provides all the receipes needed to configure the kernel, and the bootloader etc...
once compilation is done, in order to flash the resulting sd image just do:
dd bs=4M if=/path/to/rpi-build/tmp/deploy/images/raspberrypi/rpi-basic-image-raspberrypi.rpi-sdimg of=/dev/sd?
where "sd?" is your (unmounted) sdcard (think about saving it if needed)
plug back your sdcard to your raspi,
boot it.
in order to find out the raspi ip, you can scan your network for open ssh ports:
nmap -p 22 --open -sV YOU_SUBNET_ADDRESS/SUBNET_SIZE
example:
nmap -p 22 --open -sV 192.168.1.0/24
ssh root#RASPI-IP
and voila !
next time you'll need to build a new package, you can do:
bitbake package-name
and then just scp the resulting .deb file (from tmp/work/armv6-vfp-poky-linux-gnueabi/PACKAGE_NAME/PACKAGE_VERSION/deploy-debs/armv6-vfp/PACKAGE.ipk) to the raspi and use dpkg to install it.
you can also create your own image based on rpi-basic-image and adding your own selection of packages.
Exmple with htop:
bitbake htop
scp ./tmp/work/armv6-vfp-poky-linux-gnueabi/htop/1.0.3-r0/deploy-debs/armv6-vfp/htop_1.0.3-r0_armv6-vfp.deb root#myraspi
yocto will be very helpful to ease the cross compilation process for you.
sources:
https://github.com/djwillis/meta-raspberrypi
https://yoctoproject.org
kamou

Resources