From owner-freebsd-embedded@FreeBSD.ORG Mon Jun 25 11:07:16 2012 Return-Path: Delivered-To: freebsd-embedded@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0A3651065746 for ; Mon, 25 Jun 2012 11:07:16 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E79EF8FC1E for ; Mon, 25 Jun 2012 11:07:15 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q5PB7FFK078288 for ; Mon, 25 Jun 2012 11:07:15 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q5PB7FON078286 for freebsd-embedded@FreeBSD.org; Mon, 25 Jun 2012 11:07:15 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 25 Jun 2012 11:07:15 GMT Message-Id: <201206251107.q5PB7FON078286@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-embedded@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-embedded@FreeBSD.org X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Jun 2012 11:07:16 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o misc/52256 embedded [picobsd] picobsd build script does not read in user/s o kern/42728 embedded [picobsd] many problems in src/usr.sbin/ppp/* after c 2 problems total. From owner-freebsd-embedded@FreeBSD.ORG Fri Jun 29 13:41:23 2012 Return-Path: Delivered-To: freebsd-embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7642106564A for ; Fri, 29 Jun 2012 13:41:22 +0000 (UTC) (envelope-from ardovm@yahoo.it) Received: from nm6-vm0.bullet.mail.ukl.yahoo.com (nm6-vm0.bullet.mail.ukl.yahoo.com [217.146.183.234]) by mx1.freebsd.org (Postfix) with SMTP id 196A78FC19 for ; Fri, 29 Jun 2012 13:41:21 +0000 (UTC) Received: from [217.146.183.209] by nm6.bullet.mail.ukl.yahoo.com with NNFMP; 29 Jun 2012 13:38:02 -0000 Received: from [217.146.182.149] by tm2.bullet.mail.ukl.yahoo.com with NNFMP; 29 Jun 2012 13:38:02 -0000 Received: from [127.0.0.1] by smtp118.mail.ukl.yahoo.com with NNFMP; 29 Jun 2012 13:38:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.it; s=s1024; t=1340977082; bh=inYS9Fr6yGZMnUAT2XAgvjdfW022zC8scIHkYmD9fNE=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:Received:Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent; b=4QmMbTVN5kxqqGUqhk/2uc4dut3TLlkDzN+vXv8lcW/tCSy8hkNwasmtaU1gJBvnBzGlqkHEx4XKGH8vGdS86t1WaQbF6mg0x9yOufvfQPkUgBHChA2mtpD+K0oWFLSY+TVX4MJE3MPBDZFar4fV4XdbTn/lwK4yufVT/7sFDlI= X-Yahoo-Newman-Id: 150644.27942.bm@smtp118.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: kXaxmVAVM1nAIV4F7UOXQcXM.o1Jgmj_nBU0OUgvgG5R9Ul TPRdUsXCPnYeaA.X7rwTsM1at5vpr794DXAoPP6A62DKshLmdPumLJb4gWDm jtcYIrosOpQ8R0qnq33aWdA8XvsJnL_H2KtpsqrhCmf6zXplpgcy_lROoIIB K0mGHmhm8sgaIrOCAwDPc7FXmQnElzKs73oyI0ScZinhM38hhycxsBk0tqtQ Ux4EU.VZPMvcb_aS.pQ8Nh4y4gh0DFPz77AMnzIkbSyK54J_r1N9yP4UlDrI 4__z6YoeZ15kwENDRbjZeMXZCPmNmNMrUOBgPvAnaN9v3AL77dwh9y.OQbcq KAzziX7OsSl9qeEzAHZNSycStShDkdeHfsTW8skyRho20PXeaAvuVsGhR8JY oYplzkhbXYA9xcMD_mp_KrJfoYWEWaLNrN5W4VOUShADuJ_Q07ctRk11718Y xLwKr8dXhK0XAsQahV0Q7CB53IUpQnm1yAG3jGn4beoLYRbMrdbdmcjU09Ng J42zudmw65bOPOTlr020vCLb8VCLpn9mMH05u0wBZvnFy2fCgaCys8a1TPYL cVRVdjYbr841h8yTHu7p3Xx_nCBtVE.FIudCUaHJZ3u37IbiW6G83h4ZGcIh ux8MX85pR4DrxBMwoR7J5dwibwRfY2FU6uGsSfmu. X-Yahoo-SMTP: WU.IBxeswBAAnLcBZV3tEZIK0A-- Received: from snail (ardovm@93.145.119.59 with login) by smtp118.mail.ukl.yahoo.com with SMTP; 29 Jun 2012 06:38:01 -0700 PDT Received: by snail (Postfix, from userid 1000) id 44DB4502F97; Fri, 29 Jun 2012 15:38:00 +0200 (CEST) Date: Fri, 29 Jun 2012 15:38:00 +0200 From: Arrigo Marchiori To: freebsd-embedded@freebsd.org Message-ID: <20120629133759.GA19373@snail.casa> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Nq2Wo0NMKNjxTN9z" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Creating code slice before disk image in nanobsd X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jun 2012 13:41:23 -0000 --Nq2Wo0NMKNjxTN9z Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Hello list, the attached patch to nanobsd.sh should build the code image before the full disk, that is the opposite of the current behavior (at least in 8-STABLE and previous releases). These are the two modifications introduced by the patch: 1- use of gpart instead of fdisk, from this thread: http://lists.freebsd.org/pipermail/freebsd-embedded/2012-April/001542.html ; 2- code slice (_.disk.image) built before full disk (_.disk.full). I could not test the attachment extensively; I am looking forward to your help for this. The parameters were changed as follows: -i : now means ``do not create _.disk.full'' -f : now means ``do not create _.disk.image'' and implies -i Keep reading below for detailed information about the changes. There is a new function: calculate_partitioning() that creates the file ${NANO_OBJ}/_.partitioning. This file contains the start sector and the length for every partition, one for each line. The new function create_i386_code_slice() takes the first entry of the _.partitioning file to get the size of the code partition. The rest is copied from the former create_i386_diskimage(). The patched create_i386_diskimage() function creates the file _.gpart from the _.partitioning file, then it runs it, and copies the _.disk.image file into the two code slices of _.disk.full. The second code image is ``adapted'' to be in the second slice, etc. This is the big picture; you should be able to understand everything else by looking at the source. An open problem is: shall we specify if the _.disk.image has to be adapted for slice no. 1 or 2? This ambiguity is also present in the current revision, that only generates it for the first slice. This behavior is kept by the attached patch. Second open problem: the other scripts in the nanobsd/ directory shall be adapted to use gpart instead of fdisk; I don't use them at work, therefore I did not look at them carefully. I am looking forward to receive your reviews and comments. Best regards, -- rigo http://rigo.altervista.org --Nq2Wo0NMKNjxTN9z Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="nanobsd.sh.patch" --- nanobsd.sh.originale 2012-04-10 12:41:31.000000000 +0200 +++ nanobsd.sh 2012-06-12 16:52:04.000000000 +0200 @@ -431,30 +431,18 @@ populate_slice "$1" "$2" "$3" "$4" ) -create_i386_diskimage ( ) ( - pprint 2 "build diskimage" - pprint 3 "log: ${NANO_OBJ}/_.di" - - ( +calculate_partitioning ( ) ( echo $NANO_MEDIASIZE $NANO_IMAGES \ $NANO_SECTS $NANO_HEADS \ $NANO_CODESIZE $NANO_CONFSIZE $NANO_DATASIZE | awk ' { - printf "# %s\n", $0 - # size of cylinder in sectors cs = $3 * $4 # number of full cylinders on media cyl = int ($1 / cs) - # output fdisk geometry spec, truncate cyls to 1023 - if (cyl <= 1023) - print "g c" cyl " h" $4 " s" $3 - else - print "g c" 1023 " h" $4 " s" $3 - if ($7 > 0) { # size of data partition in full cylinders dsl = int (($7 + cs - 1) / cs) @@ -465,45 +453,94 @@ # size of config partition in full cylinders csl = int (($6 + cs - 1) / cs) + # size of image partition(s) in full cylinders if ($5 == 0) { - # size of image partition(s) in full cylinders isl = int ((cyl - dsl - csl) / $2) } else { isl = int (($5 + cs - 1) / cs) } # First image partition start at second track - print "p 1 165 " $3, isl * cs - $3 + print $3, isl * cs - $3 c = isl * cs; # Second image partition (if any) also starts offset one # track to keep them identical. if ($2 > 1) { - print "p 2 165 " $3 + c, isl * cs - $3 + print $3 + c, isl * cs - $3 c += isl * cs; } # Config partition starts at cylinder boundary. - print "p 3 165 " c, csl * cs + print c, csl * cs c += csl * cs # Data partition (if any) starts at cylinder boundary. if ($7 > 0) { - print "p 4 165 " c, dsl * cs + print c, dsl * cs } else if ($7 < 0 && $1 > c) { - print "p 4 165 " c, $1 - c + print c, $1 - c } else if ($1 < c) { print "Disk space overcommitted by", \ c - $1, "sectors" > "/dev/stderr" exit 2 } - - # Force slice 1 to be marked active. This is necessary - # for booting the image from a USB device to work. - print "a 1" } - ' > ${NANO_OBJ}/_.fdisk + ' > ${NANO_OBJ}/_.partitioning + +) + +create_i386_code_slice ( ) ( + pprint 2 "build code slice" + pprint 3 "log: ${NANO_OBJ}/_.cs" + + ( + IMG=${NANO_DISKIMGDIR}/_.disk.image + MNT=${NANO_OBJ}/_.mnt + mkdir -p ${MNT} + CODE_SIZE=`head -n 1 ${NANO_OBJ}/_.partitioning | awk '{ print $2 }'` + + if [ "${NANO_MD_BACKING}" = "swap" ] ; then + MD=`mdconfig -a -t swap -s ${CODE_SIZE} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + else + echo "Creating md backing file..." + rm -f ${IMG} + dd if=/dev/zero of=${IMG} seek=${CODE_SIZE} count=0 + MD=`mdconfig -a -t vnode -f ${IMG} -x ${NANO_SECTS} \ + -y ${NANO_HEADS}` + fi + + trap "echo 'Running exit trap code' ; df -i ${MNT} ; umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT + + bsdlabel -w -B -b ${NANO_WORLDDIR}/boot/boot ${MD} + bsdlabel ${MD} + + # Create first image + populate_slice /dev/${MD}a ${NANO_WORLDDIR} ${MNT} "s1a" + mount /dev/${MD}a ${MNT} + echo "Generating mtree..." + ( cd ${MNT} && mtree -c ) > ${NANO_OBJ}/_.mtree + ( cd ${MNT} && du -k ) > ${NANO_OBJ}/_.du + umount ${MNT} + if [ "${NANO_MD_BACKING}" = "swap" ] ; then + echo "Writing out _.disk.image..." + dd if=/dev/${MD} of=${NANO_DISKIMGDIR}/_.disk.image bs=64k + fi + mdconfig -d -u $MD + + trap - 1 2 15 EXIT + + ) > ${NANO_OBJ}/_.cs 2>&1 +) + + +create_i386_diskimage ( ) ( + pprint 2 "build diskimage" + pprint 3 "log: ${NANO_OBJ}/_.di" + + ( IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} MNT=${NANO_OBJ}/_.mnt mkdir -p ${MNT} @@ -519,9 +556,26 @@ -y ${NANO_HEADS}` fi + awk ' + BEGIN { + # Create MBR partition table + print "gpart create -s mbr $1" + } + { + # Make partition + print "gpart add -t freebsd -b ", $1, " -s ", $2, " $1" + } + END { + # Force slice 1 to be marked active. This is necessary + # for booting the image from a USB device to work. + print "gpart set -a active -i 1 $1" + } + ' ${NANO_OBJ}/_.partitioning > ${NANO_OBJ}/_.gpart + trap "echo 'Running exit trap code' ; df -i ${MNT} ; umount ${MNT} || true ; mdconfig -d -u $MD" 1 2 15 EXIT - fdisk -i -f ${NANO_OBJ}/_.fdisk ${MD} + sh ${NANO_OBJ}/_.gpart ${MD} + gpart show ${MD} fdisk ${MD} # XXX: params # XXX: pick up cached boot* files, they may not be in image anymore. @@ -529,13 +583,8 @@ bsdlabel -w -B -b ${NANO_WORLDDIR}/boot/boot ${MD}s1 bsdlabel ${MD}s1 - # Create first image - populate_slice /dev/${MD}s1a ${NANO_WORLDDIR} ${MNT} "s1a" - mount /dev/${MD}s1a ${MNT} - echo "Generating mtree..." - ( cd ${MNT} && mtree -c ) > ${NANO_OBJ}/_.mtree - ( cd ${MNT} && du -k ) > ${NANO_OBJ}/_.du - umount ${MNT} + echo "Writing code image..." + dd if=${NANO_DISKIMGDIR}/_.disk.image of=/dev/${MD}s1 bs=64k if [ $NANO_IMAGES -gt 1 -a $NANO_INIT_IMG2 -gt 0 ] ; then # Duplicate to second image (if present) @@ -567,10 +616,6 @@ dd if=/dev/${MD} of=${IMG} bs=64k fi - if ${do_copyout_partition} ; then - echo "Writing out _.disk.image..." - dd if=/dev/${MD}s1 of=${NANO_DISKIMGDIR}/_.disk.image bs=64k - fi mdconfig -d -u $MD trap - 1 2 15 EXIT @@ -578,6 +623,11 @@ ) > ${NANO_OBJ}/_.di 2>&1 ) +# i386 and amd64 are identical for code partitions +create_amd64_code_slice ( ) ( + create_i386_code_slice +) + # i386 and amd64 are identical for disk images create_amd64_diskimage ( ) ( create_i386_diskimage @@ -768,7 +818,7 @@ ( echo "Usage: $0 [-bfiknqvw] [-c config_file]" echo " -b suppress builds (both kernel and world)" - echo " -f suppress code slice extraction" + echo " -f suppress code slice extraction (implies -i)" echo " -i suppress disk image build" echo " -k suppress buildkernel" echo " -n add -DNO_CLEAN to buildworld, buildkernel, etc" @@ -786,8 +836,8 @@ do_clean=true do_kernel=true do_world=true +do_code=true do_image=true -do_copyout_partition=true set +e args=`getopt bc:fhiknqvw $*` @@ -817,7 +867,8 @@ shift ;; -f) - do_copyout_partition=false + do_code=false + do_image=false shift ;; -h) @@ -952,10 +1003,16 @@ setup_nanobsd prune_usr run_late_customize -if $do_image ; then - create_${NANO_ARCH}_diskimage +if $do_code ; then + calculate_partitioning + create_${NANO_ARCH}_code_slice + if $do_image ; then + create_${NANO_ARCH}_diskimage + else + pprint 2 "Skipping image build (as instructed)" + fi else - pprint 2 "Skipping image build (as instructed)" + pprint 2 "Skipping code and image build (as instructed)" fi last_orders --Nq2Wo0NMKNjxTN9z--