added uboot
This commit is contained in:
		
							
								
								
									
										49
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								Dockerfile
									
									
									
									
									
								
							@@ -1,8 +1,54 @@
 | 
				
			|||||||
 | 
					FROM debian:buster AS uboot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN apt-get update && \
 | 
				
			||||||
 | 
					    apt-get install -y build-essential git wget bison flex gcc-arm-linux-gnueabi device-tree-compiler bc
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN mkdir /uboot_build/ && \
 | 
				
			||||||
 | 
					    mkdir /uboot/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					WORKDIR /uboot_build/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN wget ftp://ftp.denx.de/pub/u-boot/u-boot-2019.10.tar.bz2 && \
 | 
				
			||||||
 | 
					    tar -xjf u-boot-2019.10.tar.bz2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					WORKDIR /uboot_build/u-boot-2019.10/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# model a/b/zero
 | 
				
			||||||
 | 
					RUN make CROSS_COMPILE=arm-linux-gnueabi- distclean && \
 | 
				
			||||||
 | 
					    make CROSS_COMPILE=arm-linux-gnueabi- rpi_defconfig && \
 | 
				
			||||||
 | 
					    make CROSS_COMPILE=arm-linux-gnueabi- -j8 u-boot.bin && \
 | 
				
			||||||
 | 
					    cp u-boot.bin /uboot/u-boot_rpi1.bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# model zero w
 | 
				
			||||||
 | 
					RUN make CROSS_COMPILE=arm-linux-gnueabi- distclean && \
 | 
				
			||||||
 | 
					    make CROSS_COMPILE=arm-linux-gnueabi- rpi_0_w_defconfig && \
 | 
				
			||||||
 | 
					    make CROSS_COMPILE=arm-linux-gnueabi- -j8 u-boot.bin && \
 | 
				
			||||||
 | 
					    cp u-boot.bin /uboot/u-boot_rpi0_w.bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# model 2 b
 | 
				
			||||||
 | 
					RUN make CROSS_COMPILE=arm-linux-gnueabi- distclean && \
 | 
				
			||||||
 | 
					    make CROSS_COMPILE=arm-linux-gnueabi- rpi_2_defconfig && \
 | 
				
			||||||
 | 
					    make CROSS_COMPILE=arm-linux-gnueabi- -j8 u-boot.bin && \
 | 
				
			||||||
 | 
					    cp u-boot.bin /uboot/u-boot_rpi2.bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# model 3 (32 bit)
 | 
				
			||||||
 | 
					RUN make CROSS_COMPILE=arm-linux-gnueabi- distclean && \
 | 
				
			||||||
 | 
					    make CROSS_COMPILE=arm-linux-gnueabi- rpi_3_32b_defconfig && \
 | 
				
			||||||
 | 
					    make CROSS_COMPILE=arm-linux-gnueabi- -j8 u-boot.bin && \
 | 
				
			||||||
 | 
					    cp u-boot.bin /uboot/u-boot_rpi3.bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# model 4 (32 bit)
 | 
				
			||||||
 | 
					RUN make CROSS_COMPILE=arm-linux-gnueabi- distclean && \
 | 
				
			||||||
 | 
					    make CROSS_COMPILE=arm-linux-gnueabi- rpi_4_32b_defconfig && \
 | 
				
			||||||
 | 
					    make CROSS_COMPILE=arm-linux-gnueabi- -j8 u-boot.bin && \
 | 
				
			||||||
 | 
					    cp u-boot.bin /uboot/u-boot_rpi4.bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM alpine:3.10
 | 
					FROM alpine:3.10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN apk update && \
 | 
					RUN apk update && \
 | 
				
			||||||
    apk add automake build-base git autoconf confuse-dev linux-headers \
 | 
					    apk add automake build-base git autoconf confuse-dev linux-headers \
 | 
				
			||||||
            findutils mtools e2fsprogs-extra alpine-sdk dosfstools && \
 | 
					            findutils mtools e2fsprogs-extra alpine-sdk dosfstools uboot-tools && \
 | 
				
			||||||
    rm -rf /var/cache/apk/*
 | 
					    rm -rf /var/cache/apk/*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN git clone https://github.com/pengutronix/genimage.git /tmp/genimage && \
 | 
					RUN git clone https://github.com/pengutronix/genimage.git /tmp/genimage && \
 | 
				
			||||||
@@ -23,5 +69,6 @@ RUN cd /genext2fs && \
 | 
				
			|||||||
    rm -rf /tmp/pkg/
 | 
					    rm -rf /tmp/pkg/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ADD ./resources /resources
 | 
					ADD ./resources /resources
 | 
				
			||||||
 | 
					COPY --from=uboot /uboot/ /uboot/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
WORKDIR /work
 | 
					WORKDIR /work
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										30
									
								
								Dockerfile.bak
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								Dockerfile.bak
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					FROM alpine:3.10
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN apk update && \
 | 
				
			||||||
 | 
					    apk add automake build-base git autoconf confuse-dev linux-headers \
 | 
				
			||||||
 | 
					            findutils mtools e2fsprogs-extra alpine-sdk dosfstools && \
 | 
				
			||||||
 | 
					    rm -rf /var/cache/apk/*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN git clone https://github.com/pengutronix/genimage.git /tmp/genimage && \
 | 
				
			||||||
 | 
					    cd /tmp/genimage && \
 | 
				
			||||||
 | 
					    ./autogen.sh && \
 | 
				
			||||||
 | 
					    ./configure CFLAGS='-g -O0' --prefix=/usr && \
 | 
				
			||||||
 | 
					    make install && \
 | 
				
			||||||
 | 
					    cd && \
 | 
				
			||||||
 | 
					    rm -rf /tmp/genimage
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ADD ./resources/genext2fs /genext2fs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN cd /genext2fs && \
 | 
				
			||||||
 | 
					    abuild-keygen -a -i -q && \
 | 
				
			||||||
 | 
					    abuild -F -P /tmp/pkg && \
 | 
				
			||||||
 | 
					    apk add /tmp/pkg/x86_64/genext2fs-1*.apk && \
 | 
				
			||||||
 | 
					    rm -rf /tmp/pkg/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ADD ./resources /resources
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RUN apk update
 | 
				
			||||||
 | 
					RUN apk add uboot-tools
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					WORKDIR /work
 | 
				
			||||||
							
								
								
									
										3
									
								
								resources/boot.cmd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								resources/boot.cmd
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					fdt addr ${fdt_addr} && fdt get value bootargs /chosen bootargs
 | 
				
			||||||
 | 
					ext4load mmc 0:2 ${kernel_addr_r} /boot/uImage
 | 
				
			||||||
 | 
					bootm ${kernel_addr_r} - ${fdt_addr}
 | 
				
			||||||
@@ -72,7 +72,6 @@ apk --root ${ROOTFS_PATH} --update-cache --initdb --arch armhf add $BASE_PACKAGE
 | 
				
			|||||||
# add google DNS to enable network access inside chroot
 | 
					# add google DNS to enable network access inside chroot
 | 
				
			||||||
echo "nameserver 8.8.8.8" > ${ROOTFS_PATH}/etc/resolv.conf
 | 
					echo "nameserver 8.8.8.8" > ${ROOTFS_PATH}/etc/resolv.conf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 | 
					# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 | 
				
			||||||
echo ">> Configure root FS"
 | 
					echo ">> Configure root FS"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -139,8 +138,15 @@ chmod +x ${ROOTFS_PATH}/etc/local.d/90-resizedata.start
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# mount data and boot partition (root is already mounted)
 | 
					# mount data and boot partition (root is already mounted)
 | 
				
			||||||
cat >${ROOTFS_PATH}/etc/fstab <<EOF
 | 
					cat >${ROOTFS_PATH}/etc/fstab <<EOF
 | 
				
			||||||
/dev/mmcblk0p1   /boot  vfat    defaults,ro    0       2
 | 
					/dev/mmcblk0p1   /uboot  vfat    defaults,ro    0       2
 | 
				
			||||||
/dev/mmcblk0p3   /data  ext4    defaults       0       1
 | 
					/dev/mmcblk0p4   /data   ext4    defaults       0       1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					proc           /proc        proc   defaults        0     0
 | 
				
			||||||
 | 
					sysfs          /sys         sysfs  defaults        0     0
 | 
				
			||||||
 | 
					devpts         /dev/pts     devpts gid=4,mode=620  0     0
 | 
				
			||||||
 | 
					tmpfs          /dev/shm     tmpfs  defaults        0     0
 | 
				
			||||||
 | 
					tmpfs          /tmp         tmpfs  defaults        0     0
 | 
				
			||||||
 | 
					tmpfs          /run         tmpfs  defaults        0     0
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# custom
 | 
					# custom
 | 
				
			||||||
@@ -152,6 +158,12 @@ rm -rf ${ROOTFS_PATH}/var/cache/apk/*
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# TODO /etc/motd
 | 
					# TODO /etc/motd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 | 
				
			||||||
 | 
					echo ">> Prepare kernel for uboot"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# build uImage
 | 
				
			||||||
 | 
					mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Linux kernel" -d ${ROOTFS_PATH}/boot/vmlinuz-rpi2 ${ROOTFS_PATH}/boot/uImage 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 | 
					# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 | 
				
			||||||
# create boot FS
 | 
					# create boot FS
 | 
				
			||||||
@@ -164,16 +176,31 @@ mkdir -p ${BOOTFS_PATH}
 | 
				
			|||||||
wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin
 | 
				
			||||||
wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/fixup.dat
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/fixup.dat
 | 
				
			||||||
wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/fixup_cd.dat
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/fixup_cd.dat
 | 
				
			||||||
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/fixup_db.dat
 | 
				
			||||||
wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/fixup_x.dat
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/fixup_x.dat
 | 
				
			||||||
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/fixup4.dat
 | 
				
			||||||
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/fixup4cd.dat
 | 
				
			||||||
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/fixup4db.dat
 | 
				
			||||||
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/fixup4x.dat
 | 
				
			||||||
wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/start.elf
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/start.elf
 | 
				
			||||||
wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/start_cd.elf
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/start_cd.elf
 | 
				
			||||||
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/start_db.elf
 | 
				
			||||||
wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/start_x.elf
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/start_x.elf
 | 
				
			||||||
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/start4.elf
 | 
				
			||||||
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/start4cd.elf
 | 
				
			||||||
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/start4db.elf
 | 
				
			||||||
 | 
					wget -P ${BOOTFS_PATH} https://github.com/raspberrypi/firmware/raw/master/boot/start4x.elf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# copy linux kernel and overlays
 | 
					# copy linux kernel and overlays to boot
 | 
				
			||||||
cp ${ROOTFS_PATH}/usr/lib/linux-*-rpi2/*.dtb ${BOOTFS_PATH}/
 | 
					cp ${ROOTFS_PATH}/usr/lib/linux-*-rpi2/*.dtb ${BOOTFS_PATH}/
 | 
				
			||||||
cp -r ${ROOTFS_PATH}/usr/lib/linux-*-rpi2/overlays ${BOOTFS_PATH}/
 | 
					cp -r ${ROOTFS_PATH}/usr/lib/linux-*-rpi2/overlays ${BOOTFS_PATH}/
 | 
				
			||||||
cp ${ROOTFS_PATH}/boot/initramfs-rpi2 ${BOOTFS_PATH}/
 | 
					
 | 
				
			||||||
cp ${ROOTFS_PATH}/boot/vmlinuz-rpi2 ${BOOTFS_PATH}/
 | 
					# copy u-boot
 | 
				
			||||||
 | 
					cp /uboot/* ${BOOTFS_PATH}/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# generate boot script
 | 
				
			||||||
 | 
					mkimage -A arm -T script -C none -n "Boot script" -d ${RES_PATH}/boot.cmd ${BOOTFS_PATH}/boot.scr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# write boot config
 | 
					# write boot config
 | 
				
			||||||
cat >${BOOTFS_PATH}/config.txt <<EOF
 | 
					cat >${BOOTFS_PATH}/config.txt <<EOF
 | 
				
			||||||
@@ -189,22 +216,27 @@ hdmi_mode=1
 | 
				
			|||||||
hdmi_mode=87
 | 
					hdmi_mode=87
 | 
				
			||||||
hdmi_cvt 800 480 60 6 0 0 0
 | 
					hdmi_cvt 800 480 60 6 0 0 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					kernel=u-boot_rpi1.bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[pi0w]
 | 
				
			||||||
 | 
					kernel=u-boot_rpi0_w.bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[pi2]
 | 
					[pi2]
 | 
				
			||||||
kernel=vmlinuz-rpi2
 | 
					kernel=u-boot_rpi2.bin
 | 
				
			||||||
initramfs initramfs-rpi2
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
[pi3]
 | 
					[pi3]
 | 
				
			||||||
kernel=vmlinuz-rpi2
 | 
					kernel=u-boot_rpi3.bin
 | 
				
			||||||
initramfs initramfs-rpi2
 | 
					
 | 
				
			||||||
 | 
					[pi4]
 | 
				
			||||||
 | 
					kernel=u-boot_rpi4.bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[all]
 | 
					[all]
 | 
				
			||||||
include usercfg.txt
 | 
					enable_uart=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cat >${BOOTFS_PATH}/cmdline.txt <<EOF
 | 
					cat >${BOOTFS_PATH}/cmdline.txt <<EOF
 | 
				
			||||||
console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 fsck.repair=yes rw rootwait quiet
 | 
					console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 fsck.repair=yes rw rootwait quiet
 | 
				
			||||||
 | 
					 | 
				
			||||||
EOF
 | 
					EOF
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 | 
					# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 | 
				
			||||||
@@ -224,8 +256,8 @@ echo ">> Create SD card image"
 | 
				
			|||||||
# boot partition
 | 
					# boot partition
 | 
				
			||||||
cat >${WORK_PATH}/genimage_boot.cfg <<EOF
 | 
					cat >${WORK_PATH}/genimage_boot.cfg <<EOF
 | 
				
			||||||
image boot.vfat {
 | 
					image boot.vfat {
 | 
				
			||||||
  name = "boot"
 | 
					 | 
				
			||||||
  vfat {
 | 
					  vfat {
 | 
				
			||||||
 | 
					    label = "boot"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  size = 32M
 | 
					  size = 32M
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -235,8 +267,8 @@ make_image ${BOOTFS_PATH} ${WORK_PATH}/genimage_boot.cfg
 | 
				
			|||||||
# root partition
 | 
					# root partition
 | 
				
			||||||
cat >${WORK_PATH}/genimage_root.cfg <<EOF
 | 
					cat >${WORK_PATH}/genimage_root.cfg <<EOF
 | 
				
			||||||
image rootfs.ext4 {
 | 
					image rootfs.ext4 {
 | 
				
			||||||
  name = "root"
 | 
					 | 
				
			||||||
  ext4 {
 | 
					  ext4 {
 | 
				
			||||||
 | 
					    label = "rootfs"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  size = 150MB
 | 
					  size = 150MB
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -246,8 +278,8 @@ make_image ${ROOTFS_PATH} ${WORK_PATH}/genimage_root.cfg
 | 
				
			|||||||
# data partition
 | 
					# data partition
 | 
				
			||||||
cat >${WORK_PATH}/genimage_data.cfg <<EOF
 | 
					cat >${WORK_PATH}/genimage_data.cfg <<EOF
 | 
				
			||||||
image datafs.ext4 {
 | 
					image datafs.ext4 {
 | 
				
			||||||
  name = "data"
 | 
					 | 
				
			||||||
  ext4 {
 | 
					  ext4 {
 | 
				
			||||||
 | 
					    label = "data"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  size = 20MB
 | 
					  size = 20MB
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -266,7 +298,11 @@ image sdcard.img {
 | 
				
			|||||||
    image = "boot.vfat"
 | 
					    image = "boot.vfat"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  partition rootfs {
 | 
					  partition rootfs_a {
 | 
				
			||||||
 | 
					    partition-type = 0x83
 | 
				
			||||||
 | 
					    image = "rootfs.ext4"
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  partition rootfs_b {
 | 
				
			||||||
    partition-type = 0x83
 | 
					    partition-type = 0x83
 | 
				
			||||||
    image = "rootfs.ext4"
 | 
					    image = "rootfs.ext4"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,11 +18,8 @@ esac
 | 
				
			|||||||
LAST_PART_NUM=$(parted /dev/${ROOT_DEV} -ms unit s p | tail -n 1 | cut -f 1 -d:)
 | 
					LAST_PART_NUM=$(parted /dev/${ROOT_DEV} -ms unit s p | tail -n 1 | cut -f 1 -d:)
 | 
				
			||||||
LAST_PART="${ROOT_DEV}p${LAST_PART_NUM}"
 | 
					LAST_PART="${ROOT_DEV}p${LAST_PART_NUM}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# unmount last partition
 | 
				
			||||||
# unmount if mounted
 | 
					 | 
				
			||||||
if grep -qs "/dev/${LAST_PART}" /proc/mounts; then
 | 
					 | 
				
			||||||
umount /dev/${LAST_PART}
 | 
					umount /dev/${LAST_PART}
 | 
				
			||||||
fi
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Get the starting offset of last partition
 | 
					# Get the starting offset of last partition
 | 
				
			||||||
PART_START=$(parted /dev/${ROOT_DEV} -ms unit s p | grep "^${LAST_PART_NUM}" | cut -f 2 -d: | sed 's/[^0-9]//g')
 | 
					PART_START=$(parted /dev/${ROOT_DEV} -ms unit s p | grep "^${LAST_PART_NUM}" | cut -f 2 -d: | sed 's/[^0-9]//g')
 | 
				
			||||||
@@ -60,4 +57,4 @@ partprobe /dev/${ROOT_DEV} &&
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
mount -a
 | 
					mount -a
 | 
				
			||||||
 | 
					
 | 
				
			||||||
rm -f /etc/local.d/90-resizedata.start
 | 
					chmod -x /etc/local.d/90-resizedata.start
 | 
				
			||||||
		Reference in New Issue
	
	Block a user