This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM3359: SquashFS load causes kernel panic

Part Number: AM3359


Tool/software: Linux

Hi,

I have created squash filesystem on beagle bone black board running ubuntu 16.04 LTS filesystem. I have copied this filesystem on first partition of sd card /dev/sdc1 and trying to mount on /dev/mmcblk0p1.

I am using u-boot 2016.11.rc3 and kernel 4.4.27-bone-rt-r14 with below u-boot unv setup:

console=tty0 console=ttyO0,115200n8 root=/dev/mmcblk0p2 rootfstype=squashfs rw noinitrd rootwait cape_disable=bone_capemgr.disable_partno=BB-BONELT-HDMI, BB-BONELT-HDMIN, BB-BONE-HDMI bone_capemgr.enable_partno=BB-UART1,BB-AAIM-LCD:00A1,BB-UART4,BB-UART2,BB-I2C1

I am not able to boot with squashfs filesystem.

Please provide your inputs/suggestion on the booting Beagle bone with squashfs.

For more details attaching mksquash script :

scriptdir="/root/rdonly"
libdir="${scriptdir}/lib"
bnddir="/root/bindmount"
cpdir="/root/fscopy"
image="/root/filesystem.squashfs"
mntdir="/flash"
doc_dir="${cpdir}/usr/share/doc"

# clean apt
apt-get clean

# If this script already ran, delete everything it created to start fresh
# Note: these files are not cleaned up at the completion of the script
# because we may want to do minor tweaks and it would take forever if we
# had to run this script for every little tweak we wanted to try.
umount ${bnddir}
rm -rf ${bnddir}
rm -rf ${cpdir}
rm -rf ${image}

# Use bindmount to see disk filesytem w/o other mounts on it
mkdir ${bnddir}
mount -o bind / ${bnddir}

# Enter bindmount and remove any files which may reside in mountpoint directories
rm -rf ${bnddir}/proc/* ${bnddir}/dev/* ${bnddir}/sys/*

# Copy devices needed for boot
cp -a /dev/console /dev/null ${bnddir}/dev

# bindmount points directly to the root filesystem
# we need to make a copy to manipulate.
mkdir ${cpdir}
cp -av ${bnddir}/* ${cpdir}/

# remove unused ttys to conserve resources
rm -f ${cpdir}/etc/event.d/tty[2-6]
# unbind control-alt-delete
rm -f ${cpdir}/etc/event.d/control-alt-delete

touch ${cpdir}/remove.sh
chmod a+wx ${cpdir}/remove.sh
echo "# Remove"                         > ${cpdir}/remove.sh
echo "apt-get remove --purge -y squashfs-tools" >> ${cpdir}/remove.sh
echo "apt-get autoremove --purge -y"   >> ${cpdir}/remove.sh
echo "apt-get clean"                   >> ${cpdir}/remove.sh
echo "exit"                            >> ${cpdir}/remove.sh

# Login as root and run remove.sh script
chroot ${cpdir}/ /remove.sh
rm -rf ${cpdir}/remove.sh

# The kernel and initrd file are not needed in /boot because we will be booting off ones on the flashcard
# The flashcard will be mounted to mntdir so we can delete local files and create a link to that directory.
# However, mksquashfs will fail if the link is broken so move the files to the mntdir directory and make link.
rm -rf ${mntdir}
mkdir ${mntdir}

#mv ${cpdir}/boot/vmlinuz-4.4.27-bone-rt-r14 ${mntdir}/vmlinuz-4.4.27-bone-rt-r14
#mv  ${cpdir}/boot/dtbs ${mntdir}/
#mv  ${cpdir}/boot/uboot ${mntdir}/
#mv ${cpdir}/boot/vmlinuz-2.6.32.11-geode-rtai ${mntdir}/vmlinuz.geode
#mv  ${cpdir}/boot/initrd.img-2.6.32.11-geode-rtai ${mntdir}/initrd.gz.geode

#ln -s ${mntdir}/vmlinuz.atom ${cpdir}/boot/vmlinuz-2.6.32.11-geode-rtai
#ln -s ${mntdir}/initrd.gz.atom ${cpdir}/boot/initrd.img-2.6.32.11-geode-rtai

# remove command history
echo "" > ${cpdir}/home/vilter/.bash_history
echo "" > ${cpdir}/root/.bash_history

# remove temporary files
rm -rf ${cpdir}/tmp/* ${cpdir}/var/tmp/*

#cleanup files we do not want/need
#rm -rf ${cpdir}/boot/grub
#rm -rf ${cpdir}/boot/*.bak
#rm -rf ${cpdir}${scriptdir} ${cpdir}/home/vilter/.vcontrol
#rm -rf ${cpdir}/root/*
rm -rf ${cpdir}/usr/share/man
rm -rf ${cpdir}${mntdir}

#remove all files except copyright files in ${cpdir}/usr/share/doc
if [ -d "$doc_dir" ]; then
    #Loop over ${cpdir}/usr/share/doc directory
    for dir in $doc_dir/*; do
        #If sub-directory
        if [ -d "$dir" ]; then
            #Delete everything except copyright file
            for f in $dir/*; do
                if [ "$f" != "$dir/copyright" ]; then
                    rm -rf $f
                fi
            done
        fi
    done
fi

# Delete unused styles
mv ${cpdir}/usr/share/fluxbox/styles/BlueNight /tmp/
rm -rf ${cpdir}/usr/share/fluxbox/styles/*
mv /tmp/BlueNight ${cpdir}/usr/share/fluxbox/styles

# Update fstabs so development flashcard partitions are mounted properly
cp /home/vilter/fstab ${cpdir}/etc/

#mkdir -p ${cpdir}/etc/tsharc
#cp -r ${libdir}/Tsharc304c/* ${cpdir}/etc/tsharc

# set up network interfaces for flashcard use
#rm -f ${cpdir}/etc/network/interfaces
#ln -s /mnt/setpoints/interfaces ${cpdir}/etc/network/interfaces

# make squashfs image
cd ${cpdir}
apt-get install -y squashfs-tools
mksquashfs * ${image}