[oe-commits] org.oe.dreambox dreambox-boottool: install as /bin/init, use pivot_root instead of chroot
tmbinc commit
openembedded-commits at lists.openembedded.org
Thu Jun 28 22:06:42 UTC 2007
dreambox-boottool: install as /bin/init, use pivot_root instead of chroot
Author: tmbinc at openembedded.org
Branch: org.openembedded.dreambox
Revision: f50a02ae3e8887b2f9d0c0696e646a968d17afec
ViewMTN: http://monotone.openembedded.org/revision.psp?id=f50a02ae3e8887b2f9d0c0696e646a968d17afec
Files:
1
packages/dreambox/dreambox-boottool/boottool-dm7025.c
packages/dreambox/dreambox-boottool.bb
Diffs:
#
# mt diff -r5f473b394a43741584087d04975a0fef361d78af -rf50a02ae3e8887b2f9d0c0696e646a968d17afec
#
#
#
# patch "packages/dreambox/dreambox-boottool/boottool-dm7025.c"
# from [88c0256895e89fb173c2b4af80a1e5b883feecaf]
# to [97dc0a9b3ea05ce3f97f7a0b44155ab601e97ebd]
#
# patch "packages/dreambox/dreambox-boottool.bb"
# from [4d9403f3ccead849401848aec98b861f3d842354]
# to [29897a29fac305e9690366c203ae9376029496ba]
#
============================================================
--- packages/dreambox/dreambox-boottool/boottool-dm7025.c 88c0256895e89fb173c2b4af80a1e5b883feecaf
+++ packages/dreambox/dreambox-boottool/boottool-dm7025.c 97dc0a9b3ea05ce3f97f7a0b44155ab601e97ebd
@@ -11,7 +11,7 @@
#define PREFIX
//#define PREFIX "/boot"
-#define SQUASHFS_FILENAME PREFIX"/flash/squashfs"
+#define SQUASHFS_FILENAME PREFIX"/mnt/flash/squashfs"
#define streq(a,b) (strcmp((a),(b)) == 0)
@@ -91,13 +91,13 @@ int main(int argc, char *argv[], char *e
{
int res, x;
- printf("Hello world!\n");
-
/* first, load some needed kernel modules located in the root of our boot partition */
const char *modules[] = { "fs/squashfs/unlzma.ko", "fs/squashfs/sqlzma.ko", "fs/squashfs/squashfs.ko", "fs/unionfs.ko", "drivers/block/loop.ko", 0 };
const char *modules_path = PREFIX"/lib/modules/2.6.12.6/kernel/";
char path[255];
+ printf("Hello world!\n");
+
x=0;
while(modules[x]) {
strcpy(path, modules_path);
@@ -109,7 +109,7 @@ int main(int argc, char *argv[], char *e
/* mount the RW jffs2 partition, which contains the squashfs image (in /squashfs) and the deltas (in /delta) */
printf("mounting mtd...\n");
- res = mount("/dev/mtdblock/3", PREFIX"/flash", "jffs2", 0, 0);
+ res = mount("/dev/mtdblock/3", PREFIX"/mnt/flash", "jffs2", 0, 0);
if (res)
{
@@ -155,7 +155,7 @@ int main(int argc, char *argv[], char *e
printf("mounting squashfs..\n");
/* and then mounting the loop device. */
- if (mount("/dev/loop/0", PREFIX"/squashfs", "squashfs", MS_MGC_VAL|MS_RDONLY, "") < 0)
+ if (mount("/dev/loop/0", PREFIX"/mnt/squashfs", "squashfs", MS_MGC_VAL|MS_RDONLY, "") < 0)
{
perror("mounting squashfs");
return 1;
@@ -173,32 +173,33 @@ int main(int argc, char *argv[], char *e
printf("mounting unionfs..\n");
- res = mount("none", PREFIX"/root", "unionfs", MS_MGC_VAL, "dirs="PREFIX"/flash/delta=rw:"PREFIX"/squashfs=ro");
+ res = mount("none", PREFIX"/mnt/root", "unionfs", MS_MGC_VAL, "dirs="PREFIX"/mnt/flash/delta=rw:"PREFIX"/mnt/squashfs=ro");
if (res < 0)
{
perror("mounting unionfs");
return 1;
}
- printf("chroot\n");
- if (chroot(PREFIX"/root") < 0)
+ printf("pivot_root\n");
+ if ( pivot_root(PREFIX"/mnt/root", PREFIX"/mnt/root/boot") < 0)
{
- perror("chroot");
+ perror("pivot_root");
return 1;
}
- printf("mouting devfs..\n");
+ printf("mounting devfs..\n");
res = mount("none", "/dev", "devfs", 0, 0);
if (res)
{
perror("mounting /dev");
return res;
}
+
+ printf("try umount old devfs..\n");
+ res = umount("/boot/dev");
+ perror("umount /boot/dev");
printf("call init!\n");
-
- sleep(1);
-
execve("/sbin/init", argv, envp);
perror("/sbin/init");
============================================================
--- packages/dreambox/dreambox-boottool.bb 4d9403f3ccead849401848aec98b861f3d842354
+++ packages/dreambox/dreambox-boottool.bb 29897a29fac305e9690366c203ae9376029496ba
@@ -5,7 +5,7 @@ PV = "1.0"
MAINTAINER = "Felix Domke <tmbinc at elitedvb.net>"
PV = "1.0"
-PR = "r0"
+PR = "r1"
DEPENDS = "klibc"
SRC_URI = "file://boottool-${MACHINE}.c"
@@ -13,14 +13,13 @@ do_install_append() {
S = "${WORKDIR}/"
do_install_append() {
- install -d ${D}/boot
- install ${S}/boottool ${D}/boot/boottool
+ install -d ${D}/boot/bin
+ install ${S}/boottool ${D}/boot/bin/init
}
do_compile_append() {
${STAGING_BINDIR}/${TARGET_ARCH}-linux-klcc ${S}/boottool-${MACHINE}.c -o ${S}/boottool
- ${STRIP} --remove-section=.comment --remove-section=.note --strip-unneeded ${S}/boottool
}
PACKAGE_ARCH := "${MACHINE_ARCH}"
+FILES_${PN} = "/boot/bin/init"
-FILES_${PN} = "/boot/boottool"
More information about the Openembedded-commits
mailing list