@@ -48,19 +48,16 @@ reset_path ()
4848# do the mount magic
4949do_mount ()
5050{
51- echo " mount -o bind $BASE_DIR / $KERNEL_DIR $BASE_DIR / $ROOT_TARGET / $KERNEL_DIR "
51+ sleep 1 ;
5252 mount -o bind $BASE_DIR /$KERNEL_DIR $BASE_DIR /$ROOT_TARGET /$KERNEL_DIR ;
53- echo " mount -t proc proc $BASE_DIR /$ROOT_TARGET /proc/"
5453 mount -t proc proc $BASE_DIR /$ROOT_TARGET /proc/;
55- echo " mount -t sysfs sys $BASE_DIR /$ROOT_TARGET /sys/"
5654 mount -t sysfs sys $BASE_DIR /$ROOT_TARGET /sys/;
57- echo " mount -o bind /dev $BASE_DIR /$ROOT_TARGET /dev/"
5855 mount -o bind /dev $BASE_DIR /$ROOT_TARGET /dev/;
59- echo " mount -t devpts devpts -o mode=620,gid=5 $BASE_DIR /$ROOT_TARGET /dev/pts/"
6056 mount -t devpts devpts -o mode=620,gid=5 $BASE_DIR /$ROOT_TARGET /dev/pts/;
6157}
6258do_unmount ()
6359{
60+ sleep 1;
6461 umount $BASE_DIR /$ROOT_TARGET /dev/pts/;
6562 umount $BASE_DIR /$ROOT_TARGET /dev/;
6663 umount $BASE_DIR /$ROOT_TARGET /sys/;
110107 chroot $BASE_DIR /$ROOT_TARGET dpkg-divert --divert /usr/bin/ischroot.debianutils --rename /usr/bin/ischroot;
111108 chroot $BASE_DIR /$ROOT_TARGET /bin/ln -s /bin/true /usr/bin/ischroot;
112109
113- }
114- deboot_chroot ()
115- {
116- # do the bootstrap
117- DEBOOTSTRAP_DIR=$BASE_DIR /$DEBOOT_DIR /usr/share/debootstrap $BASE_DIR /$DEBOOT_DIR /usr/sbin/debootstrap --foreign --arch=$ROOT_ARCH --variant=buildd --no-check-gpg $ROOT_SUITE $BASE_DIR /$ROOT_TARGET $ROOT_SOURCE ;
118- # do the second stage bootstrap
119- chroot $BASE_DIR /$ROOT_TARGET /debootstrap/debootstrap --second-stage;
120- # deboot feels the need to mount proc, we don't need it here
121- umount $BASE_DIR /$ROOT_TARGET /proc;
122-
123- # stop dpkg from running daemons
124- cat > $BASE_DIR /$ROOT_TARGET /usr/sbin/policy-rc.d << EOF
125- #!/bin/sh
126- exit 101
127- EOF
128- chmod a+x $BASE_DIR /$ROOT_TARGET /usr/sbin/policy-rc.d;
129-
130- # update the chroot's sources.list
131- # cat > $BASE_DIR/$ROOT_TARGET/etc/apt/sources.list <<EOF
132- # deb http://archive.ubuntu.com/ubuntu $ROOT_SUITE main restricted universe multiverse
133- # deb http://archive.ubuntu.com/ubuntu $ROOT_SUITE-updates main restricted universe multiverse
134- # deb http://archive.ubuntu.com/ubuntu $ROOT_SUITE-security main restricted universe multiverse
135- # EOF
136- printf ' %s' " $ROOT_SOURCES_LIST "
137- > $BASE_DIR /$ROOT_TARGET /etc/apt/sources.list;
138-
139- # divert ischroot
140- # note that this throws error, my need to be fixed, not sure
141- chroot $BASE_DIR /$ROOT_TARGET dpkg-divert --divert /usr/bin/ischroot.debianutils --rename /usr/bin/ischroot;
142- chroot $BASE_DIR /$ROOT_TARGET /bin/ln -s /bin/true /usr/bin/ischroot;
143-
144110}
145111
146112# bring the chroot current
@@ -175,6 +141,25 @@ get_architecture ()
175141 esac ;
176142}
177143
144+ # functions for managing the kernel source
145+ kernel_get ()
146+ {
147+ git clone $KERNEL_REPO $BASE_DIR /$KERNEL_DIR ;
148+ }
149+ # see https://wiki.ubuntu.com/Nexus7/Kernel for more information
150+ kernel_build ()
151+ {
152+ set_path;
153+ do_mount;
154+ cd $BASE_DIR /$ROOT_TARGET /$KERNEL_DIR ;
155+ git clean -xdf;
156+ sed -i ' /do_tools/ s/true/false/' debian.nexus7/rules.d/armhf.mk;
157+ chroot $BASE_DIR /$ROOT_TARGET su - -c " cd /" $KERNEL_DIR " ; fakeroot debian/rules clean" ;
158+ chroot $BASE_DIR /$ROOT_TARGET su - -c ' cd /' $KERNEL_DIR ' ; debuild -eDEB_BUILD_OPTIONS="parallel=' $BUILD_PROCESSES ' " -eCROSS_COMPILE="ccache arm-linux-gnueabihf-" -b -aarmhf -us -uc -nc' ;
159+ cd $BASE_DIR ;
160+ do_unmount;
161+ reset_path;
162+ }
178163# this patch was attempting to fix a problem that was actually a path
179164# problem, so it's currently not used, but left in case it's needed later
180165# deboot comes out of the box with an offensive mount command.
0 commit comments