jffs2根文件系统与uimage内核

时间:2022-07-02 09:06:45
1:jffs2根文件系统
在我们现在mips平台上面,其根文件系统使用的是jffs2格式的文件系统。
创建jffs2时,使用的命令如下:
jffs2_build: image_root
@echo Making jffs2 at `date`
cd $(IMAGEPATH) && \
$(TOPDIR)/build/util/mkfs.jffs2 --root=$(IMAGE_ROOT) --eraseblock=$(ERASEBLOCKSIZE) -b -D $(TOPDIR)/build/scripts/$(BOARD_TYPE)/dev.txt --squash -o $(JFFS2FILE) --pad=$(TARGETFSSIZE)
cp $(IMAGEPATH)/$(JFFS2FILE) $(TFTPPATH)
@echo Done Making jffs2 at `date`
执行时输出为:
cd /wlan/plc/sdk_10.5.13/build/../images/pb9x-2.6.31 && \
        /wlan/plc/sdk_10.5.13/build/../build/util/mkfs.jffs2 --root=/wlan/plc/sdk_10.5.13/build/../rootfs-pb9x-2.6.31.optbuild --eraseblock=0x10000 -b -D /wlan/plc/sdk_10.5.13/build/../build/scripts/pb9x-2.6.31/dev.txt --squash -o pb9x-2.6.31-jffs2 --pad=0xC00000
mkfs.jffs2: skipping device_table entry '/dev': no parent directory!
cp /wlan/plc/sdk_10.5.13/build/../images/pb9x-2.6.31/pb9x-2.6.31-jffs2 /tftpboot/PLC
Done Making jffs2 at Sun Mar 17 15:19:35 CST 2013


2:uimage内核镜像
#
# $1 == u-boot/tools path
# $2 == kernel tree path
# $3 == optional additions to filename

MKIMAGE=$1/mkimage
VMLINUX=$2/vmlinux
VMLINUXBIN=$2/arch/mips/boot/vmlinux.bin
# NOTE You can direct the outputs elsewhere by pre-defining TFTPPATH
if [ -z "$TFTPPATH" ]
then
    TFTPPATH=/tftpboot/`whoami`
fi
echo $0 Using TFTPPATH=$TFTPPATH  ###### DEBUG


ENTRY=`readelf -a ${VMLINUX}|grep "Entry"|head -1|cut -d":" -f 2`
LDADDR=`readelf -a ${VMLINUX}|grep "\[ 1\]"|head -1|cut -d" " -f 26`
# gzip -f ${VMLINUXBIN}

if [ $# -gt 3 ]
then


${MKIMAGE} -A mips -O linux -T kernel -C gzip \
-a 0x${LDADDR} -e ${ENTRY} -n "Linux Kernel Image"    \
-d ${VMLINUXBIN}.gz ${IMAGEPATH}/vmlinux$3.gz.uImage
cp ${IMAGEPATH}/vmlinux$3.gz.uImage ${TFTPPATH}
cp ${IMAGEPATH}/vmlinux$3.gz.uImage ${TFTPPATH}/zImage.uImage
if [ $4 = "lzma" ] 
then
echo "**** Generating vmlinux$3.lzma.uImage ********";
${MKIMAGE} -A mips -O linux -T kernel -C lzma \
-a 0x${LDADDR} -e ${ENTRY} -n "Linux Kernel Image"    \
-d ${VMLINUXBIN}.lzma ${IMAGEPATH}/vmlinux$3.lzma.uImage ;
cp ${IMAGEPATH}/vmlinux$3.lzma.uImage ${TFTPPATH} ;
cp ${IMAGEPATH}/vmlinux$3.lzma.uImage ${TFTPPATH}/zImage.uImage ;
fi
else


${MKIMAGE} -A mips -O linux -T kernel -C gzip \
-a 0x${LDADDR} -e ${ENTRY} -n "Linux Kernel Image"    \
-d ${VMLINUXBIN}.gz ${IMAGEPATH}/vmlinux.gz.uImage
cp ${IMAGEPATH}/vmlinux.gz.uImage ${TFTPPATH}
cp ${IMAGEPATH}/vmlinux.gz.uImage ${TFTPPATH}/zImage.uImage


if [ $# -eq 3 ]
then
if [ $3 = "lzma" ]
then
echo "**** Generating vmlinux.lzma.uImage ********";
${MKIMAGE} -A mips -O linux -T kernel -C lzma \
-a 0x${LDADDR} -e ${ENTRY} -n "Linux Kernel Image"    \
-d ${VMLINUXBIN}.lzma ${IMAGEPATH}/vmlinux.lzma.uImage ;
cp ${IMAGEPATH}/vmlinux.lzma.uImage ${TFTPPATH} ;
cp ${IMAGEPATH}/vmlinux.lzma.uImage ${TFTPPATH}/zImage.uImage ;
fi
fi
fi








echo Making uImage...
Making uImage...
cd util && mkuImage.sh /extFlash1/Aquila_9.2.._u10.1020/build/../boot/u-boot/tools /extFlash1/Aquila_9.2.._u10.1020/build/../linux/kernels/mips-linux-2.6.31 _ap123 lzma
+ MKIMAGE=/extFlash1/Aquila_9.2.._u10.1020/build/../boot/u-boot/tools/mkimage
+ VMLINUX=/extFlash1/Aquila_9.2.._u10.1020/build/../linux/kernels/mips-linux-2.6.31/vmlinux
+ VMLINUXBIN=/extFlash1/Aquila_9.2.._u10.1020/build/../linux/kernels/mips-linux-2.6.31/arch/mips/boot/vmlinux.bin
+ '[' -z /extFlash1/Aquila_9.2.._u10.1020/build/../tftpboot/root ']'
+ echo /extFlash1/Aquila_9.2.._u10.1020/build/../build/util/mkuImage.sh Using TFTPPATH=/extFlash1/Aquila_9.2.._u10.1020/build/../tftpboot/root
/extFlash1/Aquila_9.2.._u10.1020/build/../build/util/mkuImage.sh Using TFTPPATH=/extFlash1/Aquila_9.2.._u10.1020/build/../tftpboot/root
++ readelf -a /extFlash1/Aquila_9.2.._u10.1020/build/../linux/kernels/mips-linux-2.6.31/vmlinux
++ head -1
++ grep Entry
++ cut -d: -f 2
+ ENTRY='               0x801faed0'
++ readelf -a /extFlash1/Aquila_9.2.._u10.1020/build/../linux/kernels/mips-linux-2.6.31/vmlinux
++ grep '\[ 1\]'
++ head -1
++ cut '-d ' -f 26
+ LDADDR=80002000
+ '[' 4 -gt 3 ']'
+ /extFlash1/Aquila_9.2.._u10.1020/build/../boot/u-boot/tools/mkimage -A mips -O linux -T kernel -C gzip -a 0x80002000 -e 0x801faed0 -n 'Linux Kernel Image' -d /extFlash1/Aquila_9.2.._u10.1020/build/../linux/kernels/mips-linux-2.6.31/arch/mips/boot/vmlinux.bin.gz /extFlash1/Aquila_9.2.._u10.1020/build/../images-ROUTER_9341/ar934x-router_ap123/vmlinux_ap123.gz.uImage
Image Name:   Linux Kernel Image
Created:      Tue Feb 19 11:58:29 2013
Image Type:   MIPS Linux Kernel Image (gzip compressed)
Data Size:    1326164 Bytes = 1295.08 kB = 1.26 MB
Load Address: 0x80002000
Entry Point:  0x801FAED0
+ cp /extFlash1/Aquila_9.2.._u10.1020/build/../images-ROUTER_9341/ar934x-router_ap123/vmlinux_ap123.gz.uImage /extFlash1/Aquila_9.2.._u10.1020/build/../tftpboot/root
+ cp /extFlash1/Aquila_9.2.._u10.1020/build/../images-ROUTER_9341/ar934x-router_ap123/vmlinux_ap123.gz.uImage /extFlash1/Aquila_9.2.._u10.1020/build/../tftpboot/root/zImage.uImage
+ '[' lzma = lzma ']'
+ echo '**** Generating vmlinux_ap123.lzma.uImage ********'
**** Generating vmlinux_ap123.lzma.uImage ********
+ /extFlash1/Aquila_9.2.._u10.1020/build/../boot/u-boot/tools/mkimage -A mips -O linux -T kernel -C lzma -a 0x80002000 -e 0x801faed0 -n 'Linux Kernel Image' -d /extFlash1/Aquila_9.2.._u10.1020/build/../linux/kernels/mips-linux-2.6.31/arch/mips/boot/vmlinux.bin.lzma /extFlash1/Aquila_9.2.._u10.1020/build/../images-ROUTER_9341/ar934x-router_ap123/vmlinux_ap123.lzma.uImage
Image Name:   Linux Kernel Image
Created:      Tue Feb 19 11:58:29 2013
Image Type:   MIPS Linux Kernel Image (lzma compressed)
Data Size:    977653 Bytes = 954.74 kB = 0.93 MB
Load Address: 0x80002000
Entry Point:  0x801FAED0
+ cp /extFlash1/Aquila_9.2.._u10.1020/build/../images-ROUTER_9341/ar934x-router_ap123/vmlinux_ap123.lzma.uImage /extFlash1/Aquila_9.2.._u10.1020/build/../tftpboot/root

+ cp /extFlash1/Aquila_9.2.._u10.1020/build/../images-ROUTER_9341/ar934x-router_ap123/vmlinux_ap123.lzma.uImage /extFlash1/Aquila_9.2.._u10.1020/build/../tftpboot/root/zImage.uImage