Step 7 : Post Build Checks ============================== .. tab-set:: .. tab-item:: Post Build Checks * In this program, you are going to learn .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * How to ? .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow Topics in this section, * :ref:`Post Build Checks ` .. _openwrt_rpi_4b_step7_0: .. tab-set:: .. tab-item:: Check Linux kernel .config file .. code-block:: c $ cd $HOME/openwrt/build_dir/target-aarch64_cortex-a72_musl/linux-bcm27xx_bcm2711/linux-6.1.69 $ cat .config .. dropdown:: See the full output below .. Literalinclude:: linux_config.txt .. tab-set:: .. tab-item:: Check the location of toolchain .. code-block:: c $ cd $HOME/openwrt/staging_dir/toolchain-aarch64_cortex-a72_gcc-12.3.0_musl/aarch64-openwrt-linux-musl/bin $ ls -l bin -rwxr-xr-x 2 test test 2226840 Feb 12 16:55 ar -rwxr-xr-x 2 test test 3467944 Feb 12 16:55 as -rwxr-xr-x 4 test test 4025800 Feb 12 16:55 ld -rwxr-xr-x 4 test test 4025800 Feb 12 16:55 ld.bfd -rwxr-xr-x 2 test test 2217128 Feb 12 16:55 nm -rwxr-xr-x 2 test test 2353136 Feb 12 16:55 objcopy -rwxr-xr-x 2 test test 3870368 Feb 12 16:55 objdump -rwxr-xr-x 2 test test 2226872 Feb 12 16:55 ranlib -rwxr-xr-x 2 test test 1284560 Feb 12 16:55 readelf -rwxr-xr-x 2 test test 2353136 Feb 12 16:55 strip .. tab-set:: .. tab-item:: Explanation for "ar" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * ar: Create, Modify, and Extract from archives .. dropdown:: see the options supported by "ar" tool .. Literalinclude:: ar.txt .. tab-set:: .. tab-item:: Explanation for "as" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * as: The portable GNU assembler .. dropdown:: see the options supported by "as" tool .. Literalinclude:: as.txt .. tab-set:: .. tab-item:: Explanation for "ld" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * ld: The GNU linker .. tab-set:: .. tab-item:: Explanation for "ld.bfd" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * ld.bfd: The linker accesses object and archive files using the BFD (Binary File Descriptor) libraries. .. tab-set:: .. tab-item:: Explanation for "nm" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * nm: List symbols from object files .. dropdown:: see the options supported by "nm" tool .. Literalinclude:: nm.txt .. tab-set:: .. tab-item:: Explanation for "objcopy" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * objcopy: Copy and translate object files .. dropdown:: see the options supported by "objcopy" tool .. Literalinclude:: objcopy.txt .. tab-set:: .. tab-item:: Explanation for "objdump" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * objdump: Display information from object files .. dropdown:: see the options supported by "objdump" tool .. Literalinclude:: objdump.txt .. tab-set:: .. tab-item:: Explanation for "ranlib" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * ranlib: Generate an index to an archive .. dropdown:: see the options supported by "ranlib" tool .. Literalinclude:: ranlib.txt .. tab-set:: .. tab-item:: Explanation for "readelf" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * readelf: Display information about ELF (Executable and Linkable Format) files .. dropdown:: see the options supported by "readelf" tool .. Literalinclude:: readelf.txt .. tab-set:: .. tab-item:: Explanation for "strip" tool .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * strip: Discard symbols and other data from object files .. dropdown:: see the options supported by "strip" tool .. Literalinclude:: strip.txt .. tab-set:: .. tab-item:: Check location of the full image * Make sure the current directory is "openwrt" .. code-block:: c $ pwd $HOME/openwrt/bin/targets/bcm27xx/bcm2710 $ ls -l -rw-r--r-- 1 test test 1989 Feb 12 17:40 config.buildinfo -rw-r--r-- 1 test test 395 Feb 12 17:41 feeds.buildinfo -rw-r--r-- 1 test test 19398066 Feb 12 18:13 openwrt-bcm27xx-bcm2710-rpi-3-ext4-factory.img.gz -rw-r--r-- 1 test test 19399049 Feb 12 18:13 openwrt-bcm27xx-bcm2710-rpi-3-ext4-sysupgrade.img.gz -rw-r--r-- 1 test test 4263 Feb 12 18:13 openwrt-bcm27xx-bcm2710-rpi-3.manifest -rw-r--r-- 1 test test 17360143 Feb 12 18:12 openwrt-bcm27xx-bcm2710-rpi-3-squashfs-factory.img.gz -rw-r--r-- 1 test test 17361126 Feb 12 18:13 openwrt-bcm27xx-bcm2710-rpi-3-squashfs-sysupgrade.img.gz drwxr-xr-x 2 test test 4096 Feb 12 18:13 packages -rw-r--r-- 1 test test 2378 Feb 12 18:13 profiles.json -rw-r--r-- 1 test test 912 Feb 12 18:13 sha256sums -rw-r--r-- 1 test test 18 Feb 12 17:41 version.buildinfo .. tab-set:: .. tab-item:: Explanation for "config.buildinfo" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * config.buildinfo: Creating a config from .config backup or config.buildinfo .. tab-set:: .. tab-item:: Explanation for "feeds.buildinfo" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * feeds.buildinfo: Collection of packages. .. tab-set:: .. tab-item:: Explanation for "openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz: In this openwrt image is built .. tab-set:: .. tab-item:: Explanation for "openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * openwrt-bcm27xx-bcm2711-rpi-4-ext4-factory.img.gz: In this openwrt image is built * ext4: This firmware contains a regular ext4 Linux partition * factory: Use when flashing * img: image file * gz: extension for gzip .. tab-set:: .. tab-item:: Explanation for "openwrt-bcm27xx-bcm2711-rpi-4-ext4-sysupgrade.img.gz" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * sysupgrade: sysupgrade is designed to be flashed from OpenWrt/LEDE itself .. tab-set:: .. tab-item:: Explanation for "openwrt-bcm27xx-bcm2711-rpi-4.manifest" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * manifest: .. tab-set:: .. tab-item:: Explanation for "openwrt-bcm27xx-bcm2711-rpi-4-squashfs-factory.img.gz" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * squashfs: This firmware contains a type of partition that is compressed and mounts read-only .. tab-set:: .. tab-item:: Explanation for "profiles.json" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * profiles.json: A profile is a set of documents with a profile relationship to the profile. * json: JavaScript Object Notation .. tab-set:: .. tab-item:: Explanation for "sha256sums" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * sha256sums: An SHA-256 checksum is a sequence of numbers and letters that you can use to check that your copy of a downloaded update file is identical to the original .. tab-set:: .. tab-item:: Explanation for "version.buildinfo" .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow * version.buildinfo: It will be version of the openwrt .. tab-set:: .. tab-item:: Check the size of the full image .. code-block:: c $ du -h openwrt-bcm27xx-bcm2710-rpi-3-ext4-factory.img.gz 19M openwrt-bcm27xx-bcm2710-rpi-3-ext4-factory.img.gz .. tab-set:: .. tab-item:: Check and inspect the full image * To extract image file following are the commands .. code-block:: c $ pwd $HOME/openwrt/bin/targets/bcm27xx/bcm2710 .. tab-set:: .. tab-item:: Extract openwrt-bcm27xx-bcm2711-rpi-3-ext4-factory.img.gz * After extracting you will get openwrt-bcm27xx-bcm2711-rpi-3-ext4-factory.img .. code-block:: c $ gunzip openwrt-bcm27xx-bcm2711-rpi-3-ext4-factory.img.gz $ ls -l -rw-r--r-- 1 test test 1989 Feb 12 17:40 config.buildinfo -rw-r--r-- 1 test test 395 Feb 12 17:41 feeds.buildinfo -rw-r--r-- 1 test test 184549376 Feb 12 18:13 openwrt-bcm27xx-bcm2710-rpi-3-ext4-factory.img -rw-r--r-- 1 test test 19399049 Feb 12 18:13 openwrt-bcm27xx-bcm2710-rpi-3-ext4-sysupgrade.img.gz -rw-r--r-- 1 test test 4263 Feb 12 18:13 openwrt-bcm27xx-bcm2710-rpi-3.manifest -rw-r--r-- 1 test test 17360143 Feb 12 18:12 openwrt-bcm27xx-bcm2710-rpi-3-squashfs-factory.img.gz -rw-r--r-- 1 test test 17361126 Feb 12 18:13 openwrt-bcm27xx-bcm2710-rpi-3-squashfs-sysupgrade.img.gz drwxr-xr-x 2 test test 4096 Feb 12 18:13 packages -rw-r--r-- 1 test test 2378 Feb 12 18:13 profiles.json -rw-r--r-- 1 test test 912 Feb 12 18:13 sha256sums -rw-r--r-- 1 test test 18 Feb 12 17:41 version.buildinfo .. tab-set:: .. tab-item:: Check how many partitions are there in .img file .. code-block:: c $ file openwrt-bcm27xx-bcm2711-rpi-3-ext4-factory.img openwrt-bcm27xx-bcm2710-rpi-3-ext4-factory.img: DOS/MBR boot sector; partition 1 : ID=0xc, active, start-CHS (0x20,2,3), end-CHS (0x228,2,34), startsector 8192, 131072 sectors; partition 2 : ID=0x83, start-CHS (0x249,0,37), end-CHS (0x196,1,25), startsector 147456, 212992 sectors * There are 2 partitions are there in .img file .. tab-set:: .. tab-item:: Install kpartx to make partition table * kpartx: Create device maps from partition tables .. code-block:: c $ sudo apt-get install kpartx .. tab-set:: .. tab-item:: To create specific sectors * -a: Add partition mappings * -v: Operate verbosely .. code-block:: c $ sudo kpartx -av openwrt-bcm27xx-bcm2711-rpi-3-ext4-factory.img add map loop28p1 (252:0): 0 131072 linear 7:28 8192 add map loop28p2 (252:1): 0 212992 linear 7:28 147456 .. tab-set:: .. tab-item:: Create 2 folders to mount the device maps .. code-block:: c $ sudo mkdir -p /mnt/boot $ sudo mount /dev/mapper/loop29p1 /mnt/boot $ sudo mkdir -p /mnt/root $ sudo mount /dev/mapper/loop29p2 /mnt/root .. tab-set:: .. tab-item:: Check contents in /mnt/boot and /mnt/root .. code-block:: c $ ls -l /mnt/boot -rwxr-xr-x 1 root root 31359 Feb 12 14:27 bcm2710-rpi-2-b.dtb -rwxr-xr-x 1 root root 33555 Feb 12 14:27 bcm2710-rpi-3-b.dtb -rwxr-xr-x 1 root root 34182 Feb 12 14:27 bcm2710-rpi-3-b-plus.dtb -rwxr-xr-x 1 root root 31254 Feb 12 14:27 bcm2710-rpi-cm3.dtb -rwxr-xr-x 1 root root 32524 Feb 12 14:27 bcm2710-rpi-zero-2.dtb -rwxr-xr-x 1 root root 52476 Feb 12 14:27 bootcode.bin -rwxr-xr-x 1 root root 90 Feb 12 14:27 cmdline.txt -rwxr-xr-x 1 root root 572 Feb 12 14:27 config.txt -rwxr-xr-x 1 root root 496 Feb 12 14:27 COPYING.linux -rwxr-xr-x 1 root root 678 Feb 12 14:27 distroconfig.txt -rwxr-xr-x 1 root root 3180 Feb 12 14:27 fixup_cd.dat -rwxr-xr-x 1 root root 7269 Feb 12 14:27 fixup.dat -rwxr-xr-x 1 root root 10244 Feb 12 14:27 fixup_x.dat -rwxr-xr-x 1 root root 12046344 Feb 12 14:27 kernel8.img -rwxr-xr-x 1 root root 1594 Feb 12 14:27 LICENCE.broadcom drwxr-xr-x 2 root root 26624 Feb 12 14:27 overlays -rwxr-xr-x 1 root root 808060 Feb 12 14:27 start_cd.elf -rwxr-xr-x 1 root root 2979264 Feb 12 14:27 start.elf -rwxr-xr-x 1 root root 3726216 Feb 12 14:27 start_x.elf $ ls -l /mnt/root drwxr-xr-x 2 root root 4096 Feb 12 14:27 bin drwxr-xr-x 2 root root 4096 Feb 12 14:27 dev drwxr-xr-x 23 root root 4096 Feb 12 14:27 etc drwxr-xr-x 11 root root 4096 Feb 12 14:27 lib lrwxrwxrwx 1 root root 3 Feb 12 14:27 lib64 -> lib drwx------ 2 root root 4096 Jan 1 1970 lost+found drwxr-xr-x 2 root root 4096 Feb 12 14:27 mnt drwxr-xr-x 2 root root 4096 Feb 12 14:27 overlay drwxr-xr-x 2 root root 4096 Feb 12 14:27 proc drwxrwxr-x 2 root root 4096 Feb 12 14:27 rom drwxr-x--- 2 root root 4096 Feb 12 14:27 root drwxr-xr-x 2 root root 4096 Feb 12 14:27 sbin drwxr-xr-x 3 root root 4096 Feb 12 14:27 srv drwxr-xr-x 2 root root 4096 Feb 12 14:27 sys drwxrwxrwt 2 root root 4096 Feb 12 14:27 tmp drwxr-xr-x 7 root root 4096 Feb 12 14:27 usr lrwxrwxrwx 1 root root 3 Feb 12 14:27 var -> tmp drwxr-xr-x 2 root root 4096 Feb 12 14:27 www .. tab-set:: .. tab-item:: Do umount for /mnt/boot and /mnt/root .. code-block:: c $ umount /mnt/boot $ umount /mnt/root .. tab-set:: .. tab-item:: Check space acquired on RAM * using meminfo command we can check the space acquired on the RAM. .. code-block:: shell root@OpenWrt:/# cat /proc/meminfo .. dropdown:: See the full output below .. literalinclude:: meminfo.txt .. tab-set:: .. tab-item:: Check space acquired on flash. * using df command we can interpret the space acquire on the flash. .. code-block:: shell root@OpenWrt:/# df -h Filesystem Size Used Available Use% Mounted on /dev/root 102.3M 30.1M 70.1M 30% / tmpfs 458.3M 140.0K 458.2M 0% /tmp /dev/mmcblk0p1 63.9M 20.1M 43.7M 32% /boot tmpfs 512.0K 0 512.0K 0% /dev * this needs to be correlated with the mount command output since this df also lists out virtual filesystem. .. code-block:: shell root@OpenWrt:/# mount .. dropdown:: See the full output below .. literalinclude:: mount2.txt * from verifying this two outputs we can come to the following conclusion. * /dev/mmcblk0p1 is mounted to /boot. * /dev/root is mounted on / * this two filesystem comprises of the space acquired on flash. .. tab-set:: .. tab-item:: Check the build ID .. code-block:: shell root@OpenWrt:/# cat /etc/os-release | grep BUILD_ID BUILD_ID="r16495-bf0c965af0" .. tab-set:: .. tab-item:: Check the linux kernel version * Check the linux kernel version using the following command .. code-block:: shell root@OpenWrt:/# uname -a Linux OpenWrt 5.4.179 #0 SMP Wed Feb 16 20:29:10 2022 aarch64 GNU/Linux .. tab-set:: .. tab-item:: Check the openwrt version * Check the openwrt version using the following command .. code-block:: shell root@OpenWrt:/# cat /etc/openwrt_release DISTRIB_ID='OpenWrt' DISTRIB_RELEASE='21.02.2' DISTRIB_REVISION='r16495-bf0c965af0' DISTRIB_TARGET='bcm27xx/bcm2710' DISTRIB_ARCH='aarch64_cortex-a53' DISTRIB_DESCRIPTION='OpenWrt 21.02.2 r16495-bf0c965af0' DISTRIB_TAINTS='' .. tab-set:: .. tab-item:: Check list of drivers loaded in RAM .. code-block:: shell root@OpenWrt:/# lsmod .. dropdown:: See the output below .. Literalinclude:: ls_mod.txt .. tab-set:: .. tab-item:: Check list of drivers present in root partition .. code-block:: shell root@OpenWrt:/# find / -iname "*.ko" .. dropdown:: See the output below .. Literalinclude:: ko.txt .. tab-set:: .. tab-item:: Check the list of libraries loaded .. code-block:: shell root@OpenWrt:/# find / -iname "*.so" .. dropdown:: See the output below .. Literalinclude:: so.txt .. code-block:: shell root@OpenWrt:/# find / -iname "*.a" .. dropdown:: See the output below * Static library files not found .. Literalinclude:: lib3.txt .. tab-set:: .. tab-item:: Check the list of applications loaded .. code-block:: shell root@OpenWrt:/# find /usr/bin .. dropdown:: See the output below .. Literalinclude:: app1.txt .. code-block:: shell root@OpenWrt:/# find /usr/sbin .. dropdown:: See the output below .. Literalinclude:: app2.txt .. code-block:: shell root@OpenWrt:/# cd bin .. dropdown:: See the output below .. Literalinclude:: bin.txt .. code-block:: shell root@OpenWrt:/# cd sbin .. dropdown:: See the output below .. Literalinclude:: sbin.txt .. tab-set:: .. tab-item:: Check list of all threads * ps: Displays information about a selection of the active processes .. code-block:: shell root@OpenWrt:/# ps .. dropdown:: See the output below .. Literalinclude:: threads.txt .. tab-set:: .. tab-item:: Check list of System threads * TODO .. code-block:: c .. tab-set:: .. tab-item:: Check list of Driver threads * TODO .. code-block:: c .. tab-set:: .. tab-item:: Check list of Application threads * TODO .. code-block:: c .. tab-set:: .. tab-item:: Check CPU usage of all threads .. code-block:: shell root@OpenWrt:/# top .. dropdown:: See the full output below .. Literalinclude:: top1.txt .. tab-set:: .. tab-item:: Check RAM usage of all threads * TODO .. code-block:: c .. tab-set:: .. tab-item:: Check list of mounted partitions using "mount" .. code-block:: shell root@OpenWrt:/# mount .. dropdown:: See the full output below .. Literalinclude:: mount1.txt .. tab-set:: .. tab-item:: Check list of all physical partitions using "fdisk -l" .. code-block:: shell root@OpenWrt:/# fdisk -l .. dropdown:: See the full output below .. Literalinclude:: fdisk_brd.txt .. tab-set:: .. tab-item:: Step 7.5.5: Check overall RAM usage * In this section, we will know RAM usage .. code-block:: shell root@OpenWrt:/# free total used free shared buff/cache available Mem: 489820 12392 461324 14324 16104 437640 Swap: 0 0 0 .. tab-set:: .. tab-item:: Check list of all Network interfaces .. code-block:: shell root@OpenWrt:/# ifconfig -a br-lan Link encap:Ethernet HWaddr E4:5F:01:3C:F4:21 inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fddb:1aa5:ff14::1/60 Scope:Global UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) eth0 Link encap:Ethernet HWaddr E4:5F:01:3C:F4:21 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:320 errors:0 dropped:0 overruns:0 frame:0 TX packets:320 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:24960 (24.3 KiB) TX bytes:24960 (24.3 KiB) wlan0 Link encap:Ethernet HWaddr E4:5F:01:3C:F4:22 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) .. tab-set:: .. tab-item:: Check list of all Wireless interfaces using "iw dev" .. code-block:: shell root@OpenWrt:/# iw dev phy#0 Interface wlan0 ifindex 3 wdev 0x1 addr e4:5f:01:3c:f4:22 type managed channel 34 (5170 MHz), width: 20 MHz, center1: 5170 MHz .. tab-set:: .. tab-item:: Check list of all Wireless interfaces using "iwconfig" .. code-block:: shell root@OpenWrt:/# iwconfig lo no wireless extensions. eth0 no wireless extensions. wlan0 no wireless extensions. br-lan no wireless extensions. .. dropdown:: See the full output below * iwconfig is not supported in this RPI 4b version .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow What is /.bashrc file? .. dropdown:: See Answer * ??